Checkbox
scificn/checkboxFreeComponent
Accessible checkbox with terminal-style filled square indicator.
Live preview
live · rendered by the registry
Rendered by scificn on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://www.scificn.dev/r/checkbox.jsonSource
1import * as React from 'react'2import * as CheckboxPrimitive from '@radix-ui/react-checkbox'3import { cn } from '@/lib/utils'45export interface CheckboxProps6 extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {7 label?: string8}910const Checkbox = React.forwardRef<11 React.ElementRef<typeof CheckboxPrimitive.Root>,12 CheckboxProps13>(({ className, label, id, ...props }, ref) => {14 const checkboxId = id ?? label?.toLowerCase().replace(/\s+/g, '-')1516 return (17 <div style={{ display: 'inline-flex', alignItems: 'center', gap: '0.5rem' }}>18 <CheckboxPrimitive.Root19 ref={ref}20 id={checkboxId}21 className={cn(22 'peer h-4 w-4 shrink-0 rounded-none',23 'border border-[var(--border)]',24 'bg-[var(--surface)]',25 'focus-visible:outline-none',26 'focus-visible:border-[var(--border-active)]',27 'focus-visible:shadow-[var(--glow-green)]',28 'disabled:cursor-not-allowed disabled:opacity-40',29 'data-[state=checked]:border-[var(--color-green)]',30 'data-[state=checked]:bg-[var(--surface-raised)]',31 'data-[state=checked]:shadow-[var(--glow-green)]',32 'transition-all duration-150',33 className34 )}35 {...props}36 >37 <CheckboxPrimitive.Indicator38 style={{39 display: 'flex',40 alignItems: 'center',41 justifyContent: 'center',42 width: '100%',43 height: '100%',44 }}45 >46 <span47 style={{48 color: 'var(--color-green)',49 fontSize: '0.6rem',50 lineHeight: 1,51 textShadow: 'var(--text-glow-green)',52 userSelect: 'none',53 }}54 >55 ■56 </span>57 </CheckboxPrimitive.Indicator>58 </CheckboxPrimitive.Root>5960 {label && (61 <label62 htmlFor={checkboxId}63 style={{64 fontSize: '0.75rem',65 color: 'var(--text-secondary)',66 letterSpacing: '0.05em',67 cursor: 'pointer',68 userSelect: 'none',69 }}70 >71 {label}72 </label>73 )}74 </div>75 )76})77Checkbox.displayName = CheckboxPrimitive.Root.displayName7879export { Checkbox }
What it pulls in
npm packages
More from scificn
All 33 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alertalert | scificn | Components | Free | 1 dep | |
| Badgebadge | scificn | Components | Free | 1 dep | |
| Bar Chartbar-chart | scificn | Components | Free | no deps | |
| Breadcrumbbreadcrumb | scificn | Components | Free | no deps | |
| Buttonbutton | scificn | Components | Free | 2 deps | |
| Cardcard | scificn | Components | Free | no deps | |
| Dialogdialog | scificn | Components | Free | 1 dep | |
| Gridgrid | scificn | Components | Free | no deps |
