Date Picker

A component for selecting a single date from an interactive calendar.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
import { DatePicker, DateRangePicker } from "passport-ui";
import { useState } from "react";

Usage

Basic example showing how to use the component.

components/example.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function DatePickerExample() {
const [date, setDate] = useState<Date | undefined>();
return (
<div className="w-sm">
<DatePicker
date={date}
onSelect={setDate}
placeholder="Pick a date"
/>
</div>
);
}
{/* Date range picker */}
function DateRangeExample() {
const [dateRange, setDateRange] = useState<DateRange | undefined>();
return (
<DateRangePicker
dateRange={dateRange}
onSelect={setDateRange}
placeholder="Pick a date range"
/>
);
}

Additional resources

Documentation and examples are available in Storybook.