Calendar
A single-date and date-range calendar with directional month slide transitions, a spring hover highlight, range preview bands, and 2D grid keyboard navigation.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
Customize
Installation
npx shadcn@latest add @kinetic/calendarUsage
Import the calendar and handle the selected date:
import { Calendar } from "@/components/kinetic/ui/calendar";
export function ReleaseCalendar() {
const [date, setDate] = useState<Date | undefined>();
return <Calendar selected={date} onSelect={setDate} aria-label="Choose a date" />;
}Range selection
Set mode="range" to select a start and end date. selected and onSelect use an object with optional from and to dates, and a preview band follows the pointer while the range is incomplete. Pass rangeBand for a spring-stretched continuous band spanning each week row.
import type { CalendarDateRange } from "@/components/kinetic/ui/calendar";
const [range, setRange] = useState<CalendarDateRange | undefined>();
<Calendar mode="range" rangeBand selected={range} onSelect={setRange} />Initial selection and month
Use defaultSelected for an uncontrolled selection. Use defaultMonth to choose the visible month, or month with onMonthChange to control navigation.
<Calendar defaultSelected={new Date(2026, 5, 12)} defaultMonth={new Date(2026, 5, 1)} />Limits and disabled dates
Restrict the selectable window with minDate and maxDate. Pass disabled as a boolean to disable the whole calendar, or as a function to disable specific dates.
<Calendar
minDate={new Date(2026, 0, 1)}
maxDate={new Date(2026, 11, 31)}
disabled={(date) => date.getDay() === 0}
/>Week start, outside days, and locale
Set weekStartsOn to 0 for Sunday or 1 for Monday. Use showOutsideDays to show or hide days from adjacent months, and locale to set the language used for month and weekday names.
<Calendar weekStartsOn={1} showOutsideDays={false} locale="en-GB" />Custom day button
Pass components={{ DayButton }} (or renderDayButton) and wrap CalendarDayButton to render event dots, prices, or custom badges inside each day cell while keeping keyboard navigation, hover highlight, and range band behavior intact.
import {
Calendar,
CalendarDayButton,
type CalendarDayButtonProps,
} from "@/components/kinetic/ui/calendar";
interface EventDayButtonProps extends CalendarDayButtonProps {}
function EventDayButton({ day, modifiers, ...props }: EventDayButtonProps) {
const hasEvent = !modifiers?.outside && day.getDate() === 18;
return (
<CalendarDayButton day={day} modifiers={modifiers} {...props}>
<span>{day.getDate()}</span>
{hasEvent ? <span className="mt-0.5 size-1 rounded-full bg-primary" /> : null}
</CalendarDayButton>
);
}
<Calendar components={{ DayButton: EventDayButton }} />Keyboard navigation
In the day grid, the arrow keys move by one day or one week, Home and End jump to the start or end of the week, and PageUp and PageDown move by one month. Enter or Space selects the focused day. Use the previous and next buttons in the header to change month.
Motion preferences
Month slide transitions, the hover highlight, and selection feedback respect the browser's reduced-motion preference and the Kinetic reduced-motion setting. Timing follows the current tempo, and speed scales it for a single calendar.
API Reference
Calendar
Zero-dependency accessible calendar supporting single and range selection, directional month transitions, spring hover cell highlight, custom DayButton slots, and 2D keyboard navigation.
| Prop | Type | Default | Description |
|---|---|---|---|
mode / selected / defaultSelected / onSelect | "single" | "range" / Date | CalendarDateRange | "single" | Switches between single-date and range selection with live hover range preview. |
month / defaultMonth / onMonthChange | Date / Date / (month: Date) => void | - | Controlled or initial displayed month. |
showOutsideDays / weekStartsOn / rangeBand / speed | boolean / 0 | 1 / boolean / number | true / 0 / false / 1 | Controls adjacent-month days, Sunday/Monday start, spring range band bar, and animation speed multiplier (0.25-4). |
components / renderDayButton | { DayButton?: ComponentType<CalendarDayButtonProps> } / (props: CalendarDayButtonProps) => ReactNode | - | Customizes day button rendering while preserving keyboard focus, range styling, and hover tracking. |
CalendarDayButton
Default day cell button handling selected, today, outside, disabled, and range data attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
day / modifiers / children | Date / CalendarDayModifiers / React.ReactNode | - | Cell date, modifier state flags (selected, today, outside, rangeStart/Middle/End, etc.), and optional custom content. |