GitHub

Date Picker

Styled native date input for scheduling, due dates, and release planning with built-in label, helper text, and validation messaging support.

AccessibleDark Mode

Install

$npx react-principles add date-picker

Select the deployment day.

Selected date: 2026-04-10

02

Code Snippet

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

<DatePicker
  label="Launch date"
  description="Select the deployment day."
/>
03

Copy-Paste (Single File)

DatePicker.tsx
import { forwardRef, type InputHTMLAttributes } from "react";
import { cn } from "@/lib/utils";

export interface DatePickerProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"> {
  label?: string;
  description?: string;
  error?: string;
}
04

Props

PropTypeDefaultDescription
labelstringOptional label displayed above the date input.
descriptionstringHelper text shown below the field when there is no error.
errorstringError message that replaces the helper text and applies error styling.
classNamestringAdditional classes merged into the root wrapper.
idstringGenerated from labelOverrides the input id used by the label element.
react-principles