Pickers
Introduction
nepdate has four pickers and a calendar. All of them come as React components and as Web Components, and they look and behave the same in both.
| I want people to choose | Use | React | HTML |
|---|---|---|---|
| One day | Date picker | <DatePicker> | <nep-date-picker> |
| A start and an end | Date range picker | <DateRangePicker> | <nep-date-range-picker> |
| A day and a time | Date and time picker | <DateTimePicker> | <nep-date-time-picker> |
| Several separate days | Multiple dates | <MultiDatePicker> | <nep-multi-date-picker> |
| A day, with no input field | Calendar | <Calendar> | <nep-calendar> |
What they share
- The value is AD. Every picker gives you AD dates, whatever the person sees. See How it works.
- Typing or clicking. Pickers accept typed dates in ASCII or Devanagari digits, or a click on the calendar. See Typing and input masking.
- A BS/AD switch. People can change calendars at any time, and the value stays the same. Set
calendarto fix one and hide the switch. - Limits.
min,maxandisDateDisabledwork everywhere. See Limits and validation. - Forms. Set
nameand the value is submitted with a plain form. See Forms. - Phones. Below 480px the panel becomes a bottom sheet. See Layouts.
- Accessibility. Keyboard control, screen-reader labels and contrast are built in. See Accessibility.
Controlled or not
Every React picker can work in two ways.
Controlled: you hold the value, as with any React input.
tsx
import { useState } from 'react';
import { DatePicker } from '@nepdatejs/react';
export function Controlled() {
const [value, setValue] = useState('2026-10-18');
return <DatePicker value={value} onChange={setValue} aria-label="Date" />;
}If your onChange keeps the old value, for example to refuse a date, the picker goes back to the value you hold, as a controlled input does. Text that's still being typed isn't a date yet, so it's left alone, and so is a range with one end still to pick.
Uncontrolled: the picker holds it, and a plain form reads it through name.
tsx
import { DatePicker } from '@nepdatejs/react';
export function Uncontrolled() {
return <DatePicker name="date" defaultValue="2026-10-18" aria-label="Date" />;
}Using the stylesheet
The components need @nepdatejs/styles. Import it once:
ts
import '@nepdatejs/styles';To change how they look, see Theming.