The library is still in early development. Breaking changes and bugs may occur without prior notice. Thanks for your interest in using the library!
A single button used to switch between two states, such as on/off or bold/not bold formatting.
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>
Use pressed
and onPressedChange
to manage the toggle state manually:
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
.
Prop | Type | Default | Description |
---|---|---|---|
size | "sm" | "md" | "lg" | "md" | Size of the toggle. |