Skip to main content
196

Search Lumen

Find components, APIs, guides, and recipes.

GitHub
Web docs
Forms and dates

useCalendar

Builds an Astro-compatible calendar grid with hidden input value, min/max clamping, month navigation, selection, and roving keyboard focus.

Live component preview · Astro

Explore Calendar

Try the component this hook connects to. The preview uses the Astro adapter; the React example below uses useCalendar.

July 2026
MonTueWedThuFriSatSun
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
July 2026
MonTueWedThuFriSatSun
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
July 2026
MonTueWedThuFriSatSun
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
July 2026
MonTueWedThuFriSatSun
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

React usage

Import from @santi020k/lumen-react and spread the controller props onto the matching components.

tsxuseCalendar example
import { Calendar } from '@santi020k/lumen-react'

export function DeliveryDate() {
  return (
    <Calendar
      max="2026-07-31"
      min="2026-07-01"
      month="2026-07"
      name="delivery"
    />
  )
}
import { Calendar } from '@santi020k/lumen-react'

export function DeliveryDate() {
  return (
    <Calendar
      max="2026-07-31"
      min="2026-07-01"
      month="2026-07"
      name="delivery"
    />
  )
}

Load @santi020k/lumen-react/styles.css once in your application. With React Server Components, put 'use client' at the top of the module that calls the hook. Follow the React setup guide for the framework boundary.

Options

PropertyTypeDefaultDescription
valuestring-Controlled selected date in YYYY-MM-DD format.
defaultValuestring""Initial selected date for uncontrolled usage.
monthstringselected month or todayVisible month in YYYY-MM format.
min / maxstring-Inclusive date bounds in YYYY-MM-DD format.
onValueChange(value: string) => void-Callback fired when a date is selected.

Controller return values

PropertyTypeDescription
rootPropsLumenProps<"div">Spread onto the calendar root.
inputPropsLumenProps<"input">Spread onto the hidden input.
previousProps / nextPropsLumenProps<"button">Spread onto month navigation buttons.
weeksCalendarDay[][]Six calendar rows of generated day models.
getDayProps(day, props?) => LumenProps<"td">Returns gridcell props for a generated day.
selectDate(date) => voidSelect a date programmatically.
Web docsFull catalog