BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/patchui/toggle

Toggle

patchui/toggle
FreeComponent

patchui publishes no description for this item.

Install it

npx shadcn@latest add https://ui.hotfix.jobs/r/toggle.json

Source

registry/components/ui/toggle.tsxui.hotfix.jobs/r/toggle.json
1"use client";
2
3import { Toggle as TogglePrimitive } from "@base-ui/react/toggle";
4import { cva, type VariantProps } from "class-variance-authority";
5import type * as React from "react";
6import { cn } from "@/lib/utils";
7import { coarseTarget, colorTransition, selectionFocus } from "@/lib/recipes";
8
9export const toggleVariants = cva(
10 [
11 "relative inline-flex shrink-0 items-center justify-center whitespace-nowrap",
12 "rounded-[var(--radius-8)]",
13 "disabled:pointer-events-none disabled:opacity-50",
14 "[&_svg]:pointer-events-none [&_svg]:shrink-0",
15 selectionFocus,
16 colorTransition,
17 coarseTarget,
18 ].join(" "),
19 {
20 defaultVariants: { size: "md", variant: "tertiary" },
21 variants: {
22 size: {
23 sm: "h-6 min-w-6 gap-1.5 px-2.5 text-mini font-medium [&_svg:not([class*='size-'])]:size-3.5",
24 md: "h-8 min-w-8 gap-2 px-3.5 text-small font-medium [&_svg:not([class*='size-'])]:size-4",
25 lg: "h-10 min-w-10 gap-2 px-4 text-regular font-medium [&_svg:not([class*='size-'])]:size-5",
26 },
27 variant: {
28 tertiary:
29 "bg-transparent text-ink-muted hover:bg-layer-hover hover:text-ink data-[pressed]:bg-layer-hover data-[pressed]:text-ink",
30 secondary:
31 "bg-fill-1 text-ink hover:bg-fill-2 data-[pressed]:bg-fill-2 data-[pressed]:text-ink",
32 },
33 },
34 },
35);
36
37export interface ToggleProps
38 extends Omit<
39 React.ComponentProps<typeof TogglePrimitive>,
40 "value" | "defaultValue" | "className"
41 >,
42 VariantProps<typeof toggleVariants> {
43 className?: string;
44 value?: string;
45}
46
47/** Press-to-toggle button with persistent on/off state. */
48export function Toggle({
49 variant,
50 size,
51 className,
52 ...props
53}: ToggleProps): React.ReactElement {
54 return (
55 <TogglePrimitive
56 data-slot="toggle"
57 className={cn(toggleVariants({ variant, size }), className)}
58 {...props}
59 />
60 );
61}
62
63export { TogglePrimitive };

What it pulls in

npm packages

  • @base-ui/react
  • class-variance-authority

Other registry items

  • https://ui.hotfix.jobs/r/recipes.json
  • https://ui.hotfix.jobs/r/tokens.json
  • https://ui.hotfix.jobs/r/utils.json

Files it writes

  • registry/components/ui/toggle.tsx

Facts

Registry
patchui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

ui.hotfix.jobs hotfix-jobs/patch-ui on GitHub Raw registry item This item as JSON

More from patchui

All 51 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionpatchuiComponentsFree2 deps
AvataravatarpatchuiComponentsFree3 deps
BadgebadgepatchuiComponentsFree2 deps
BreadcrumbbreadcrumbpatchuiComponentsFree1 dep
ButtonbuttonpatchuiComponentsFree2 deps
CalendarcalendarpatchuiComponentsFree1 dep
CardcardpatchuiComponentsFree1 dep
CheckboxcheckboxpatchuiComponentsFree2 deps
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