- Components
Calendar
A month of days to choose from: the WAI-ARIA date picker grid, with today named and unavailable days said.
npx shadcn add @klarhimmel/calendarWhen to use
Use for
Choosing a day when seeing the month helps: a booking, a deadline.
Not for
A date people already know. Use Date picker, so they can type it.
Pairs with
Date picker, Popover, a status line.
Preview
November 2026
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
Chosen: 2026-11-18. Arrow keys move, Page Up and Page Down change month.
calendar.tsx
import { Theme } from '@/components/klarhimmel/theme/style';
import { Calendar } from '@/components/klarhimmel/ui/calendar';
export default function Example() {
return (
<Theme theme="brand">
<Calendar defaultValue="2026-11-20" today="2026-11-16" />
</Theme>
);
}Install
Import
import { Calendar } from '@/components/klarhimmel/ui/calendar';- Lands in
- components/klarhimmel/ui/calendar.tsx, plus cn() and the theme item if they are missing. Import theme.css after Tailwind.
- Render in
- Render it inside <Theme>, once near the root of your app. Tokens and fonts are scoped to it, so outside it the component is unstyled.
Examples
Limits
November 2026
Mon Tue Wed Thu Fri Sat Sun Nothing before today, nothing after 20 December, and no weekends. Those days are struck through and cannot be chosen, but arrows still pass over them.
import { Calendar } from '@/components/klarhimmel/ui/calendar'; const weekend = (iso: string) => [0, 6].includes(new Date(`${iso}T00:00:00Z`).getUTCDay()); export default function CalendarLimits() { return ( <div className="flex flex-col gap-3"> <Calendar defaultValue="2026-11-18" today="2026-11-16" min="2026-11-16" max="2026-12-20" isDisabled={weekend} aria-label="Weekdays in the next five weeks" /> <p className="max-w-xs text-kh-small text-kh-muted">Nothing before today, nothing after 20 December, and no weekends. Those days are struck through and cannot be chosen, but arrows still pass over them.</p> </div> ); }Sunday
november 2026
sön mån tis ons tors fre lör Swedish names, weeks starting on Sunday, and your own button words.
import { Calendar } from '@/components/klarhimmel/ui/calendar'; export default function CalendarSunday() { return ( <div className="flex flex-col gap-3"> <Calendar defaultValue="2026-11-18" today="2026-11-16" firstDay="sun" locale="sv" labels={{ previous: 'Föregående månad', next: 'Nästa månad', today: 'idag' }} /> <p className="text-kh-small text-kh-muted">Swedish names, weeks starting on Sunday, and your own button words.</p> </div> ); }
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
value / defaultValue / onValueChange | string / (value: string) => void | - | The chosen day as 'YYYY-MM-DD'; '' means none. Controlled or uncontrolled. |
month / onMonthChange | string / (month: string) => void | the chosen day's month | The month shown, 'YYYY-MM'. |
min / max / isDisabled | string / string / (iso: string) => boolean | - | Days that cannot be chosen are struck through and aria-disabled; arrows still pass over them. |
today | string | - | Today as 'YYYY-MM-DD': ringed and named. Never read from the clock here, so server and browser agree. |
firstDay / locale | 'mon' | 'sun' / string | 'mon' / 'en' | Where the week starts; the language names are written in. |
labels | { previous; next; today } | English words | The two month buttons and the word added to today's name. Pass them translated. |
autoFocus / aria-label | boolean / string | - / the month | Focus the day on mount (a calendar opened from a button); a name when the month heading is not enough. |
className | string | - | Extra classes, merged after the component's own. |
Accessibility
| Key | Does |
|---|---|
Tab | Enters the grid on one day (the chosen day, else today) |
Left / Right | A day back or forward, across months |
Up / Down | A week back or forward |
Home / End | The start or the end of the week |
Page Up / Page Down | A month back or forward; with Shift, a year |
Enter / Space | Chooses the day |
The WAI-ARIA date picker grid. The month is announced when it changes; days that cannot be chosen stay focusable, say so, and are struck through.
Accessibility