Skip to content
Nana UI

Forms & Inputs

Calendar

A month to pick one day from — a move-in date, a due date, the day a reading was taken. It sits in the page; for a field that opens one on demand, use nana-date-picker.

View .md Download

Days before min or after max cannot be reached at all. Days refused by isDateDisabled — weekends, public holidays — can still be reached by keyboard, so a person moving through the month always knows where they are, but cannot be chosen.

Arrow keys move by day and week, Home and End to the ends of the week, Page Up and Page Down by month (by year with Shift); Enter or Space picks.

November 2026
SMTWTFS

Weekdays only.

For a form field that opens a calendar on demand, use date picker. For a span of days, use date range.

npm install @nana-tec/ui-components

Or copy the source in and own it:

npx @nana-tec/ui add calendar --framework web-components
npx @nana-tec/ui add calendar --framework svelte

Lands in src/lib/components/ui/calendar/ as NanaCalendar.svelte, styled with Tailwind classes that resolve to the design tokens. Requires Tailwind v4.

Import the autoloader once, in your app's entry point. Every <nana-*> tag then works anywhere, and each component downloads only the first time a page uses it:

import "@nana-tec/ui-components/autoloader";
import "@nana-tec/ui-components/theme";

The second line gives every component the Nana look and the design tokens behind it. Leave it out to style the components entirely yourself.

Import a component directly when it must be ready at once: on screen at first paint, or when you call its methods straight away. The two mix freely:

import "@nana-tec/ui-components/calendar";

Copied in with npx @nana-tec/ui add calendar? Import your project's own @/lib/nana-ui/autoloader.js once instead; the CLI keeps it up to date.

<nana-calendar value="2026-03-15" min="2026-03-01" label="Move-in date"></nana-calendar>
const el = document.querySelector("nana-calendar");
el.addEventListener("nana-change", (e) => console.log(e.detail));
<script lang="ts">
import { NanaCalendar } from '$lib/components/ui/calendar';
let day = $state('');
let start = $state('');
let end = $state('');
</script>
<NanaCalendar bind:value={day} min="2026-01-01" />
<NanaCalendar mode="range" months={2} bind:start bind:end />

Values are ISO dates (2026-03-10). Arrow keys move by day and week, Home and End to the week’s ends, Page Up and Page Down by month (with Shift, by year). In range mode the first pick sets one end and the second the other, in either order.

Properties

PropertyAttributeTypeDefaultDescription
firstDayOfWeekfirst-day-of-weeknumber1Which weekday starts the week; 0 is Sunday
isDateDisabled—CalendarDateDisabled | undefined—Refuses days by rule, such as weekends; receives yyyy-mm-dd
labellabelstring''Accessible name for the calendar
localelocale——BCP 47 tag for month and weekday names
maxmaxstring''Latest day that can be picked, yyyy-mm-dd
minminstring''Earliest day that can be picked, yyyy-mm-dd
sizesize'sm' | 'md' | 'lg''md'Cell size
valuevaluestring''The picked day, yyyy-mm-dd

Methods

MethodDescription
focus(options?: FocusOptions): voidMove focus to the day the keyboard is on

Events

EventDescription
nana-changeA day was picked (detail.value, yyyy-mm-dd)

CSS parts

PartDescription
::part(base)The calendar
::part(header)The month and the arrows
::part(month-select)The list to jump to a month
::part(year-select)The list to jump to a year
::part(grid)The month grid
::part(day)A day cell; carries outside, selected, today
::part(nav-btn)The nav button
::part(month-label)The month label
::part(weekdays)The weekdays
::part(weekday)The weekday
::part(week)The week
::part(day-num)The day num
::part(nav-icon)The arrow inside a month button

CSS custom properties

PropertyDescription
--nana-calendar-accentThe selected day's colour

NanaCalendar

PropTypeDefault
modeCalendarMode'single'
valuebind:string''
startbind:string''
endbind:string''
minstring
maxstring
localestring'en'
firstDayOfWeeknumber0
monthsnumber1
labelstring
isDateUnavailable(iso: string) => boolean
onValueChange(value: string) => void
onRangeChange(range: CalendarRange) => void

Also accepts Omit<HTMLAttributes<HTMLDivElement>, 'class'>.