Toggle
A button that stays pressed until it is pressed again. Pressed, it fills, and it never changes size.
npx shadcn add https://kinoui.com/r/toggle.jsonCopy install command
Examples
Default
A button that stays pressed until it is pressed again. Off it is quiet; pressed it fills, at the same size, and a ToggleIcon rolls to its pressed icon. An icon-only toggle needs an aria-label that names what it does, which stays the same pressed or not.
Sizes
The Button's sizes: sm, default and lg for a label, and icon-sm, icon and icon-lg for an icon alone, which are square.
Installation
Copy code
npx shadcn@latest add https://kinoui.com/r/toggle.json- Files
lib/refs.tslib/reduce-motion.tslib/resize.tslib/swap.tsxcomponents/kino/spinner.tsxcomponents/kino/button.tsxcomponents/kino/toggle.tsx- Packages
@base-ui/reactclass-variance-authority- Global CSS
- the feels, the density tokens, the shape tokens and the success and warning colours
New to Kino? Installation covers what your project needs first and the @kino namespace.
API reference
Toggle
ToggleIcon
Data attributes
CSS variables
Accessibility
- It is a
<button>witharia-pressed, so a screen reader says “toggle button, pressed”. Space and Enter press it. - Name an icon-only toggle with
aria-label, and keep the name the same pressed or not: the pressed state is announced on its own. - Pressed is shown by a fill and by the label’s colour; in forced colours the fill takes the system’s highlight. A
ToggleIconadds a second sign, its pressed icon.