BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/@nivalis/ui/toggle

Toggle

nivalis-ui/toggle
FreeComponent

A toggle component.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/nivalis-studio/nivalis-ui/main/public/r/toggle.json

Source

registry/niv/ui/toggle.tsxraw.githubusercontent.com/nivalis-studio/nivalis-ui/main/public/r/toggle.json
1'use client';
2
3import { Root } from '@radix-ui/react-toggle';
4import { cva, type VariantProps } from 'class-variance-authority';
5import { cn } from '@/lib/classnames';
6import type { ComponentProps } from 'react';
7
8const toggleVariants = cva(
9 "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium text-sm outline-none transition-[color,box-shadow] hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
10 {
11 variants: {
12 variant: {
13 default: 'bg-transparent',
14 outline:
15 'border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground',
16 },
17 size: {
18 default: 'h-9 min-w-9 px-2',
19 sm: 'h-8 min-w-8 px-1.5',
20 lg: 'h-10 min-w-10 px-2.5',
21 },
22 },
23 defaultVariants: {
24 variant: 'default',
25 size: 'default',
26 },
27 },
28);
29
30function Toggle({
31 className,
32 variant,
33 size,
34 ...props
35}: ComponentProps<typeof Root> & VariantProps<typeof toggleVariants>) {
36 return (
37 <Root
38 className={cn(toggleVariants({ variant, size, className }))}
39 data-slot='toggle'
40 {...props}
41 />
42 );
43}
44
45export { Toggle };

What it pulls in

npm packages

  • @radix-ui/react-toggle

Files it writes

  • registry/niv/ui/toggle.tsx

Facts

Registry
@nivalis/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
2 days ago

Go to the source

ui.nivalis.studio nivalis-studio/nivalis-ui on GitHub Raw registry item This item as JSON

More from @nivalis/ui

All 23 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordion@nivalis/uiComponentsFree1 dep
Avataravatar@nivalis/uiComponentsFree1 dep
Badgebadge@nivalis/uiComponentsFreeno deps
Breadcrumbbreadcrumb@nivalis/uiComponentsFree1 dep
Buttonbutton@nivalis/uiComponentsFree1 dep
Cardcard@nivalis/uiComponentsFreeno deps
Checkboxcheckbox@nivalis/uiComponentsFree1 dep
Commandcommand@nivalis/uiComponentsFree2 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex