Toggle

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

API Reference

Installation

npx love-ui@latest add toggle

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 loveui quickly.

Quick Checklist

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

Additional Notes

Size Comparison

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

SizeHeight (shadcn/ui)Height (loveui)
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 loveui.