8.4k

Toggle

A two-state button that can be on or off.

API Reference

Installation

pnpm dlx shadcn@latest add https://coss.com/ui/r/toggle.json

Usage

import { Toggle } from "@/components/ui/toggle"
<Toggle>Toggle</Toggle>

Examples

Outline

With Icon

Small Size

Large Size

Disabled

Icon Group

Comparing with Radix / shadcn

If you’re already familiar with Radix UI and shadcn/ui, this guide highlights the small differences and similarities so you can get started with coss.com ui quickly.

Quick Checklist

  • If you used asChild on parts, switch to the render prop

Additional Notes

Size Comparison

coss.com ui toggle sizes are more compact compared to shadcn/ui, making them better suited for dense applications:

SizeHeight (shadcn/ui)Height (coss.com ui)
sm32px28px
default36px32px
lg-36px

So, for example, if you were using the default size in shadcn/ui and you want to preserve the original height, you should use the lg size in coss.com ui.

coss.com ui

Built by and for the team of Cal.com, Inc. — the leading commercial open source company (“coss”).