๐ŸŽฏ Nexus teaches Next.js from foundations to professional systemsโ€ขโšก App Router, React 19, and Tailwind v4 in one learning pathโ€ข๐Ÿงฉ Inspect real components, layouts, and reusable patternsโ€ข๐Ÿ› ๏ธ Build production discipline, not just polished demosโ€ข๐Ÿ“š Tracks, references, and design studies in one placeโ€ข๐ŸŽฏ Nexus teaches Next.js from foundations to professional systemsโ€ขโšก App Router, React 19, and Tailwind v4 in one learning pathโ€ข๐Ÿงฉ Inspect real components, layouts, and reusable patternsโ€ข๐Ÿ› ๏ธ Build production discipline, not just polished demosโ€ข๐Ÿ“š Tracks, references, and design studies in one placeโ€ข๐ŸŽฏ Nexus teaches Next.js from foundations to professional systemsโ€ขโšก App Router, React 19, and Tailwind v4 in one learning pathโ€ข๐Ÿงฉ Inspect real components, layouts, and reusable patternsโ€ข๐Ÿ› ๏ธ Build production discipline, not just polished demosโ€ข๐Ÿ“š Tracks, references, and design studies in one placeโ€ข๐ŸŽฏ Nexus teaches Next.js from foundations to professional systemsโ€ขโšก App Router, React 19, and Tailwind v4 in one learning pathโ€ข๐Ÿงฉ Inspect real components, layouts, and reusable patternsโ€ข๐Ÿ› ๏ธ Build production discipline, not just polished demosโ€ข๐Ÿ“š Tracks, references, and design studies in one placeโ€ข
UI Components

Toggle

A two-state toggle button and a ToggleGroup for mutually exclusive selections โ€” ideal for toolbars and settings.

Quick Preview

Structure

Anatomy of the Toggle โ€” a button with pressed / unpressed binary state.

โœฆLabelpressed โ†’ bg-primary/10
Label โ€” required text / icon / ReactNodeIcon slot โ€” optional, placed anywhere insideContainer โ€” rounded-lg, variant colors pressed state

States

Click any toggle to switch its pressed state live.

Default variant โ€” all states

Click to toggle the pressed state

4 states

Default โ€” off

Not pressed

Default โ€” on

Pressed

Disabled โ€” off

Cannot toggle

Disabled โ€” on

Locked pressed

Outline variant โ€” all states

Same logic, bordered style

4 states

Outline โ€” off

Not pressed

Outline โ€” on

Pressed

Disabled โ€” off

Cannot toggle

Disabled โ€” on

Locked pressed

Sizes

Three size tokens โ€” sm md (default) lg.

Sizes โ€” sm / md / lg

All sizes shown in both variants

3 states

Small โ€” sm

Medium โ€” md

Large โ€” lg

Installation

// Copy Toggle.tsx to your components/ui/ folder
// src/components/ui/Toggle.tsx

Usage

import { Toggle, ToggleGroup, ToggleGroupItem } from '@/components/ui/Toggle'
// Standalone toggle
<Toggle defaultPressed onPressedChange={(p) => console.log(p)}>
Bold
</Toggle>
// ToggleGroup (single selection)
<ToggleGroup defaultValue="left" onValueChange={(v) => setAlign(v)}>
<ToggleGroupItem value="left">Left</ToggleGroupItem>
<ToggleGroupItem value="center">Center</ToggleGroupItem>
<ToggleGroupItem value="right">Right</ToggleGroupItem>
</ToggleGroup>

Examples

Toggle Group โ€” Text Alignment

Outline Variant

Prompt Preview

Copy a prompt that recreates this UI

Paste this into your AI coding assistant to generate code that closely matches the reference, including color, size, shape, typography, spacing, and polish.

Copy-ready AI prompt

Starts from the current visual reference and project constraints.

Tweak only product-specific copy or data after the first generation pass.

Props

PropTypeDefaultDescription
pressedboolean-Controlled pressed state
defaultPressedbooleanfalseInitial pressed state (uncontrolled)
onPressedChange(pressed: boolean) => void-Called when pressed state changes
variant"default" | "outline""default"Visual style
size"sm" | "md" | "lg""md"Size of the toggle