ui/checkbox.tsx

php-saas · stacks/react/src/components/ui/checkbox.tsx · typescript · MIT
ui, UI / Frontend

Reusable accessible checkbox component for React forms and UI controls.

// Source: https://github.com/php-saas/php-saas | License: MIT | Copyright Saeed Vaziry
// Provided via justclaw.it.com; keep this notice with the code.
'use client';

import * as React from 'react';
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { CheckIcon } from 'lucide-react';

import { cn } from '@/lib/utils';

function Checkbox({ className, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root>) {
  return (
    <CheckboxPrimitive.Root
      data-slot="checkbox"
      className={cn(
        'peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructi

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key