Skip to main content

Button Group

Ant Design

The Button Group component shows a row of joined buttons. Use it for a set of related actions, or as a toggle to pick one or more options, such as Day, Week and Month.

Properties​

Property
Description
Expected Value
LabelText shown above the buttons.Text
ButtonsThe buttons, as a list of {value, label}. Add icon with an icon name, disabled: true or danger: true to change one button.Array
ModeHow the buttons behave. actions makes each a plain button; single lets the user select one; multiple lets them select several; none shows the buttons disabled, for display only.actions, single, multiple, none. Default: actions
ValueThe selected button's value in single mode, or a list of values in multiple mode. Selected buttons are filled with the theme color.Text
Allow deselectIn single mode, lets the user click the selected button again to clear the selection.On or off. Default: Off
TypeStyle of the buttons that aren't selected. primary is filled, default has a border, dashed has a dashed border and text has none.default, primary, dashed, text. Default: default
SizeHeight and text size of the buttons.small, middle, large. Default: middle
DirectionWhether the buttons sit side by side or stacked.horizontal, vertical. Default: horizontal
BlockMakes the group fill the width of its box, with the buttons sharing the space.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 in single or multiple mode.

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 buttons with the given Value, or a list of values in multiple mode. It works only in single and multiple mode and ignores values no button has.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}}
buttonsThe buttons, as a list of {value, label}. Add icon with an icon name, disabled: true or danger: true to change one button.{{components.buttongroup1.buttons}}
modeHow the buttons behave. actions makes each a plain button; single lets the user select one; multiple lets them select several; none shows the buttons disabled, for display only.{{components.buttongroup1.mode}}
valueThe selected button's value in single mode, or a list of values in multiple mode. Selected buttons are filled with the theme color.{{components.buttongroup1.value}}
allowDeselectIn single mode, lets the user click the selected button again to clear the selection.{{components.buttongroup1.allowDeselect}}
typeStyle of the buttons that aren't selected. primary is filled, default has a border, dashed has a dashed border and text has none.{{components.buttongroup1.type}}
sizeHeight and text size of the buttons.{{components.buttongroup1.size}}
directionWhether the buttons sit side by side or stacked.{{components.buttongroup1.direction}}
blockMakes the group fill the width of its box, with the buttons sharing the space.{{components.buttongroup1.block}}
lastClickedValue of the button the user clicked last.{{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
Primary colorTheme: Brand primary
Text colorTheme: Primary text
Container backgroundTheme: Surface 1
Border colorTheme: Default border
Border 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.