Skip to content
Statix Design System

Forms

Calendar

A month grid for picking one date. The selected day is filled primary, today is primary-soft. Put it in a Popover to build a date picker.

import { Calendar } from '@statix/ui/calendar';
import { today, getLocalTimeZone } from '@internationalized/date';

Playground

November 2026
MoTuWeThFrSaSu
26
27
28
29
30
31
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
1
2
3
4
5
6
Controls
<Calendar type="single" bind:value weekStartsOn={1} />

Examples

Basic

Values are @internationalized/date objects. Bind value to read the selected day.

November 2026
SuMoTuWeThFrSa
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
1
2
3
4
5
<script lang="ts">
	import { Calendar } from '@statix/ui/calendar';
	import { getLocalTimeZone, today, type DateValue } from '@internationalized/date';

	let value = $state<DateValue | undefined>(today(getLocalTimeZone()));
</script>

<Calendar type="single" bind:value class="shadow-card" />

Contract end date

minValue sets the earliest date. isDateUnavailable strikes through days that are not allowed, here every day except the last of the month.

December 2026
SuMoTuWeThFrSa
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

Contracts end on the last day of a month. Pick one from the second month on.

<script lang="ts">
	import { Calendar } from '@statix/ui/calendar';
	import {
		CalendarDate,
		DateFormatter,
		endOfMonth,
		getLocalTimeZone,
		today,
		type DateValue
	} from '@internationalized/date';

	// Contracts end on the last day of a month, at least 30 days from today.
	const earliest = endOfMonth(today(getLocalTimeZone()).add({ days: 30 }));
	let value = $state<DateValue | undefined>(undefined);

	const isLastDayOfMonth = (date: DateValue) => date.day === endOfMonth(date).day;
	const format = new DateFormatter('en-GB', { dateStyle: 'long' });
	const label = $derived(
		value
			? `Your contract for yoga-berger.de ends on ${format.format(value.toDate(getLocalTimeZone()))}.`
			: 'Contracts end on the last day of a month. Pick one from the second month on.'
	);
</script>

<div class="flex flex-col items-center gap-3">
	<Calendar
		type="single"
		bind:value
		placeholder={earliest as CalendarDate}
		minValue={earliest}
		isDateUnavailable={(date) => !isLastDayOfMonth(date)}
		class="shadow-card"
	/>
	<p class="max-w-xs text-center text-small text-muted-foreground" aria-live="polite">{label}</p>
</div>

Month and year dropdowns

captionLayout="dropdown" adds selects for dates far away, such as a founding date.

SuMoTuWeThFrSa
28
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
<script lang="ts">
	import { Calendar } from '@statix/ui/calendar';
	import { CalendarDate, type DateValue } from '@internationalized/date';

	let value = $state<DateValue | undefined>(new CalendarDate(2019, 5, 14));
</script>

<Calendar
	type="single"
	bind:value
	captionLayout="dropdown"
	minValue={new CalendarDate(2010, 1, 1)}
	maxValue={new CalendarDate(2027, 12, 31)}
	class="shadow-card"
/>

Two months

numberOfMonths={2} shows two grids side by side. isDateDisabled greys out weekends.

November 2026
SuMoTuWeThFrSa
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
1
2
3
4
5
December 2026
SuMoTuWeThFrSa
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
<script lang="ts">
	import { Calendar } from '@statix/ui/calendar';
	import { getLocalTimeZone, isWeekend, today, type DateValue } from '@internationalized/date';

	let value = $state<DateValue | undefined>(undefined);
</script>

<Calendar
	type="single"
	bind:value
	numberOfMonths={2}
	minValue={today(getLocalTimeZone())}
	isDateDisabled={(date) => isWeekend(date, 'de-DE')}
	class="shadow-card"
/>

Date picker

A Popover with a field-styled trigger. Close it in onValueChange.

<script lang="ts">
	import { Button } from '@statix/ui/button';
	import { Calendar } from '@statix/ui/calendar';
	import { Label } from '@statix/ui/label';
	import * as Popover from '@statix/ui/popover';
	import { DateFormatter, getLocalTimeZone, today, type DateValue } from '@internationalized/date';
	import CalendarIcon from '@lucide/svelte/icons/calendar';

	const format = new DateFormatter('en-GB', { dateStyle: 'medium' });
	let value = $state<DateValue | undefined>(undefined);
	let open = $state(false);
</script>

<div class="flex w-full max-w-xs flex-col gap-2">
	<Label for="callback-date">Call me back on</Label>
	<Popover.Root bind:open>
		<Popover.Trigger id="callback-date">
			{#snippet child({ props })}
				<Button
					{...props}
					variant="outline"
					class="w-full justify-between rounded-lg border-input bg-card px-4 font-normal"
				>
					<span class={value ? 'text-foreground' : 'text-muted-foreground'}>
						{value ? format.format(value.toDate(getLocalTimeZone())) : 'Pick a date'}
					</span>
					<CalendarIcon class="text-muted-foreground" />
				</Button>
			{/snippet}
		</Popover.Trigger>
		<Popover.Content class="w-auto p-0" align="start">
			<Calendar
				type="single"
				bind:value
				minValue={today(getLocalTimeZone())}
				onValueChange={() => (open = false)}
			/>
		</Popover.Content>
	</Popover.Root>
</div>

Guidelines

Do

  • Disable or mark unavailable dates in the grid instead of rejecting them after the fact.
  • Show the chosen date as text next to or under the calendar, in a long format.
  • Set locale and weekStartsOn to match the audience. German customers expect Monday first.

Don't

  • Don't use a calendar for dates people know by heart, such as a birthday. Use an Input.
  • Don't show more than two months.

Accessibility

  • The root has role="application" and the month is a role="grid". Each day is a button with its full date as the accessible name.
  • Arrow keys move by day and week, Page Up and Page Down by month, Home and End to the start and end of the week. Enter or Space selects.
  • Disabled days are skipped. Unavailable days stay focusable but cannot be selected.
  • The previous and next buttons have aria-labels from bits-ui.

API reference

Calendar

renders <div role="application"> and accepts its attributes

Renders the full calendar. Takes every bits-ui Calendar.Root prop.

PropTypeDefault
type * 'single' | 'multiple'

Select one date or several.

–
value bindDateValue | DateValue[]

The selected date(s).

–
placeholder bindDateValue

The date that decides which month is shown.

–
onValueChange (value) => void

Called when the selection changes.

–
minValue / maxValue DateValue

Earliest and latest selectable date.

–
isDateDisabled (date: DateValue) => boolean

Greys out and skips matching days.

–
isDateUnavailable (date: DateValue) => boolean

Strikes through matching days.

–
captionLayout 'label' | 'dropdown' | 'dropdown-months' | 'dropdown-years'

Plain month heading, or selects for month and/or year.

'label'
numberOfMonths number

Months shown side by side.

1
locale string

Language for month and day names.

'en-US'
weekStartsOn 0 | 1 | 2 | 3 | 4 | 5 | 6

First day of the week, 0 is Sunday. Defaults to the locale.

–
weekdayFormat 'narrow' | 'short' | 'long'

How weekday names are written in the header.

'short'
disableDaysOutsideMonth boolean

Makes days of the previous and next month unselectable.

false
buttonVariant ButtonVariant

Button variant of the previous and next buttons.

'ghost'
day Snippet<[{ day: DateValue; outsideMonth: boolean }]>

Custom day cell. Render Calendar.Day inside it.

–
ref bindHTMLDivElement | null

The rendered element.

–
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
--cell-size / --cell-radiusCSS variables on the root: 40px cells with 10px corners. Override them with a class.

Calendar.Day

renders <button> and accepts its attributes

One day button, for use inside the day snippet.

PropTypeDefault
class ClassValue

Merged with the default classes; yours win.

–
Data attributeMeaning
data-selectedPresent on the selected day.
data-todayPresent on today.
data-outside-monthPresent on days of the previous or next month.
data-disabled / data-unavailablePresent on disabled or unavailable days.