Skip to content

Radial Switch

Class: FxRadialSwitch · Tag: <fx-radial-switch> · Mixins: Animatable

The <fx-radial-switch> component is a circular multi-state selector featuring a center knob and pointer. States are beautifully arranged as colored ring segments around the dial, providing an intuitive, tactile selection interface.


Register the components by importing them in your entrypoint:

import '@salsafx/ui';

Interactive preview of a few variants:


Pass nested <fx-switch-state> elements to configure segments. Click a wedge or its label to rotate the pointer to that state.

Active: sport
<fx-radial-switch
active-id="sport"
size="280"
is-animated
>
<fx-switch-state
value="day"
label="DAY"
icon="fa-solid fa-sun"
background-color="#eab308"
></fx-switch-state>
<fx-switch-state
value="sport"
label="SPORT"
icon="fa-solid fa-bolt"
background-color="#f97316"
></fx-switch-state>
<fx-switch-state
value="performance"
label="PERFORMANCE"
icon="fa-solid fa-bolt-lightning"
background-color="#ef4444"
></fx-switch-state>
<fx-switch-state
value="night"
label="NIGHT"
icon="fa-solid fa-moon"
background-color="#a855f7"
></fx-switch-state>
<fx-switch-state
value="winter"
label="WINTER"
icon="fa-solid fa-snowflake"
background-color="#3b82f6"
></fx-switch-state>
<fx-switch-state
value="eco"
label="ECO"
icon="fa-solid fa-leaf"
background-color="#22c55e"
></fx-switch-state>
</fx-radial-switch>

Omit the label attribute to show icons alone on each segment. Optionally bump --fx-radial-switch-icon-size for a clearer icon-only dial.

<fx-radial-switch
active-id="eco"
size="260"
is-animated
style="--fx-radial-switch-icon-size: 1.25rem;"
>
<fx-switch-state
value="day"
icon="fa-solid fa-sun"
background-color="#eab308"
></fx-switch-state>
<fx-switch-state
value="sport"
icon="fa-solid fa-bolt"
background-color="#f97316"
></fx-switch-state>
<fx-switch-state
value="performance"
icon="fa-solid fa-bolt-lightning"
background-color="#ef4444"
></fx-switch-state>
<fx-switch-state
value="night"
icon="fa-solid fa-moon"
background-color="#a855f7"
></fx-switch-state>
<fx-switch-state
value="winter"
icon="fa-solid fa-snowflake"
background-color="#3b82f6"
></fx-switch-state>
<fx-switch-state
value="eco"
icon="fa-solid fa-leaf"
background-color="#22c55e"
></fx-switch-state>
</fx-radial-switch>

<fx-radial-switch> Properties & Attributes

Section titled “<fx-radial-switch> Properties & Attributes”
PropertyAttributeTypeDefaultDescription
activeIdactive-idString""ID of the currently selected state.
sizesizeNumber | String280Size of the switch diameter.
trackWidthtrack-widthNumber52Thickness of the colored ring track.
foregroundColorforeground-colorString"#ffffff"Default active text and icon color.
backgroundColorbackground-colorString"#3b82f6"Default active wedge background color.
isAnimatedis-animatedBooleantrueEnables fluid, hardware-accelerated pointer rotation transitions.
disableddisabledBooleanfalseDisables the control and prevents user interaction.
statesArray[]Array of state configurations.
PropertyAttributeTypeDefaultDescription
valuevalueString""Unique state identifier value.
labellabelString""State text label.
iconiconString""Optional Font Awesome icon class name.
foregroundColorforeground-colorString""Active state text and icon color override.
backgroundColorbackground-colorString""Active state wedge background color override.
NameDescription
(default)Nested <fx-switch-state> elements defining segments.
knobCenter dial knob. Defaults to <fx-knob>. Pass a custom element with slot="knob" to replace it; sync angle / isAnimated if your knob supports them.
icon-{id}Per-state icon content (also filled automatically from icon on <fx-switch-state>).
NameDetailDescription
change{ id: String, state: Object }Emitted when the active segment changes.
PropertyDefaultDescription
--fx-radial-switch-size280pxHost diameter (also set via the size attribute).
--fx-knob#1e293bCenter knob fill (forwarded to <fx-knob>).
--fx-knob-ring#334155Knob stroke.
--fx-knob-pointer#f8fafcPointer tick color.
--fx-radial-switch-gap#0f172aGap / separator color between wedges.
--fx-radial-switch-shadow-opacity0.35Opacity of the active segment inset shadow (01).
--fx-radial-switch-font-size0.62remSegment label size.
--fx-radial-switch-icon-size0.95remSegment icon size.

Reusable center knob (default for slot="knob"). Can also be slotted explicitly or used by other components:

<fx-radial-switch active-id="eco" is-animated>
<fx-knob slot="knob"></fx-knob>
<fx-switch-state
value="eco"
label="ECO"
background-color="#22c55e"
></fx-switch-state>
</fx-radial-switch>
PropertyAttributeTypeDefaultDescription
angleNumber0Pointer rotation in degrees (synced by the host).
isAnimatedis-animatedBooleantrueEnables smooth, hardware-accelerated pointer rotation animations.

classDiagram
    direction TB
    class FxElement
    class FxRadialSwitch

    FxElement <|-- FxRadialSwitch : Animatable

See also Architecture.