# Calendar

- **[Atoms](/components/)**

A month of days to choose from: the WAI-ARIA date picker grid, with today named and unavailable days said.

## When 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

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>
  );
}
```

## Import

- **CLI**

  ```
  npx shadcn add @klarhimmel/calendar
  ```
- **Import**

  ```
  import { Calendar } from '@/components/klarhimmel/ui/calendar';
  ```

- **Files**: calendar.tsx, in components/klarhimmel/ui/. With it: theme, utils. npm: lucide-react.
- **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**

  ```
  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**

  ```
  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>
    );
  }
  ```

## Props

- **value**: The chosen day, "YYYY-MM-DD", or "" for none.
- **defaultValue**: The chosen day as 'YYYY-MM-DD'; '' means none. Controlled or uncontrolled.
- **onValueChange**: The chosen day as 'YYYY-MM-DD'; '' means none. Controlled or uncontrolled.
- **month**: The month shown, "YYYY-MM". Defaults to the chosen day's month, then today's, then the month of `today`.
- **onMonthChange**: The month shown, 'YYYY-MM'.
- **min**: The earliest and latest day that can be chosen. Other days are shown but cannot be picked.
- **max**: Days that cannot be chosen are struck through and aria-disabled; arrows still pass over them.
- **isDisabled**: Days that cannot be chosen are struck through and aria-disabled; arrows still pass over them.
- **today**: Today, "YYYY-MM-DD". Marked with a ring and the word. Never read from the clock here, so it renders the same on the server.
- **firstDay**: Where the week starts; the language names are written in.
- **locale**: Where the week starts; the language names are written in.
- **aria-label**: Names the grid when there is no other label.
- **autoFocus**: Move focus to the day when it mounts (a calendar opened from a button).
- **labels**: Button names and the word added to today's name. Pass them translated.
- **className**: Extra classes, merged after the component's own.

## Accessibility

- 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

[Accessibility](/get-started/accessibility)

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.

[Previous](/components/scroll-area)

[Next](/components/date-picker)
