Skip to main content

Toggle Group

Rocket 2.0

The Toggle Group component is a row of buttons where the user picks one option, or several, such as a filter for All, Open and Closed or a switch between views.

Properties​

Property
Description
Expected Value
OptionsOptions to show as buttons, as plain values or as items with a label and a value that can add disabled.Array. Default: ["All", "Open", "Closed"]
Default valueValue of the option selected when the app loads.Text. Default: All
Full widthStretches the buttons to fill the component's width.On or off. Default: Off
AlignmentWhere the buttons sit when the component is wider than they are.Left, Center, Right. Default: Left
LookLook of the buttons. Segmented puts them in a shaded bar, Outline gives each a border, and Plain shows them without either.Segmented, Outline, Plain. Default: Segmented
Allow multipleLets the user select several options at once.On or off. Default: Off
Default valuesValues of the options selected when the app loads, with Allow multiple on. It also updates as the selection changes.Array

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On changeTriggers when the selection changes.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set selectedSelects the option with the given value. With Allow multiple on, a list replaces the whole selection.components.togglegroup1.setSelected("")
ClearClears the selection.components.togglegroup1.clear()
Select option (value)Selects the option with the given value. With Allow multiple on, a list replaces the whole selection.components.togglegroup1.setValue("")
Set visibilityShows the component when true, hides it when false.components.togglegroup1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.togglegroup1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.togglegroup1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
optionsOptions to show as buttons, as plain values or as items with a label and a value that can add disabled.{{components.togglegroup1.options}}
defaultValueValue of the option selected when the app loads.{{components.togglegroup1.defaultValue}}
fullWidthStretches the buttons to fill the component's width.{{components.togglegroup1.fullWidth}}
alignmentWhere the buttons sit when the component is wider than they are.{{components.togglegroup1.alignment}}
variantLook of the buttons. Segmented puts them in a shaded bar, Outline gives each a border, and Plain shows them without either.{{components.togglegroup1.variant}}
multipleLets the user select several options at once.{{components.togglegroup1.multiple}}
valuesValues of the options selected when the app loads, with Allow multiple on. It also updates as the selection changes.{{components.togglegroup1.values}}
valueThe value of the selected option. With Allow multiple on, the first selected value.{{components.togglegroup1.value}}
isVisibleWhether the component is visible.{{components.togglegroup1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.togglegroup1.isLoading}}
isDisabledWhether the component is disabled.{{components.togglegroup1.isDisabled}}

Styles​

Style
Default
Group backgroundTheme: Surface 3
Option text colorTheme: Placeholder text
Selected option backgroundTheme: Surface 1
Selected option text colorTheme: Primary text
Group radius—
Border color (outline look)Theme: Default border
Selected (earlier name)—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.