Tuimorphic

DatePicker

MS-DOS inspired calendar interface for date selection.

Import

import { DatePicker } from 'tuimorphic';

Basic Usage

2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
<DatePicker />

Props

PropTypeDefaultDescription
valueDateSelected date value (controlled)
defaultValueDateDefault selected date (uncontrolled)
onValueChange(date: Date) => voidCallback when date changes
minDateDateMinimum selectable date
maxDateDateMaximum selectable date
labelstringLabel text for the date picker
classNamestringAdditional CSS class names

With Label

Select Date
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
<DatePicker label="Select Date" />

Default Value

Birth Date
1990 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
<DatePicker
  label="Birthday"
  defaultValue={new Date(1990, 0, 15)}
/>

Date Constraints

Restrict selectable dates with minDate and maxDate:

Future dates only
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
Past dates only
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
Next 30 days
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
const today = new Date();
const nextMonth = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
 
<DatePicker label="Future dates only" minDate={today} />
<DatePicker label="Past dates only" maxDate={today} />
<DatePicker label="Next 30 days" minDate={today} maxDate={nextMonth} />

Controlled DatePicker

Event Date
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
Selected: (none)
const [date, setDate] = useState<Date | undefined>(undefined);
 
<DatePicker
  label="Appointment Date"
  value={date}
  onValueChange={setDate}
/>

Date Range Selection

Start Date
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
End Date
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa

Start: (none)

End: (none)

const [startDate, setStartDate] = useState<Date | undefined>(undefined);
const [endDate, setEndDate] = useState<Date | undefined>(undefined);
 
<DatePicker
  label="Start Date"
  value={startDate}
  onValueChange={setStartDate}
/>
<DatePicker
  label="End Date"
  value={endDate}
  onValueChange={setEndDate}
  minDate={startDate}
/>

Booking Example

Check-in
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa
Check-out
2026 JANUARY
Su
Mo
Tu
We
Th
Fr
Sa

Check-in: (none)

Check-out: (none)

const [checkIn, setCheckIn] = useState<Date | undefined>(undefined);
const [checkOut, setCheckOut] = useState<Date | undefined>(undefined);
 
const today = new Date();
const maxDate = new Date(today.getFullYear() + 1, today.getMonth(), today.getDate());
 
<DatePicker
  label="Check-in"
  value={checkIn}
  onValueChange={setCheckIn}
  minDate={today}
  maxDate={maxDate}
/>
<DatePicker
  label="Check-out"
  value={checkOut}
  onValueChange={setCheckOut}
  minDate={checkIn || today}
  maxDate={maxDate}
/>

Features

  • Calendar grid: 7-column week layout (Su Mo Tu We Th Fr Sa)
  • Month/year navigation: Arrow buttons for previous/next month and year
  • Visual indicators: Today's date and selected date highlighted
  • Date constraints: Optional min/max date restrictions
  • Keyboard navigation: Full keyboard support

Keyboard Navigation

KeyAction
Arrow LeftPrevious day
Arrow RightNext day
Arrow UpPrevious week
Arrow DownNext week
HomeFirst day of month
EndLast day of month
Page UpPrevious month
Shift + Page UpPrevious year
Page DownNext month
Shift + Page DownNext year
Enter / SpaceSelect focused date

Visual Design

The calendar uses MS-DOS inspired styling:

  • Navigation: << < YEAR MONTH > >>
  • Day headers: Su Mo Tu We Th Fr Sa
  • Days displayed as two-digit numbers (01, 15, etc.)
  • Selected date inverted (dark on light)
  • Today's date underlined

Accessibility

  • Proper grid ARIA attributes
  • Screen reader support for date selection
  • Full keyboard navigation
  • Focus management within calendar

Styling

VariableDescription
--theme-borderCalendar border
--theme-backgroundCalendar background
--theme-textDay text color
--theme-buttonSelected day background
--theme-focused-borderFocus outline
  • Input - For text-based date entry
  • Select - For selecting from preset dates

On this page