Skip to content
Cynco UI

Make it yours

Accent A
Theme T
Radius R
Density D
Documents L

Every demo on the site follows these, and Copy prompt carries them to your agent. Light and dark stay on the toggle beside this.

ToggleButton

A button that stays pressed, with a check mark in its corner while it is on.

import { ToggleButton } from "@cynco-labs/ui";

Example

Use

Toggling views and options in toolbars: show a chart, group rows, reveal filters.

Props

IconButton props plus pressed / defaultPressed, onPressedChange, icon and iconOrientation (left with a label, center icon-only, which needs tooltip or aria-label).

Prop Type Default
pressed boolean

Controlled pressed state.

–
defaultPressed boolean

Initial pressed state for uncontrolled use.

false
onPressedChange (pressed: boolean) => void –
variant "primary" | "secondary" | "skeleton" | "muted" | "destructive" | "dotted" "secondary"
size "sm" | "md" | "icon" "sm"
icon ReactNode –
iconOrientation "center" | "left" | "right" "center"
isLoading boolean

Swaps the label for a spinner and disables the button, while the label stays its accessible name.

–
asChild boolean

Radix compatibility: render the single child element instead of a `<button>`.

–
render ReactElement

The element to render instead of a `<button>` (Base UI).

–
focusableWhenDisabled boolean

Keep the button in the tab order while disabled (Base UI). Set automatically while `isLoading`.

–
tooltip ReactNode

A hint on hover and focus. On an icon-only button it also names the button when no `aria-label` is given.

–
rightIcon ReactNode –
tooltipSide "top" | "bottom" | "left" | "right"

Which side the tooltip opens on.

–

Also accepts ComponentProps<"button">, and className.

Notes

It reports aria-pressed rather than posing as a checkbox; for a real checkbox use Checkbox. The corner mark means the state never rests on colour, and it sits slightly outside the button, so a clipping parent hides part of it.

Source on GitHub Demo source Markdown