Skip to main content
  1. Docs
  2. Components
  3. Actions

Toggle

A tool that's pressed or not. With only an icon, its name shows as its tooltip.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<button aria-pressed>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

Playground

Every prop, live, and the code it takes.

Icon
Size
favourite.tsx
import { StarIcon } from "@qeetrix/icons";
import { Toggle } from "@qeetrix/react";

<Toggle icon={StarIcon} filledWhenPressed defaultPressed>Favourite</Toggle>

02

Off, on and disabled

Pressed shows as a fill. An icon alone needs a name, which shows as its tooltip.

03

With a label

The icon leads its label. filledWhenPressed swaps to the icon's filled drawing.

04

Sizes

A control's height in the region's density; inside a group, the group's size wins.

05

Tooltips

An icon-only toggle shows its name; tooltip adds a shortcut, tooltipSide moves it.

06

Controlled

pressed and onPressedChange: the page follows the toggle.

Acme Pvt Ltd stays at the top of the list.
Next — ToggleUsage