Toggle

Two-state pressable button. Built on the Radix UI Toggle primitive.

<Toggle aria-label="Toggle bold">  <TextB /></Toggle>

Usage

import { Toggle } from "@reva/ui";

Reva exposes three variants — solid, subtle (default), and outline — matching the Park UI recipe shape, and a size ramp aligned with Button: xs, sm, default, lg. There is no icon-* size; toggles are square by default and grow to fit text or icon + label.

Examples

With label

<Toggle aria-label="Toggle italic">  <TextItalic data-icon="inline-start" />  Italic</Toggle>

Variants

<HStack gap={2}>  <Toggle variant="solid" aria-label="Solid toggle">    <TextB />  </Toggle>  <Toggle variant="subtle" aria-label="Subtle toggle">    <TextItalic />  </Toggle>  <Toggle variant="outline" aria-label="Outline toggle">    <TextUnderline />  </Toggle></HStack>

Sizes

<HStack align="center" gap={2}>  <Toggle size="xs" aria-label="xs">    <TextB />  </Toggle>  <Toggle size="sm" aria-label="sm">    <TextB />  </Toggle>  <Toggle size="default" aria-label="default">    <TextB />  </Toggle>  <Toggle size="lg" aria-label="lg">    <TextB />  </Toggle></HStack>

Toolbar group

<HStack gap={1}>  <Toggle variant="outline" aria-label="Align left" defaultPressed>    <TextAlignLeft />  </Toggle>  <Toggle variant="outline" aria-label="Align center">    <TextAlignCenter />  </Toggle>  <Toggle variant="outline" aria-label="Align right">    <TextAlignRight />  </Toggle></HStack>

Disabled

<Toggle disabled aria-label="Disabled toggle">  <TextB /></Toggle>

Props

Toggle forwards props to Radix Toggle (TogglePrimitive.Root). See the Radix UI Toggle documentation for pressed, defaultPressed, onPressedChange, and disabled.

PropTypeDefaultDescription
variant"solid" | "subtle" | "outline""subtle"Visual style.
size"xs" | "sm" | "default" | "lg""default"Control size — aligned with Button.
pressed / defaultPressedbooleanControlled vs uncontrolled pressed state.
onPressedChange(pressed: boolean) => voidFires when the pressed state changes.
disabledbooleanfalseDisables the control.

On this page