Button Stateful
A button that toggles between states.
Descriptor
lightning:buttonStatefulTargets
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out / Visualforce, Standalone Lightning App
Example Options
Basic Stateful ButtonsStateful button that toggles between two states Brand Variant Without IconStateful button with brand variant without icon Inverse VariantStateful button on a dark background Text VariantStateful button with text variant without hover label and icon
Basic Stateful Buttons
Code
<aura:component> <aura:attribute name="buttonstate" type="Boolean" default="false"/> <lightning:buttonStateful labelWhenOff="Follow" labelWhenOn="Following" labelWhenHover="Unfollow" iconNameWhenOff="utility:add" iconNameWhenOn="utility:check" iconNameWhenHover="utility:close" state="{! v.buttonstate }" onclick="{! c.handleClick }" /> </aura:component>