Skip to content
Harness Design System

Calendar

The Calendar component provides a flexible UI element for displaying a date picker. It includes several customizations for styling and functionality.

Usage

import { useState } from 'react';
import { Calendar } from '@harnessio/ui/components';
const CalendarExample = () => {
const [selectedDate, setSelectedDate] = useState<Date | undefined>(new Date());
return (
<Calendar
mode="range"
selected={selectedDate}
onSelect={setSelectedDate}
showOutsideDays
fromDate={new Date().setDate(new Date().getDate() - 10)}
toDate={new Date().setDate(new Date().getDate() + 10)}
weekStartsOn={1}
/>
);
};
export default CalendarExample;

API Reference

PropRequiredDefaultType
modefalse'single''single' | 'multiple' | 'range'
selectedfalseDate | Date[] | { from: Date; to: Date }
onSelectfalse(date: Date | Date[] | { from: Date; to: Date }) => void
showOutsideDaysfalsetrueboolean
classNamefalsestring
classNamesfalse
componentsfalse
disabledfalseDate | Date[] | { from: Date; to: Date }
fromDatefalseDate
toDatefalseDate
localefalseLocale
weekStartsOnfalse0 | 1 | 2 | 3 | 4 | 5 | 6