Toggle
Two-state button that can be either on or off.
Installation
# Install @opencosmos/ui to use Toggle
pnpm add @opencosmos/uiPreview
Loading preview...
Customize
— Visual style variant
— Size of the toggle
Usage
Import
import { Toggle } from '@opencosmos/ui';Example
<Toggle>
Content
</Toggle>Eject
Copy this component into your project for full customization
API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | default | outline | "default" | Visual style variant |
| size | default | sm | lg | "default" | Size of the toggle |
Examples
Default
Outline
Code Examples
Basic Usage
Simple toggle button
import { Toggle } from "@opencosmos/ui"
<Toggle aria-label="Toggle italic">
Toggle
</Toggle>