Skip to main content

PressButton

Allows users to toggle between active/inactive states. Use to represent a persistent on/off or selected/unselected status.

string

A label that describes the purpose or contents of the Button. It will be read to users using assistive technologies such as screen readers.

Use this when using only an icon or the Button text is not enough context for users using assistive technologies.

boolean
Default: false

Whether the button is pressed by default.

boolean
Default: false

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

string

A unique identifier for the element.

'auto' | 'fill' | 'fit-content'
Default: 'auto'

The displayed inline width of the Button.

  • auto: the size of the button depends on the surface and context.
  • fill: the button will takes up 100% of the available inline size.
  • fit-content: the button will take up the minimum inline-size required to fit its content.
string

Indicate the text language. Useful when the text is in a different language than the rest of the page. It will allow assistive technologies such as screen readers to invoke the correct pronunciation. Reference of values ("subtag" label)

boolean
Default: false

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

This also disables the Button.

boolean
Default: false

Whether the button is pressed.

Was this section helpful?

((event: <typeof tagName>) => void) | null

Callback when the button has lost focus.

((event: <typeof tagName>) => void) | null

Callback when the button is activated.

((event: <typeof tagName>) => void) | null

Callback when the button has received focus.

Was this section helpful?

Code

<s-press-button>Add gift wrapping</s-press-button>

Preview