GitHub

Date Picker

Native date input wrapped with consistent styling and helper text.

01 Live Demo

Set your milestone deadline

Selected: None

02 Code Snippet

src/ui/DatePicker.tsx
import { DatePicker } from "@/ui/DatePicker";

<DatePicker.Root
  label="Due date"
  value={dueDate}
  onChange={(event) => setDueDate(event.target.value)}
/>

03 Copy-Paste (Single File)

DatePicker.tsx
function DatePickerRoot(props: React.InputHTMLAttributes<HTMLInputElement>) {
  return <input type="date" className="h-10 w-full rounded-lg border border-slate-200 px-3.5 text-sm" {...props} />;
}

type DatePickerCompound = typeof DatePickerRoot & { Root: typeof DatePickerRoot };
export const DatePicker = Object.assign(DatePickerRoot, { Root: DatePickerRoot }) as DatePickerCompound;
react-principles