Selection & Dates
@hacline/ui/calendarCalendar
Select dates from a monthly calendar grid.
Usage
This example synchronizes the selected ISO date with value and onValueChange. Use mode to enable multiple or range selection, or compose the calendar grid and month navigation buttons independently.
December 2026
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 29 | 30 | 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 |
| 27 | 28 | 29 | 30 | 31 | 1 | 2 |
"use client";
import { useState } from "react";
import { Calendar } from "@/components/ui/hacline/components/calendar";
export const Example = () => {
const [date, setDate] = useState("2026-12-12");
return (
<div className="flex w-full flex-col items-center gap-3">
<Calendar
aria-label="Delivery date"
locale="en-US"
onValueChange={(value) =>
setDate(typeof value === "string" ? value : "")
}
value={date || null}
/>
<output className="text-hl-fg-muted text-sm">
Selected date: {date || "None"}
</output>
</div>
);
};Date Range Selection
Select a start date and an end date in sequence. This example requires at least three days and marks December 13 as unavailable.
December 2026
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| 29 | 30 | 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 |
| 27 | 28 | 29 | 30 | 31 | 1 | 2 |
"use client";
import { Calendar } from "@/components/ui/hacline/components/calendar";
export const Example = () => (
<Calendar
aria-label="Workshop date range"
defaultValue={["2026-12-07", "2026-12-11"]}
locale="en-US"
minDays={3}
mode="range"
unavailable="2026-12-13"
/>
);Parts
| Part | Description |
|---|---|
CalendarDay | A day. Shows the day of the month unless it has children; arrow keys move between days. |
CalendarGrid | One month's grid, a table. offset picks which of the months shown, from 0. Without children it renders its weekdays and weeks. |
CalendarHeading | The months shown, like "October 2026". Screen readers hear it change. |
CalendarMonthSelect | A native select of the months, in the locale, that turns the first month shown. |
CalendarNext | Shows the month after. Named "Next month"; pass aria-label in another language. |
CalendarPrevious | Shows the month before. Named "Previous month"; pass aria-label in another language. |
CalendarWeekday | A weekday's column header. Shows its name in weekdayFormat unless it has children. |
CalendarWeekdays | The header row of weekday names, a weekday in each column. Its children can be a function of the column's index that renders it, like (index) => <CalendarWeekday index={index} className="…" />. |
CalendarWeeks | The weeks of the grid's month, a row each, with a day in each cell. Its children can be a function of a cell that renders its day, like (cell) => <CalendarDay value={cell.date} className="…" />. A cell that shows nothing stays an empty cell. |
CalendarYearSelect | A native select of the years from min to max, or 10 either side of the year shown. |
Props
Prop
Type