Toggle

Two-state button that can be either on or off.

Installation
# Install @opencosmos/ui to use Toggle
pnpm add @opencosmos/ui
Preview
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

PropTypeDefaultDescription
variantdefault | outline"default"Visual style variant
sizedefault | 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>