BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/trovecn/checkbox

Checkbox

trovecn/checkbox
FreeComponent

Base UI checkbox with a hand-drawn checkmark that draws on and off.

Install it

npx shadcn@latest add https://trovecn.dev/r/checkbox.json

Source

src/components/ui/checkbox.tsxtrovecn.dev/r/checkbox.json · first 6 KB
1"use client";
2
3import {
4 Children,
5 cloneElement,
6 createContext,
7 forwardRef,
8 isValidElement,
9 useCallback,
10 useContext,
11 useEffect,
12 useMemo,
13 useRef,
14 useState,
15 type HTMLAttributes,
16 type ReactElement,
17 type ReactNode,
18} from "react";
19import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";
20import { CheckboxGroup as CheckboxGroupPrimitive } from "@base-ui/react/checkbox-group";
21import { motion, AnimatePresence, useReducedMotion } from "motion/react";
22
23import { cn } from "@/lib/utils";
24import { spring } from "@/lib/springs";
25import { ProximityHoverPill } from "@/components/ui/proximity-hover-pill";
26import { useProximityHover } from "@/hooks/use-proximity-hover";
27import { useMergeSplit } from "@/hooks/use-merge-split";
28
29type CheckboxProps = Omit<CheckboxPrimitive.Root.Props, "inputRef">;
30
31const Checkbox = forwardRef<HTMLElement, CheckboxProps>(
32 (
33 {
34 className,
35 checked: checkedProp,
36 defaultChecked,
37 onCheckedChange,
38 disabled = false,
39 indeterminate = false,
40 ...props
41 },
42 ref,
43 ) => {
44 const [uncontrolledChecked, setUncontrolledChecked] = useState(defaultChecked ?? false);
45 const checked = checkedProp ?? uncontrolledChecked;
46
47 const applyChecked = (
48 next: boolean,
49 eventDetails: CheckboxPrimitive.Root.ChangeEventDetails,
50 ) => {
51 if (checkedProp === undefined) setUncontrolledChecked(next);
52 onCheckedChange?.(next, eventDetails);
53 };
54
55 const hasMountedRef = useRef(false);
56 useEffect(() => {
57 hasMountedRef.current = true;
58 }, []);
59
60 const reduceMotion = useReducedMotion();
61 const markEnterTransition =
62 reduceMotion || !hasMountedRef.current
63 ? { duration: 0 }
64 : { ...spring.quick.enter, delay: 0.06 };
65 const markExitTransition = reduceMotion ? { duration: 0 } : spring.fast.exit;
66
67 return (
68 <CheckboxPrimitive.Root
69 ref={ref}
70 data-slot="checkbox"
71 checked={checked}
72 disabled={disabled}
73 indeterminate={indeterminate}
74 onCheckedChange={applyChecked}
75 className={cn(
76// … truncated

What it pulls in

npm packages

  • @base-ui/react
  • motion

Other registry items

  • utils
  • springs

Files it writes

  • src/components/ui/checkbox.tsx

Facts

Registry
trovecn
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
In the index
at or before 2026-08-14
Last confirmed
today

Go to the source

trovecn.dev PPRAMANIK62/trovecn on GitHub Raw registry item This item as JSON

More from trovecn

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordiontrovecnComponentsFree3 deps
Agent Activityagent-activitytrovecnComponentsFree2 deps
Approval Requestapproval-requesttrovecnComponentsFree2 deps
ButtonbuttontrovecnComponentsFree2 deps
Checkbox Groupcheckbox-grouptrovecnComponentsFree2 deps
ComboboxcomboboxtrovecnComponentsFree3 deps
Comparison Slidercomparison-slidertrovecnComponentsFree1 dep
Context Menucontext-menutrovecnComponentsFree3 deps

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

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

© 2026 BlockDex. A Kynth Studios product.

BlockDex