Calendar

A calendar component for selecting dates and date ranges.

Installation

Import the component from the passport-ui package.

components/example.tsx
1
2
import { Calendar } 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
function CalendarExample() {
const [date, setDate] = useState<Date | undefined>(new Date());
return (
<Calendar
mode="single"
selected={date}
onSelect={setDate}
className="rounded-md border"
/>
);
}
{/* Multiple date selection */}
function MultiCalendar() {
const [dates, setDates] = useState<Date[]>([]);
return (
<Calendar
mode="multiple"
selected={dates}
onSelect={setDates}
/>
);
}

Additional resources

Documentation and examples are available in Storybook.