So I figured out a way to do this (hence adding it as an answer), but it feels very very ugly, and I'm sure I'm not using some basic Aura abilities.. so any improvements are more than welcome.
Here's the code:
Component markup:
<aura:component implements="forceCommunity:availableForAllPageTypes" access="global">
<div class="slds-tabs--default">
<ul class="slds-tabs--default__nav" role="tablist">
<li aura:id="tabpage" class="slds-tabs--default__item slds-text-heading--label slds-active" title="Active" onclick="{!c.changeTab}"
role="presentation"><a class="slds-tabs--default__link" href="javascript:void(0);" role="tab" tabindex="0" aria-selected="true" aria-controls="tab-default-1" id="tab-default-1__item">Active</a></li>
<li aura:id="tabpage" class="slds-tabs--default__item slds-text-heading--label" title="Previous" onclick="{!c.changeTab}"
role="presentation"><a class="slds-tabs--default__link" href="javascript:void(0);" role="tab" tabindex="-1" aria-selected="false" aria-controls="tab-default-2" id="tab-default-2__item">Previous</a></li>
</ul>
<div aura:id="tab-default-1" class="slds-tabs--default__content slds-show" role="tabpanel" aria-labelledby="tab-default-1__item">Item One Content</div>
<div aura:id="tab-default-2" class="slds-tabs--default__content slds-hide" role="tabpanel" aria-labelledby="tab-default-2__item">Item Two Content</div>
</div>
</aura:component>
Helper (used to find the div I clicked in):
({
getContainerDiv: function(event, element) {
var elem;
if (!element) {
elem = event.srcElement;
}
else {
elem = element;
}
if (elem.classList.contains('slds-tabs--default__item')) {
return elem;
}
else {
return this.getContainerDiv(event, elem.parentElement);
}
}
})
JS Controller (main logic):
({
changeTab: function(component, event, helper) {
var clickedTab = helper.getContainerDiv(event, null);
var tabs = component.find('tabpage');
for(idx = 0; idx < tabs.length; idx++)
{
tab = tabs[idx].elements[0];
$A.util.removeClass(tab, 'slds-active');
$A.util.removeClass(component.find(tab.children[0].getAttribute('aria-controls')), 'slds-show');
$A.util.addClass(component.find(tab.children[0].getAttribute('aria-controls')), 'slds-hide');
}
$A.util.addClass(clickedTab, 'slds-active');
$A.util.addClass(component.find(clickedTab.children[0].getAttribute('aria-controls')), 'slds-show');
$A.util.removeClass(component.find(clickedTab.children[0].getAttribute('aria-controls')), 'slds-hide');
}
})
First off, you're on the right track.
One of the odd things with web components is this new concept of the Shadow DOM. With the Shadow DOM, you cannot style base components with either css classes or the style attribute. (Read up on the Shadow DOM here: https://developer.salesforce.com/docs/component-library/documentation/lwc/lwc.create_dom)
This means you will not be able to style the lightning-button, unfortunately. However, there's nothing stopping you from using a regular old HTML button. With that in mind, it's time to head on over to the Lightning Design System site for a code snippet. https://www.lightningdesignsystem.com/components/buttons/ provides us a few examples, including a button with an icon.
Additionally, you're slightly over complicating this logic of toggling on and off the active piece of the button. You can achieve the same functionality with a simple boolean variable and two getter methods. I took a stab at what this would look like for you below.
Another great place for some insights on lightning web components is the Trailhead Sample Gallery, so be sure to check that out if you haven't already. You can find the gallery here: https://trailhead.salesforce.com/sample-gallery
Javascript:
import { LightningElement} from 'lwc';
export default class PcSelectButtonFramework extends LightningElement {
buttonClicked; //defaulted to false
// Handles click on the 'Show/hide content' button
handleToggleClick() {
this.buttonClicked = !this.buttonClicked; //set to true if false, false if true.
}
get cssClass(){
return this.buttonClicked ? 'slds-button slds-button_neutral active' : 'slds-button slds-button_neutral inactive';
}
get iconName(){
return this.buttonClicked ? 'utility:hide' : 'utility:preview';
}
}
Component:
<template>
<button class={cssClass}>
<lightning-icon icon-name={iconName} onclick={handleToggleClick}>Non Profit</lightning-icon>
</button>
</template>
Best Answer
You can't, this component does not have any property (or at least documented) that allows you to do this.
Instead, use the blueprints to create your own help text and icon