Toggle

Toggle allows users to toggle between states via an action.

The Toggle component is a two-state button that allows users to toggle between states via an action.

import { ToggleParts } from '@cerberus/react'

Usage

The Toggle component is unstyled to fit any scenario you may need.

Primitives

You can utilize the primitive components to customize the toggle.

ComponentDescription
ToggleRootThe context provider for the Toggle parts
ToggleIndicatorThe indicator shown based on the toggle state

API

Parts

The ToggleParts API is an Object containing the full family of components.

NameDescription
RootThe ToggleRoot component which is the Provider for the family.
IndicatorThe ToggleIndicator component which displays based on the pressed state.

On this page