On this page
API Reference

Toggle#

Github

Toggle is a button that switches between two states, usually 'on' and 'off', each time it is clicked. Toggle buttons are commonly used to enable or disable a feature, or to choose between two mutually exclusive options.

import { Toggle } from "wis/toggle"

API Reference#

NameTypeDefaultDescription
textstringnoneThe text information displayed on the toggle.
variantbasic ghostbasicThe visual variant to apply to toggle.
disabledbooleanfalseDisables any interaction with the toggle.
iconReactNodenoneThe icon element will be displayed next to the toggle text.
iconControlprefix suffixprefixControls the display position of the icon relative to the text.
sizemd sm xsmdThe size of the toggle toggle.
pressedbooleannoneThe press state of the toggle. Must be used in conjunction with onPressed.
defaultPressedbooleannoneThe default press state of the toggle.
shortcutKeystringnoneSets a global shortcut key, such as Control+I. When the user presses the combination key, the toggle button's click event will be triggered. View Keyboard
onPressed(pressed: boolean) => voidnoneEvent handler called when the toggle button is clicked.