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.

Element
igc-toggle-button
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 = false

Defined in src/components/button-group/toggle-button.ts:72

Whether the button is selected.

selected: boolean = false

Defined in src/components/button-group/toggle-button.ts:63

The value of the control.

value: string

Defined in src/components/button-group/toggle-button.ts:54

Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.

Note on Content Security Policy:

Element styles are implemented with <style> tags when the browser doesn't support adopted StyleSheets. To use such <style> tags with the style-src CSP directive, the style-src value must either include 'unsafe-inline' or nonce-<base64-value> with <base64-value> replaced be a server-generated nonce.

To provide a nonce to use on generated <style> elements, set window.litNonce to a server-generated nonce in your page's HTML, before loading application code:

``

styles: CSSResult[]

Defined in src/components/button-group/toggle-button.ts:33

Removes focus from the button.

blur(): void

Defined in src/components/button-group/toggle-button.ts:130

Returns void

Simulates a mouse click on the element.

click(): void

Defined in src/components/button-group/toggle-button.ts:135

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

Defined in src/components/button-group/toggle-button.ts:79

Returns void

Sets focus on the button.

focus(options: FocusOptions): void

Defined in src/components/button-group/toggle-button.ts:124

Parameters

  • options: FocusOptions

Returns void