@baseplate-dev/ui-components
Version:
Shared UI component library
15 lines • 1.26 kB
JavaScript
'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { Checkbox as CheckboxPrimitive } from 'radix-ui';
import { MdCheck } from 'react-icons/md';
import { cn } from '#src/utils/index.js';
/**
* A control that allows the user to toggle between checked and not checked.
*
* https://ui.shadcn.com/docs/components/checkbox
*/
function Checkbox({ className, ...props }) {
return (_jsx(CheckboxPrimitive.Root, { "data-slot": "checkbox", className: cn('peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary', className), ...props, children: _jsx(CheckboxPrimitive.Indicator, { "data-slot": "checkbox-indicator", className: "flex items-center justify-center text-current transition-none", children: _jsx(MdCheck, { className: "size-3.5" }) }) }));
}
export { Checkbox };
//# sourceMappingURL=checkbox.js.map