Skip to main content

Buttons

Back at the Catalog, you saw the full lineup. Let's start with the biggest family of all — six controls that all boil down to "clickable," just with different state and presentation.

info

Every control on this page delegates its rendering to a Behavior<Button>. api.NativeTheme/> and BasicTheme both provide one — see Theming if you haven't met that yet.

Which one do you actually want?

If you need to...Reach for
Fire an action, with nothing to remember afterwardPushButton
Track a plain on/off stateToggleButton, CheckBox, or Switch — pick by presentation, they're interchangeable underneath
Force "exactly one of these" across a groupRadioButton + ButtonGroup
Open a URLHyperLink

The rest of this page fills in the details behind each row.

PushButton​

The plain one: triggers an action when pressed, with the pointer or the keyboard. No state to track beyond the press itself — under the hood, it's just listening for the same clicked event you wired up by hand back on User Input.

ToggleButton​

Flips between two states each time it's pressed. Think of it as PushButton with memory.

tip

ToggleButton, CheckBox, and Switch (below) are the same control underneath, just with different Behaviors. If none of the built-in looks fit, a custom Behavior is more likely what you want than a fourth control.

CheckBox​

An on/off toggle with the presentation everyone already recognizes — a box that fills in when checked.

RadioButton​

Also, an on/off toggle, but meant for a different job: picking exactly one option from a set. Group several together with ButtonGroup, and selecting one clears the rest.

Switch​

Same on/off idea as CheckBox, dressed as a sliding toggle instead. Under the hood, it's just a ToggleButton — BasicTheme styles it via basicSwitchBehavior.

tip

That sliding motion is exactly the kind of thing by animate(...) from Animation is built for, if you're writing a custom Behavior for one of these and want the state change to glide rather than snap.

The odd one out in a good way — this one opens a URL rather than tracking state.

It's fully customizable too: NativeHyperLinkStyler lets you supply your own Behavior while keeping the built-in link opening functionality intact.

info

NativeHyperLinkStyler is available whenever the nativeHyperLinkBehavior (Web, Desktop) module is included.

Recap​

  • PushButton and HyperLink don't track state — they just fire on press.
  • ToggleButton, CheckBox, and Switch all track a two-state on/off value — pick whichever presentation fits your design, since they're functionally interchangeable.
  • RadioButton is the one built for mutual exclusion — pair it with ButtonGroup when you need "pick exactly one."
  • All six render through Behavior<Button>, so a Theme styles all of them consistently at once.

Next: on to Sliders & Value Pickers for continuous and ranged input.