Toggle

Toggle switch gives control over a feature or option that can be turned on or off. If a physical switch would work for the action, a toggle is probably the best component to use.

<script lang="ts">let checked;
</script>

<Toggle bind:checked />

Properties

Property Description Type Default
checked Bind the checked attribute of the HTML input of type checkbox that is rendered by the component boolean
disabled Disallow changes on the checkbox boolean false
ariaLabel An accessible label for the toggler string

Events

Event Description Detail
nnsToggle Triggered each time the state of the toggle is changing. CustomEvent<boolean>

Showcase