Press Button
Allows users to toggle between active/inactive states. Use to represent a persistent on/off or selected/unselected status.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstring
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.
- Anchor to defaultPresseddefaultPressedbooleanDefault: false
Whether the button is pressed by default.
- Anchor to disableddisabledbooleanDefault: false
Disables the Button meaning it cannot be clicked or receive focus.
- string
A unique identifier for the element.
- Anchor to inlineSizeinlineSize'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.
- Anchor to langlangstring
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)
- Anchor to loadingloadingbooleanDefault: false
Replaces content with a loading indicator while a background action is being performed.
This also disables the Button.
- Anchor to pressedpressedbooleanDefault: false
Whether the button is pressed.
Anchor to eventsEvents
- Anchor to blurblur((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the button has lost focus.
- Anchor to clickclick((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the button is activated.
- Anchor to focusfocus((event: CallbackEventListener<typeof tagName>) => void) | null
Callback when the button has received focus.
CallbackEventListener
(EventListener & {
(event: CallbackEvent<TTagName, TEvent>): void;
}) | null
CallbackEvent
TEvent & {
currentTarget: HTMLElementTagNameMap[TTagName];
}
Code
Examples
Code
Default
<s-press-button>Add gift wrapping</s-press-button>
Preview
