Files
Pasquale Vitiello 73355ab6c1 feat: add ui home page (#666)
* wip

* improve structure

* mc

* wip

* wip

* wip

* separate card

* wip

* wip

* mc

* mc

* improve styling

* mc

* mc

* mc

* mc

* Enhance CategoryCard styling with improved link positioning and pointer events

* add transitions

* mc

* mc
2026-02-04 09:49:24 +00:00

95 lines
1.7 KiB
Plaintext

---
title: Toggle
description: A two-state button that can be toggled on or off.
links:
doc: https://base-ui.com/react/components/toggle#api-reference
---
<ComponentPreview name="p-toggle-1" />
## Installation
<CodeTabs>
<TabsList>
<TabsTab value="cli">CLI</TabsTab>
<TabsTab value="manual">Manual</TabsTab>
</TabsList>
<TabsPanel value="cli">
```bash
npx shadcn@latest add @coss/toggle
```
</TabsPanel>
<TabsPanel value="manual">
<Steps>
<Step>Install the following dependencies:</Step>
```bash
npm install @base-ui/react
```
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource name="toggle" title="components/ui/toggle.tsx" />
<Step>Update the import paths to match your project setup.</Step>
</Steps>
</TabsPanel>
</CodeTabs>
## Usage
```tsx
import { Toggle } from "@/components/ui/toggle"
```
```tsx
<Toggle>Toggle</Toggle>
```
## API Reference
### Toggle
Styled wrapper for `Toggle.Root` from Base UI with variant and size options.
| Prop | Type | Default | Description |
| --------- | ----------------------------- | ----------- | ------------------------------------------------ |
| `variant` | `"default" \| "outline"` | `"default"` | Controls the toggle styling |
| `size` | `"default" \| "sm" \| "lg"` | `"default"` | Controls the toggle size |
## Examples
### Outline
<ComponentPreview name="p-toggle-2" />
### With Icon
<ComponentPreview name="p-toggle-3" />
### Small Size
<ComponentPreview name="p-toggle-4" />
### Large Size
<ComponentPreview name="p-toggle-5" />
### Disabled
<ComponentPreview name="p-toggle-6" />
### Icon Group
<ComponentPreview name="p-toggle-7" />