Checkbox
adn-ui/checkboxFreeComponent
A control that allows toggling between checked and unchecked states.
Live preview
live · rendered by the registry
Rendered by adn-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.awaiden.com/r/checkbox.jsonSource
1"use client";23import "./checkbox.css";4import { Checkbox as BaseCheckbox } from "@base-ui/react/checkbox";5import type React from "react";6import { cn } from "tailwind-variants";78import { CheckboxContext, useCheckboxContext } from "./checkbox.context";9import { checkboxVariants, type CheckboxVariants } from "./checkbox.variants";1011export type CheckboxProps = CheckboxVariants & React.ComponentProps<typeof BaseCheckbox.Root>;1213export const CheckboxRoot = ({ children, className, size, variant, ...props }: CheckboxProps) => {14 const slots = checkboxVariants({ size, variant });1516 return (17 <CheckboxContext.Provider value={{ slots }}>18 <BaseCheckbox.Root className={cn(slots.root(), className)} {...props}>19 {children}20 </BaseCheckbox.Root>21 </CheckboxContext.Provider>22 );23};2425export type CheckboxIndicatorProps = React.ComponentProps<typeof BaseCheckbox.Indicator>;2627export const CheckboxIndicator = ({ children, className, ...props }: CheckboxIndicatorProps) => {28 const { slots } = useCheckboxContext();29 return (30 <BaseCheckbox.Indicator className={cn(slots.indicator(), className)} {...props}>31 {children ?? (32 <svg33 className="h-full w-full stroke-current"34 fill="none"35 strokeLinecap="round"36 strokeLinejoin="round"37 strokeWidth="3"38 viewBox="0 0 24 24"39 >40 <polyline points="20 6 9 17 4 12" />41 </svg>42 )}43 </BaseCheckbox.Indicator>44 );45};
What it pulls in
npm packages
Files it writes
More from adn-ui
All 48 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | adn-ui | Components | Free | 2 deps · 5 files | |
| Alert Dialogalert-dialog | adn-ui | Components | Free | 2 deps · 5 files | |
| Aspect Ratioaspect-ratio | adn-ui | Components | Free | 1 dep · 4 files | |
| Autocompleteautocomplete | adn-ui | Components | Free | 2 deps · 5 files | |
| Avataravatar | adn-ui | Components | Free | 2 deps · 5 files | |
| Badgebadge | adn-ui | Components | Free | 1 dep · 4 files | |
| Breadcrumbbreadcrumb | adn-ui | Components | Free | 1 dep · 5 files | |
| Buttonbutton | adn-ui | Components | Free | 1 dep · 4 files |
