Skip to content
Likable Aurora @likable-hair/svelte 5

Calendar

Grid of the days of one month, to choose a day or, with range, a range of days. It has no header: visibleMonth and visibleYear decide the month, and DatePicker adds the title and the arrows around it. Values are Date objects at local midnight. Names of months and days and the first day of the week come from locale through Intl; weekStart overrides the latter. min, max and isDateDisabled decide which days can be chosen. It follows the ARIA grid pattern: the grid is a single Tab stop, the arrows move by day and week, Home and End go to the ends of the week, Page Up and Page Down change month (with Shift, year) and Enter or Space choose. Today has a dot, the days of the nearby months are faded and choosing one shows its month. While a range is being chosen, hovering or focusing a day previews it. The grid variant has large bordered cells for an agenda, with events in dayAppendSnippet. Screen readers read the full date of every day. Its state is exposed as data-variant and data-disabled on the grid, and as data-today, data-selected, data-outside, data-disabled and data-range (start, middle, end, single) on the days, for app CSS.

import { Calendar } from '@likable-hair/svelte';

src/lib/components/simple/dates/Calendar.svelte · Markdown for LLMs

Choose a day

bind:selectedDate holds the chosen day, a Date at local midnight. Click a day, or focus the grid and use the arrow keys, Home, End, Page Up and Page Down, then Enter.

Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sunday, August 30, 2026
Monday, August 31, 2026
Tuesday, September 1, 2026
Wednesday, September 2, 2026
Thursday, September 3, 2026
Friday, September 4, 2026
Saturday, September 5, 2026
Sunday, September 6, 2026
Monday, September 7, 2026
Tuesday, September 8, 2026
Wednesday, September 9, 2026
Thursday, September 10, 2026
Friday, September 11, 2026
Saturday, September 12, 2026
Sunday, September 13, 2026
Monday, September 14, 2026
Tuesday, September 15, 2026
Wednesday, September 16, 2026
Thursday, September 17, 2026
Friday, September 18, 2026
Saturday, September 19, 2026
Sunday, September 20, 2026
Monday, September 21, 2026
Tuesday, September 22, 2026
Wednesday, September 23, 2026
Thursday, September 24, 2026
Friday, September 25, 2026
Saturday, September 26, 2026
Sunday, September 27, 2026
Monday, September 28, 2026
Tuesday, September 29, 2026
Wednesday, September 30, 2026
Thursday, October 1, 2026
Friday, October 2, 2026
Saturday, October 3, 2026
Sunday, October 4, 2026
Monday, October 5, 2026
Tuesday, October 6, 2026
Wednesday, October 7, 2026
Thursday, October 8, 2026
Friday, October 9, 2026
Saturday, October 10, 2026

Thu Sep 24 2026

Code
<script lang="ts">
	import { Calendar } from '@likable-hair/svelte';

	let selectedDate = $state<Date | undefined>(new Date(2026, 8, 24));
</script>

<div class="example">
	<Calendar bind:selectedDate aria-label="Appointment day" />
	<p>{selectedDate ? selectedDate.toDateString() : 'No day chosen'}</p>
</div>

<style>
	.example {
		display: grid;
		gap: 12px;
		width: 280px;
	}

	p {
		margin: 0;
		color: var(--global-color-text-2);
		font-size: 13px;
	}
</style>

Range and limits

With range the first click sets selectedDate and the second selectedDateTo; hovering previews the range. min, max and isDateDisabled (here: Sundays, the salon is closed) decide which days can be chosen.

Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sunday, August 30, 2026
Monday, August 31, 2026
Tuesday, September 1, 2026
Wednesday, September 2, 2026
Thursday, September 3, 2026
Friday, September 4, 2026
Saturday, September 5, 2026
Sunday, September 6, 2026
Monday, September 7, 2026
Tuesday, September 8, 2026
Wednesday, September 9, 2026
Thursday, September 10, 2026
Friday, September 11, 2026
Saturday, September 12, 2026
Sunday, September 13, 2026
Monday, September 14, 2026
Tuesday, September 15, 2026
Wednesday, September 16, 2026
Thursday, September 17, 2026
Friday, September 18, 2026
Saturday, September 19, 2026
Sunday, September 20, 2026
Monday, September 21, 2026
Tuesday, September 22, 2026
Wednesday, September 23, 2026
Thursday, September 24, 2026
Friday, September 25, 2026
Saturday, September 26, 2026
Sunday, September 27, 2026
Monday, September 28, 2026
Tuesday, September 29, 2026
Wednesday, September 30, 2026
Thursday, October 1, 2026
Friday, October 2, 2026
Saturday, October 3, 2026
Sunday, October 4, 2026
Monday, October 5, 2026
Tuesday, October 6, 2026
Wednesday, October 7, 2026
Thursday, October 8, 2026
Friday, October 9, 2026
Saturday, October 10, 2026

Sep 8 – Sep 19

Code
<script lang="ts">
	import { Calendar } from '@likable-hair/svelte';

	let selectedDate = $state<Date | undefined>(new Date(2026, 8, 8));
	let selectedDateTo = $state<Date | undefined>(new Date(2026, 8, 19));

	const format = new Intl.DateTimeFormat('en', { day: 'numeric', month: 'short' });
	const label = $derived(
		selectedDate && selectedDateTo
			? `${format.format(selectedDate)} – ${format.format(selectedDateTo)}`
			: selectedDate
				? `From ${format.format(selectedDate)}, choose the last day`
				: 'Choose the first day'
	);
</script>

<div class="example">
	<Calendar
		range
		bind:selectedDate
		bind:selectedDateTo
		min={new Date(2026, 8, 3)}
		max={new Date(2026, 10, 30)}
		isDateDisabled={(date) => date.getDay() === 0}
		aria-label="Holiday"
	/>
	<p>{label}</p>
</div>

<style>
	.example {
		display: grid;
		gap: 12px;
		width: 280px;
	}

	p {
		margin: 0;
		color: var(--global-color-text-2);
		font-size: 13px;
	}
</style>

Agenda

variant="grid" draws large bordered cells and dayAppendSnippet puts the events of each day under its number. The title and the buttons are markup of the app that changes visibleMonth and visibleYear.

September 2026

Sun
Mon
Tue
Wed
Thu
Fri
Sat
Sunday, August 30, 2026
Monday, August 31, 2026
Tuesday, September 1, 2026
Wednesday, September 2, 2026
Thursday, September 3, 2026 Staff meeting
Friday, September 4, 2026
Saturday, September 5, 2026
Sunday, September 6, 2026
Monday, September 7, 2026
Tuesday, September 8, 2026 Balayage course
Wednesday, September 9, 2026
Thursday, September 10, 2026
Friday, September 11, 2026 Inventory
Saturday, September 12, 2026
Sunday, September 13, 2026
Monday, September 14, 2026
Tuesday, September 15, 2026
Wednesday, September 16, 2026
Thursday, September 17, 2026 Bridal trialNew colors
Friday, September 18, 2026
Saturday, September 19, 2026
Sunday, September 20, 2026
Monday, September 21, 2026
Tuesday, September 22, 2026
Wednesday, September 23, 2026
Thursday, September 24, 2026 09:30 Luca R.11:00 Giulia M.
Friday, September 25, 2026
Saturday, September 26, 2026
Sunday, September 27, 2026
Monday, September 28, 2026
Tuesday, September 29, 2026 Closed
Wednesday, September 30, 2026
Thursday, October 1, 2026
Friday, October 2, 2026
Saturday, October 3, 2026
Sunday, October 4, 2026
Monday, October 5, 2026
Tuesday, October 6, 2026
Wednesday, October 7, 2026
Thursday, October 8, 2026
Friday, October 9, 2026
Saturday, October 10, 2026
Code
<script lang="ts">
	import { mdiChevronLeft, mdiChevronRight } from '@mdi/js';
	import { Button, Calendar, toISODate } from '@likable-hair/svelte';

	type Tone = 'primary' | 'accent' | 'warning';

	const events: Record<string, { title: string; tone: Tone }[]> = {
		'2026-09-03': [{ title: 'Staff meeting', tone: 'primary' }],
		'2026-09-08': [{ title: 'Balayage course', tone: 'accent' }],
		'2026-09-11': [{ title: 'Inventory', tone: 'warning' }],
		'2026-09-17': [
			{ title: 'Bridal trial', tone: 'primary' },
			{ title: 'New colors', tone: 'accent' }
		],
		'2026-09-24': [
			{ title: '09:30 Luca R.', tone: 'primary' },
			{ title: '11:00 Giulia M.', tone: 'accent' }
		],
		'2026-09-29': [{ title: 'Closed', tone: 'warning' }]
	};

	let visibleMonth = $state(8);
	let visibleYear = $state(2026);
	let selectedDate = $state<Date>();

	const title = $derived(
		new Intl.DateTimeFormat('en', { month: 'long', year: 'numeric' }).format(
			new Date(visibleYear, visibleMonth, 1)
		)
	);

	function move(step: number) {
		const date = new Date(visibleYear, visibleMonth + step, 1);
		visibleMonth = date.getMonth();
		visibleYear = date.getFullYear();
	}

	function goToday() {
		const today = new Date();
		visibleMonth = today.getMonth();
		visibleYear = today.getFullYear();
	}
</script>

<div class="agenda">
	<header>
		<h3>{title}</h3>
		<Button variant="secondary" size="sm" onclick={goToday}>Today</Button>
		<span class="arrows">
			<Button
				buttonType="icon"
				variant="secondary"
				size="sm"
				icon={mdiChevronLeft}
				aria-label="Previous month"
				onclick={() => move(-1)}
			/>
			<Button
				buttonType="icon"
				variant="secondary"
				size="sm"
				icon={mdiChevronRight}
				aria-label="Next month"
				onclick={() => move(1)}
			/>
		</span>
	</header>
	<Calendar variant="grid" bind:visibleMonth bind:visibleYear bind:selectedDate aria-label={title}>
		{#snippet dayAppendSnippet({ date, outside })}
			{#if !outside}
				{#each events[toISODate(date)] ?? [] as event (event.title)}
					<span class="event" data-tone={event.tone}>{event.title}</span>
				{/each}
			{/if}
		{/snippet}
	</Calendar>
</div>

<style>
	.agenda {
		display: grid;
		gap: 14px;
	}

	header {
		display: flex;
		align-items: center;
		gap: 12px;
	}

	h3 {
		margin: 0;
		font-family: var(--global-font-family-display);
		font-size: 22px;
		letter-spacing: -0.03em;
	}

	.arrows {
		display: flex;
		gap: 6px;
		margin-inline-start: auto;
	}

	.event {
		--_tone: var(--global-color-primary);
		overflow: hidden;
		padding: 3px 6px;
		border-radius: var(--global-radius-xs);
		background: var(--global-color-primary-soft);
		color: var(--global-color-text);
		font-size: 11px;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.event::before {
		content: '';
		display: inline-block;
		width: 6px;
		height: 6px;
		margin-inline-end: 6px;
		border-radius: 2px;
		background: var(--_tone);
		vertical-align: 1px;
	}

	.event[data-tone='accent'] {
		--_tone: var(--global-color-accent);
		background: var(--global-color-accent-soft);
	}

	.event[data-tone='warning'] {
		--_tone: var(--global-color-warning);
		background: var(--global-color-warning-soft);
	}
</style>

Locale and marks

locale sets the names and the first day of the week through Intl (Italian weeks start on Monday). dayAppendSnippet adds a mark in the corner of the days with appointments.

L
M
M
G
V
S
D
lunedì 31 agosto 2026
martedì 1 settembre 2026
mercoledì 2 settembre 2026
giovedì 3 settembre 2026
venerdì 4 settembre 2026
sabato 5 settembre 2026
domenica 6 settembre 2026
lunedì 7 settembre 2026
martedì 8 settembre 2026
mercoledì 9 settembre 2026
giovedì 10 settembre 2026
venerdì 11 settembre 2026
sabato 12 settembre 2026
domenica 13 settembre 2026
lunedì 14 settembre 2026
martedì 15 settembre 2026
mercoledì 16 settembre 2026
giovedì 17 settembre 2026
venerdì 18 settembre 2026
sabato 19 settembre 2026
domenica 20 settembre 2026
lunedì 21 settembre 2026
martedì 22 settembre 2026
mercoledì 23 settembre 2026
giovedì 24 settembre 2026
venerdì 25 settembre 2026
sabato 26 settembre 2026
domenica 27 settembre 2026
lunedì 28 settembre 2026
martedì 29 settembre 2026
mercoledì 30 settembre 2026
giovedì 1 ottobre 2026
venerdì 2 ottobre 2026
sabato 3 ottobre 2026
domenica 4 ottobre 2026
lunedì 5 ottobre 2026
martedì 6 ottobre 2026
mercoledì 7 ottobre 2026
giovedì 8 ottobre 2026
venerdì 9 ottobre 2026
sabato 10 ottobre 2026
domenica 11 ottobre 2026
Code
<script lang="ts">
	import { Calendar, toISODate } from '@likable-hair/svelte';

	const busy = new Set(['2026-09-03', '2026-09-11', '2026-09-17', '2026-09-29']);

	let selectedDate = $state<Date | undefined>(new Date(2026, 8, 24));
</script>

<div class="example">
	<Calendar locale="it" weekdayFormat="narrow" bind:selectedDate aria-label="Giorno">
		{#snippet dayAppendSnippet({ date, outside })}
			{#if !outside && busy.has(toISODate(date))}
				<span class="mark"></span>
			{/if}
		{/snippet}
	</Calendar>
</div>

<style>
	.mark {
		width: 5px;
		height: 5px;
		border-radius: 50%;
		background: var(--global-color-warning);
	}

	.example {
		width: 280px;
	}
</style>

Props

NameTypeDefaultDescription
selectedDate bindable DateThe chosen day; with range, the first day of the range. Days are local midnights.
selectedDateTo bindable DateWith range, the last day of the range.
range booleanfalseChooses a range of days: the first click sets selectedDate, the second selectedDateTo (they swap when the second day is earlier, and the same day twice is a one-day range), the third starts a new range.
visibleMonth bindable numberVisible month, 0 to 11. Defaults to the month of selectedDate, or the current one; it follows selectedDate when that changes to another month. Bind it to drive or follow the navigation.
visibleYear bindable numberVisible year.
locale stringBCP 47 locale of the names of months and days and of the first day of the week. Defaults to the one set with setDefaultLocale, else en.
weekStart 0 | 1 | 2 | 3 | 4 | 5 | 6First day of the week, from 0 (Sunday) to 6 (Saturday). Defaults to the one of locale.
min DateEarliest day that can be chosen.
max DateLatest day that can be chosen.
isDateDisabled (date: Date) => booleanReturns true for the days that cannot be chosen (weekends, holidays, ...).
disabled booleanfalseShows the days without letting anyone choose them; the grid leaves the Tab order.
showOutsideDays booleantrueShows the days of the previous and next month that complete the first and last week.
showWeekdays booleantrueShows the row with the names of the days of the week.
weekdayFormat 'narrow' | 'short' | 'long''short'Length of the names of the days of the week. Screen readers always read the full name.
fillOpenRange booleanfalseWith range and only one end chosen, highlights every day after the start (or before the end).
previewDate bindable DateWith range, the day the preview reaches while the range is being chosen: the day under the pointer or with the focus. Bind the same variable on two calendars to share the preview between them.
followSelection booleantrueShows the month of selectedDate or selectedDateTo when they change to a month that is not visible. Turn it off when the parent decides the month, as with two calendars side by side.
variant 'compact' | 'grid''compact'compact is the grid of a date picker; grid has large bordered cells for an agenda, with room for events in dayAppendSnippet.
class { container?: string; weekday?: string; day?: string }{}Extra classes for each part.
calendarElement bindable HTMLDivElementThe grid element.

It also accepts the native attributes and events of <div> (for example id, title, aria-label, onkeydown), which are forwarded to the element.

Snippets

NameParametersDescription
daySnippetCalendarDayReplaces the number of a day. It receives a CalendarDay: date, outside, selected, inRange, today, disabled. The cell around it keeps click, keyboard and state, and screen readers keep reading the full date.
dayAppendSnippetCalendarDayContent after the number of a day: events in the grid variant, a mark in the top corner in the compact one.
weekdaySnippet{ label: string; name: string; day: number }Replaces the name of a day of the week. day goes from 0 (Sunday) to 6, name is the full name.

Events

NameTypeDescription
ondayClick(event: { date: Date; outside: boolean; nativeEvent: MouseEvent | KeyboardEvent; }) => voidCalled when a day that can be chosen is clicked or chosen with Enter or Space, after the selection changed. outside is true for the days of the nearby months.
onchange(event: { selectedDate: Date | undefined; selectedDateTo: Date | undefined }) => voidCalled when the user changes the selection.

Methods

Call them on the instance: <Calendar bind:this={ref} />, then ref.focus().

SignatureDescription
focus()Moves the focus into the grid: to the last focused day, else the chosen one, today or the first of the month.

Types

Exported by the package: import type { CalendarDay } from '@likable-hair/svelte';

CalendarDay

A day of the grid, as the day snippets receive it.

interface CalendarDay

NameTypeDescription
date requiredDateThe day, at local midnight.
outside requiredbooleanThe day belongs to the month before or after the visible one.
selected requiredbooleanThe day is the chosen one, or an end of the chosen range.
inRange requiredbooleanThe day is inside the chosen range, ends excluded.
today requiredbooleanThe day is today.
disabled requiredbooleanThe day cannot be chosen (min, max, isDateDisabled).

CSS variables

For a single instance, pass them as style props: <Calendar --calendar-color="tomato">. The --calendar-default-* defaults apply to the whole app: override them in :root or in a theme.

Per-instance variableDefault
--calendar-day-border-radius
--calendar-default-day-border-radius var(--global-radius-sm)
--calendar-range-background
--calendar-default-range-background var(--global-color-primary-soft)
--calendar-duration
--calendar-default-duration var(--global-duration)
--calendar-easing
--calendar-default-easing var(--global-ease)
--calendar-width
--calendar-default-width 100%
--calendar-color
--calendar-default-color var(--global-color-text)
--calendar-font-size
--calendar-default-font-size 13px
--calendar-row-gap
--calendar-default-row-gap 2px
--calendar-weekday-padding
--calendar-default-weekday-padding 6px 0
--calendar-default-grid-weekday-padding 10px
--calendar-weekday-color
--calendar-default-weekday-color var(--global-color-text-3)
--calendar-weekday-font-size
--calendar-default-weekday-font-size 10.5px
--calendar-weekday-font-weight
--calendar-default-weekday-font-weight 600
--calendar-weekday-letter-spacing
--calendar-default-weekday-letter-spacing 0.08em
--calendar-weekday-text-transform
--calendar-default-weekday-text-transform uppercase
--calendar-day-height
--calendar-default-day-height 32px
--calendar-day-width
--calendar-default-day-width 100%
--calendar-day-background
--calendar-default-day-background transparent
--calendar-day-hover-background
--calendar-default-day-hover-background var(--global-color-surface-3)
--calendar-focus-ring-color
--calendar-default-focus-ring-color var(--global-focus-ring-color)
--calendar-today-color
--calendar-default-today-color inherit
--calendar-today-background
--calendar-default-today-background transparent
--calendar-range-preview-background
--calendar-default-range-preview-background color-mix(in srgb, var(--global-color-primary) 8%, transparent)
--calendar-range-color
--calendar-default-range-color var(--global-color-text)
--calendar-selected-day-background
--calendar-default-selected-day-background var(--global-fill-primary)
--calendar-selected-day-color
--calendar-default-selected-day-color var(--global-color-on-primary)
--calendar-selected-day-box-shadow
--calendar-default-selected-day-box-shadow var(--global-shadow-fill)
--calendar-selected-day-font-weight
--calendar-default-selected-day-font-weight 600
--calendar-outside-day-opacity
--calendar-default-outside-day-opacity 0.5
--calendar-disabled-day-opacity
--calendar-default-disabled-day-opacity 0.35
--calendar-today-dot-size
--calendar-default-today-dot-size 4px
--calendar-today-dot-color
--calendar-default-today-dot-color var(--global-color-accent)
--calendar-grid-border-color
--calendar-default-grid-border-color var(--global-color-border)
--calendar-grid-border-radius
--calendar-default-grid-border-radius var(--global-radius-lg)
--calendar-grid-background
--calendar-default-grid-background var(--global-color-surface-solid)
--calendar-grid-cell-min-height
--calendar-default-grid-cell-min-height 64px
--calendar-grid-cell-padding
--calendar-default-grid-cell-padding 6px
--calendar-grid-day-size
--calendar-default-grid-day-size 24px
--calendar-grid-day-font-size
--calendar-default-grid-day-font-size 12px
--calendar-grid-today-background
--calendar-default-grid-today-background var(--global-fill-primary)
--calendar-grid-today-color
--calendar-default-grid-today-color var(--global-color-on-primary)