Data

Spring Calendar

A month calendar where the selection flows from day to day and the month slides in from the side it came from.

Preview

Installation

Terminal
npx @usefluid/cli add spring-calendar

Usage

SpringCalendar.tsx
import { SpringCalendar } from "./SpringCalendar";

const [date, setDate] = useState<Date | null>(null);
<SpringCalendar value={date} onChange={setDate} />

API reference

PropTypeDefaultDescription
valueDate | null—The chosen day. The calendar opens on its month, or on today.
onChange(date) => void—Called with the day that was chosen.
localestringthe browser'sLanguage of the month and weekday names.
weekStart0 | 111 starts weeks on Monday, 0 on Sunday.
previousLabelstring"Previous month"Accessible name of the back button.
nextLabelstring"Next month"Accessible name of the forward button.

Keyboard and screen readers

A date grid: Tab reaches one day, the 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, and Enter or Space chooses. Each day is read as a full date, the chosen one as selected, and the month name is announced when it changes. With reduced motion nothing slides.

Notes

monthGrid and moveDate in calendar.ts hold the date logic, if you want it for a range picker of your own. Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

The selection is one pill on two springs, across and down the grid, so it travels between days instead of blinking. Changing month moves the days a short way on a spring from the side you came from. It is a date grid: arrows move by day and week, Page Up and Page Down by month, and each day is read as a full date.

For your agent

For your agent

Add Spring Calendar to my project with the Fluid library. Use SpringCalendar for the date fields of my product, in my language and with my first day of the week. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.