'use client' import React from 'react' export interface CheckboxProps extends Omit, 'type'> { label?: React.ReactNode error?: string } export const Checkbox = React.forwardRef( ({ label, error, className = '', id, ...props }, ref) => { const checkboxId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}` const errorId = `${checkboxId}-error` const hasError = Boolean(error) const baseStyles = 'h-4 w-4 rounded border-gray-300 text-primary-600 focus:ring-primary-500 dark:border-gray-600 dark:bg-gray-800 dark:ring-offset-gray-900' const errorStyles = hasError ? 'border-error-500' : '' return (
{label && (
{error && ( )}
)}
) } ) Checkbox.displayName = 'Checkbox'