Skip to content

Push Button

Class: FxPushButton · Tag: <fx-push-button> · Mixins: Animatable

The <fx-push-button> component is a high-reliability hardware-style tactile push button. It supports customizable geometry profiles, active state latching or momentary triggers, and slotted icon capabilities.


Register the component by importing it in your entrypoint:

import '@salsafx/ui';

Interactive preview of the main variants:


A standard momentary round push button without any icon, using an external plate label:

State: Inactive
<fx-push-button
label="Start"
background-color="#06b6d4"
type="momentary"
shape="round"
></fx-push-button>

A momentary round push button with an external plate label and a FontAwesome icon via the icon attribute:

State: Inactive
<fx-push-button
label="Power"
background-color="#3b82f6"
type="momentary"
shape="round"
icon="fa-solid fa-power-off"
></fx-push-button>

A latching rectangular push button with rounded corners (same radius as FxSwitch buttons) and an embedded text label:

State: Inactive
<fx-push-button
label="Stop"
label-position="inside"
background-color="#ef4444"
type="latching"
shape="roundedRect"
></fx-push-button>

A sharper rectangular profile with a slight corner radius:

State: Inactive
<fx-push-button
label="Reset"
label-position="inside"
background-color="#10b981"
type="momentary"
shape="rect"
text-rendering-mode="shaded"
></fx-push-button>

Embedded label with an icon attribute — both rendered in shaded mode:

text + icon · both shaded
<fx-push-button
label="Reset"
label-position="inside"
background-color="#6366f1"
shape="roundedRect"
text-rendering-mode="shaded"
icon-rendering-mode="shaded"
icon="fa-solid fa-rotate-right"
></fx-push-button>

All geometry profiles side by side: round (circle), pill (stadium — semicircle caps with a straight middle), roundedRect (same radius as FxSwitch buttons), and rect (near-square corners).

round
pill
roundedRect
rect
<fx-push-button
label="Start"
shape="round"
background-color="#06b6d4"
>
<i slot="icon" class="fa-solid fa-play"></i>
</fx-push-button>
<fx-push-button
label="Evacuate"
label-position="inside"
shape="pill"
background-color="#fdba74"
type="latching"
></fx-push-button>
<fx-push-button
label="Stop"
label-position="inside"
shape="roundedRect"
background-color="#ef4444"
type="latching"
></fx-push-button>
<fx-push-button
label="Reset"
label-position="inside"
shape="rect"
background-color="#10b981"
text-rendering-mode="shaded"
></fx-push-button>

PropertyAttributeTypeDefaultDescription
labellabelString""Button text label.
labelPositionlabel-positionString"plate"Label placement (“plate”, “inside”, or “none”).
typetypeString"momentary"Button behavior type (“momentary” or “latching”).
isActiveis-activeBooleanfalseWhether the button is currently pressed or latched.
disableddisabledBooleanfalseDisables the control and prevents user interaction.
backgroundColorbackground-colorString"#6366f1"Button face background color.
foregroundColorforeground-colorString"#ffffff"Text and icon color override.
iconiconString""Icon-font class list (e.g. "fa-solid fa-power-off") or a path ending in .svg.
textRenderingModetext-rendering-modeString"foregroundColor"Coloring mode for the text label (“foregroundColor” or “shaded”).
iconRenderingModeicon-rendering-modeString"shaded"Coloring mode for the icon (“shaded” or “foregroundColor”).
shapeshapeString"round"Button shape (“round”, “pill”, “roundedRect”, or “rect”).
isAnimatedis-animatedBooleantrueEnables fluid, tactile animations and transitions.
NameDescription
iconNamed slot for inserting custom FontAwesome icons inside the button face. Prefer the icon attribute for standard FA classes; use the slot for custom markup.
Default slot for custom content when labelPosition is "inside" or "none".
NameDetailDescription
change{ active: Boolean, isActive: Boolean, type: String }Dispatched when the active state undergoes modification.
press{ active: Boolean, isActive: Boolean } or emptyDispatched on button depression.
releaseemptyDispatched on button release (momentary only).
PropertyDefaultDescription
--fx-font-familysans-serifComponent typography font family.
--fx-push-button-font-size0.875remLabel text size.
--fx-push-button-background-color#6366f1Button cap face fill color.
--fx-push-button-foreground-color#ffffffColor for text/icon when rendering mode is "foregroundColor".

classDiagram
    direction TB
    class FxElement
    class FxPushButton

    FxElement <|-- FxPushButton : Animatable

See also Architecture.