Theme Playground

Base UI

Toggle

Pressable on and off control for independent state changes.

Best for

view switchesfilter chipstoolbar actions

Import

import { Toggle } from "@enadhq/enad-react-sdk/client/ui-resolver"

When to use it

Use Toggle for a single independent state that can be pressed on or off. It works well for filter chips, toolbar controls, view-affecting options, and compact actions like save or favorite.

If the visitor is choosing between coordinated options, use ToggleGroup instead so the selection model stays explicit.

Composition notes

Toggle is a single control, but icon-only usage still needs a clear aria-label. When the root element needs to be something other than a button, asChild lets you keep the recipe while swapping the semantic wrapper.

Prefer putting icons or short text inside the toggle. If the content gets long, another control style is usually easier to scan.

Behavior and theming guidance

Use variant="plain" for low-emphasis toolbars and variant="outlined" when the control needs more visible structure. Match size to the surrounding density instead of mixing many toggle sizes in the same group.

The pressed styling already comes from the shared recipe, so use tokens and variants before rewriting colors or spacing by hand.

Examples

Live examples you can edit directly in the sandbox.

2 examples

Icon toggle

A compact icon-only toggle works well for wishlist, favorite, or formatting actions when the pressed state is obvious.

Sizes and variants

Use size and variant to match the surrounding density before reaching for one-off styling overrides.

Component Sets

Preview the first example across the available component-set presets to compare tone, spacing, and structural defaults.

Props

PropTypeDefaultDescription
asChildboolean
No description yet.
variantstring
No description yet.
sizestring
No description yet.