Checkbox Glass
shadcn-glass-ui/checkbox-glassFreeComponent
Glass-themed checkbox built on Radix UI primitives with:
Install it
npx shadcn@latest add https://raw.githubusercontent.com/artyhoo/shadcn-glass-ui-library/main/public/r/checkbox-glass.jsonSource
1/**2 * CheckboxGlass Component3 *4 * Glass-themed checkbox built on Radix UI primitives with:5 * - 100% shadcn/ui type compatibility6 * - Theme-aware styling (glass/light/aurora)7 * - Glow effect on hover/focus8 * - Optional label9 *10 * @since v2.2.6 - Migrated to Radix UI primitives for full type compatibility11 */1213import * as React from 'react';14import * as CheckboxPrimitive from '@radix-ui/react-checkbox';15import { Check, Minus } from 'lucide-react';16import { cn } from '@/lib/utils';17import '@/glass-theme.css';1819// ========================================20// TYPES21// ========================================2223/**24 * Checked state type compatible with shadcn/ui (Radix UI)25 */26export type CheckedState = boolean | 'indeterminate';2728/**29 * Props for the CheckboxGlass component30 *31 * Extends Radix UI Checkbox.Root props for 100% shadcn/ui compatibility.32 * All Radix props are supported including: checked, defaultChecked, onCheckedChange,33 * disabled, required, name, value, etc.34 *35 * **Type Compatibility (v2.3.1+):**36 * - Extends `React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>`37 * - No more `as unknown as` type assertions needed38 * - Full IntelliSense for all Radix props39 *40 * @accessibility41 * - **Keyboard Navigation:** Space to toggle (WCAG 2.1.1)42 * - **Focus Management:** Visible focus ring using `--focus-glow` CSS variable (WCAG 2.4.7)43 * - **Screen Readers:** Radix UI handles ARIA attributes automatically44 * - **Touch Targets:** 44x44px minimum touch area per Apple HIG (WCAG 2.5.5)45 * - **Color Contrast:** Check mark and backgrounds meet WCAG AA contrast ratio 4.5:146 *47 * @example48 * ```tsx49 * // shadcn/ui compatible API50 * <CheckboxGlass51 * checked={isChecked}52 * onCheckedChange={(checked) => setIsChecked(checked === true)}53 * />54 *55 * // Indeterminate state (tri-state checkbox)56 * <CheckboxGlass57 * checked={allSelected ? true : someSelected ? 'indeterminate' : false}58 * onCheckedChange={(checked) => {59 * if (checked === true) selectAll();60 * else deselectAll();61 * }}62 * label="Select all"63 * />64 *65 * // Legacy API (still supported)66 * <CheckboxGlass checked={agreed} onChange={setAgreed} label="I agree to terms" />67 * ```68 *69 * @since v2.3.0 - Added shadcn/ui compatible `onCheckedChange` and `indeterminate` support70 * @since v2.2.6 - Migrated to Radix UI primitives for full type compatibility71 */72export interface CheckboxGlassProps extends Omit<73 React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>,74// … truncated
More from shadcn-glass-ui
All 76 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Alert Glassalert-glass | shadcn-glass-ui | Components | Free | no deps | |
| Animated Background Glassanimated-background-glass | shadcn-glass-ui | Components | Free | no deps | |
| Avatar Glassavatar-glass | shadcn-glass-ui | Components | Free | no deps | |
| Badge Glassbadge-glass | shadcn-glass-ui | Components | Free | no deps | |
| Base Progress Glassbase-progress-glass | shadcn-glass-ui | Components | Free | no deps | |
| Button Glassbutton-glass | shadcn-glass-ui | Components | Free | no deps | |
| Card Glasscard-glass | shadcn-glass-ui | Components | Free | no deps | |
| Circular Progress Glasscircular-progress-glass | shadcn-glass-ui | Components | Free | no deps |
