Skip to main content

Button

The Button component triggers actions or events, such as opening dialogs or navigating to other pages. Use Button to let merchants perform specific tasks or to initiate interactions throughout the POS interface.

Buttons support various visual styles, tones, and interaction patterns to communicate intent and hierarchy within the interface.

Support
Targets (27)

Use cases

  • Primary actions: Create actions like "Save changes," "Add customer," or "Process payment" that complete workflows.
  • Secondary actions: Provide supporting actions such as "Cancel," "Edit," or "View details."
  • Navigation: Enable screen transitions or launch modal experiences for complex operations.
  • Loading states: Display loading indicators during asynchronous operations while preventing duplicate submissions.

Trigger actions using a Button component with customizable visual styles and tones. This example shows a basic button with text content.

Trigger actions with a button

Trigger actions with a button

<s-button variant="primary">Add customer</s-button>
<s-button variant="secondary">Select more items</s-button>

Configure the following properties on the Button component.

Anchor to command
command
"--auto" | "--show" | "--hide" | "--toggle"
Default: '--auto'

Sets the action the commandFor should take when this clickable is activated.

See the documentation of particular components for the actions they support.

  • --auto: a default action for the target component.
  • --show: shows the target component.
  • --hide: hides the target component.
  • --toggle: toggles the target component.
Anchor to commandFor
commandFor
string

ID of a component that should respond to activations (e.g. clicks) on this component.

See command for how to control the behavior of the target.

Anchor to disabled
disabled
boolean
Default: false

Disables the Button meaning it cannot be clicked or receive focus.

string

A unique identifier for the element.

Anchor to loading
loading
boolean
Default: false

Replaces content with a loading indicator while a background action is being performed.

This also disables the Button.

"auto" | "neutral" | "caution" | "warning" | "critical"
Default: 'auto'

Sets the tone of the Button, based on the intention of the information being conveyed.

Anchor to variant
variant
"primary" | "secondary"
Default: 'auto' - the variant is automatically determined by the Button's context

Changes the visual appearance of the Button.

The Button component provides event callbacks for handling user interactions. Learn more about handling events.

Anchor to click
click
(event: <"s-button">) => void

Called when the button is activated.

  • Write action-oriented text: Use specific, actionable language like "Save customer" or "Process payment" rather than generic terms like "OK" or "Submit."
  • Choose appropriate variants and tones: Use primary for the main action and secondary for supporting actions. Use critical for destructive actions, caution or warning for actions requiring attention.
  • Show loading states: Set loading to true during async operations to prevent duplicate submissions.
  • Use command system for component control: Use commandFor and command to control modals and overlays declaratively.
  • Structure hierarchies clearly: Group related actions together. Separate destructive actions to prevent accidental activation.
Was this page helpful?