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
1import { DatePicker, DateRangePicker } from "passport-ui";
2import { useState } from "react";

Usage

Basic example showing how to use the component.

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

Additional resources

Documentation and examples are available in Storybook.