Skip to content

Toggle

A button that keeps its pressed state.

Upstream documentation

Examples

Installation

Run the Ninaero registry command to install the component and its dependencies, including shared theme styles.

Install Toggle
pnpm dlx shadcn@latest add 'https://ninaero.pages.dev/r/toggle.json'

Usage

A complete example using the installed component and hook paths.

Toggle usage
"use client";import { Toggle } from "@/components/ui/toggle";function TogglePreview() {  return (    <Toggle variant="outline" defaultPressed>      Bold    </Toggle>  );}export default function Demo() {  return <TogglePreview />;}

API Reference

Ninaero exports and local defaults are listed below. See the upstream reference for inherited primitive props and additional composition examples.

Toggle

Toggle props
TogglePrimitive.Props & VariantProps<typeof toggleVariants> & { sound?: boolean }
variant
"default"
size
"default"
sound
true

toggleVariants

Exported value.

Source

Registry JSON