Menu
View as Markdown

Components

Toggle

Live compiled demo for the Toggle component contract.

off
data-statepressed, off, disabled
keyboardSpace or Enter activates the native button
change reasonstrigger-click, programmatic

Usage

A two-state button that stays pressed or unpressed.

  • Import the versioned component from @kovojs/ui/toggle.
  • Copy the source into your app with kovo add toggle when product code should own the implementation.

Source

  • Package source: packages/ui/src/toggle.tsx
  • Gallery fixture: examples/gallery/src/demo-fixtures.tsx
  • Interactive demo: examples/gallery/src/interactive/toggle-demo.tsx

Behavior contract

The rendered fixture above includes the component contract table. Interactive pages compile the authored TSX demo and then lift the same contract table from the static fixture, so the visible behavior and documented ARIA/data-state surface stay together.