Files
upstream-shadcn-ui/apps/v4/registry/bases/aria/ui/checkbox.tsx
upstream-mirror 1416db152c
All checks were successful
Release / Create Version PR or Publish Stable Release (push) Has been skipped
Release / Publish Prerelease to NPM (push) Has been skipped
Monitor Registries / Monitor registry health (push) Has been skipped
snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:44:43 +05:00

49 lines
1.3 KiB
TypeScript

"use client"
import { cn } from "cn"
import {
Checkbox as CheckboxPrimitive,
composeRenderProps,
type CheckboxProps,
} from "react-aria-components"
import { IconPlaceholder } from "@/app/(create)/components/icon-placeholder"
function Checkbox({ className, children, ...props }: CheckboxProps) {
return (
<CheckboxPrimitive
data-slot="checkbox"
className={cn(
"cn-checkbox cn-checkbox-aria peer relative shrink-0 outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
className
)}
{...props}
>
{composeRenderProps(
children,
(children, { isSelected, isIndeterminate }) => (
<>
<span
data-slot="checkbox-indicator"
className="cn-checkbox-indicator grid place-content-center text-current transition-none"
>
{(isSelected || isIndeterminate) && (
<IconPlaceholder
lucide="CheckIcon"
tabler="IconCheck"
hugeicons="Tick02Icon"
phosphor="CheckIcon"
remixicon="RiCheckLine"
/>
)}
</span>
{children}
</>
)
)}
</CheckboxPrimitive>
)
}
export { Checkbox }