Skip to main content

Button Group

Rocket 2.0

The Button Group component shows a row of joined buttons. Use it as a switch between options, such as Day, Week and Month, or as a set of related action buttons.

Properties​

Property
Description
Expected Value
LabelText shown above the buttons.Text
Help textHelp text shown under the buttons.Text
ButtonsThe buttons, as text or objects with a label and value. Each can also have an icon, tooltip, variant, disabled, and default to start selected.Array
ModeHow clicks behave. Single selects one button, Multiple toggles each button on or off, and Actions keeps no selection so the buttons only fire events.Actions, Single, Multiple. Default: Single
Allow deselecting (single)In Single mode, lets the user click the selected button again to clear the selection.On or off. Default: Off
VariantLook of the buttons. A button's own variant in Buttons overrides it.Outline, Secondary, Default, Ghost. Default: Outline
SizeHeight and text size of the buttons.Sm, Default, Lg. Default: Default
OrientationLays the buttons out in a row or in a column.Horizontal, Vertical. Default: Horizontal
Full widthStretches the group to fill the component's width.On or off. Default: Off

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 clickTriggers when the user clicks any button.
On changeTriggers when the selection changes, by a click or by the Set selected or Clear action.

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 button whose value matches Value (or a list). In Multiple mode, pass a list to select several. A value no button has is ignored.components.buttongroup1.setSelected("")
ClearClears the selection.components.buttongroup1.clear()
Set visibilityShows the component when true, hides it when false.components.buttongroup1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.buttongroup1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.buttongroup1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelText shown above the buttons.{{components.buttongroup1.label}}
descriptionHelp text shown under the buttons.{{components.buttongroup1.description}}
buttonsThe buttons, as text or objects with a label and value. Each can also have an icon, tooltip, variant, disabled, and default to start selected.{{components.buttongroup1.buttons}}
modeHow clicks behave. Single selects one button, Multiple toggles each button on or off, and Actions keeps no selection so the buttons only fire events.{{components.buttongroup1.mode}}
allowDeselectIn Single mode, lets the user click the selected button again to clear the selection.{{components.buttongroup1.allowDeselect}}
variantLook of the buttons. A button's own variant in Buttons overrides it.{{components.buttongroup1.variant}}
sizeHeight and text size of the buttons.{{components.buttongroup1.size}}
orientationLays the buttons out in a row or in a column.{{components.buttongroup1.orientation}}
fullWidthStretches the group to fill the component's width.{{components.buttongroup1.fullWidth}}
lastClickedThe label and value of the button the user last clicked.{{components.buttongroup1.lastClicked}}
isVisibleWhether the component is visible.{{components.buttongroup1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.buttongroup1.isLoading}}
isDisabledWhether the component is disabled.{{components.buttongroup1.isDisabled}}

Styles​

Style
Default
Button backgroundTheme: Surface 1
Button hover backgroundTheme: Surface 3
Button text colorTheme: Primary text
Border and divider colorTheme: Default border
Selected backgroundTheme: Brand primary
Selected text colorTheme: Surface 1
Icon colorTheme: Primary text
Label colorTheme: Primary text
Group radius—
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.