The library is still in early development. Breaking changes and bugs may occur without prior notice. Thanks for your interest in using the library!

v0.2.49Beta

Search

Toggle

Source

A single button used to switch between two states, such as on/off or bold/not bold formatting.

Usage

Import the Toggle component from @bun-ui/react and use it in your project:

import { Toggle } from "@bun-ui/react"
<Toggle aria-label="Toggle bold">
  <Bold />
</Toggle>
 

Examples

Controlled

Use pressed and onPressedChange to manage the toggle state manually:

Size

The size prop can be used to set the size of the toggle button. The available sizes are sm, md, and lg. The default size is md.

Props

Toggle

PropTypeDefaultDescription
size
"sm" | "md" | "lg""md"

Size of the toggle.