snapshot of https://github.com/shadcn-ui/ui.git (main, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
48
apps/v4/registry/bases/aria/ui/checkbox.tsx
Normal file
48
apps/v4/registry/bases/aria/ui/checkbox.tsx
Normal file
@@ -0,0 +1,48 @@
|
||||
"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 }
|
||||
Reference in New Issue
Block a user