The toggle button wraps a native button element and exposes additional value and selected properties. It is used in the context of a button group to facilitate the creation of group/toolbar like UX behaviors.

Slots
default — Renders the label/content of the button.
CSS Parts
toggle — The native button element.
focused — The native button element when focused through a keyboard interaction.

Whether the button is disabled.

disabled: boolean

Whether the button is selected.

selected: boolean

The value of the control.

value: string

Removes focus from the button.

blur(): void

Returns void

Simulates a mouse click on the element.

click(): void

Returns void

Invoked when the component is removed from the document's DOM.

This callback is the main signal to the element that it may no longer be used. disconnectedCallback() should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.

``

An element may be re-connected after being disconnected.

disconnectedCallback(): void

Returns void

Sets focus on the button.

focus(options: FocusOptions): void

Parameters

  • options: FocusOptions

Returns void