Skip to content
Redpanda UI
Esc
↑↓navigate↵open⌘Jpreview
Made by haydenbleasel
Edit on GitHub

Mini Calendar

A composable mini calendar component for picking dates close to today.

Powered by

Installation

bash
npx shadcn@latest add @redpanda/mini-calendar
bash
pnpm dlx shadcn@latest add @redpanda/mini-calendar
bash
yarn dlx shadcn@latest add @redpanda/mini-calendar
bash
bunx shadcn@latest add @redpanda/mini-calendar
bash
nubx shadcn@latest add @redpanda/mini-calendar
bash
aube dlx shadcn@latest add @redpanda/mini-calendar

When to use

The Mini Calendar component provides compact date selection for recent dates. Use this decision tree to determine when it’s appropriate:

Features

  • Displays a configurable number of consecutive days (default: 5) in a compact horizontal layout
  • Navigation with chevron buttons to move between date ranges by the configured number of days
  • Fully composable with separate components for navigation, days container, and individual days
  • Supports both controlled and uncontrolled usage with value/defaultValue and onValueChange props
  • Highlights today’s date with accent background and selected dates with the selected color tokens
  • Announces selected dates with aria-pressed and supports native keyboard activation
  • Keeps date-action appearance fixed; use containing elements for layout spacing
  • Context-based state management between components using React Context
  • Supports custom start dates with startDate/defaultStartDate and onStartDateChange props

Examples

Basic Usage

Controlled

Custom Layout

Custom Days

This example displays seven days and disables weekends.

Usage

tsx
import {  MiniCalendar,  MiniCalendarDay,  MiniCalendarDays,  MiniCalendarNavigation,} from '@/components/redpanda-ui/mini-calendar';
tsx
<MiniCalendar>  <MiniCalendarNavigation direction="prev" />  <MiniCalendarDays>{(date) => <MiniCalendarDay date={date} key={date.toISOString()} />}</MiniCalendarDays>  <MiniCalendarNavigation direction="next" /></MiniCalendar>

Date-action behavior

MiniCalendarDay owns its month/day label, selected and today appearance, focus feedback, and loading treatment. It supports native button attributes, refs, render, nativeButton, focusableWhenDisabled, disabled, isLoading, and testId. The default native type is button, so selecting a date does not submit an enclosing form. Loading keeps the date’s accessible name, marks it busy, and prevents selection.

The day action does not accept general Button variant, size, weight, shape, icon, navigation aliases, className, style, or replacement children. Put layout spacing on a containing element. Control selection with MiniCalendar’s value, defaultValue, and onValueChange, rather than setting aria-pressed yourself. MiniCalendarNavigation remains an ordinary Button-based navigation control; custom render elements keep their existing appearance API and should provide an accessible name when they contain only an icon.

A day action calls a supplied onClick before changing the selected date. Use event.preventDefault() or event.preventBaseUIHandler() to cancel selection. An ordinary click handler no longer replaces the internal selection handler:

tsx
<MiniCalendarDay  date={date}  onClick={(event) => {    if (!canSelectDate(date)) {      event.preventDefault();    }  }}/>

Credits

  • We take our inspiration from Kibo UI for the mini calendar component and style.

Recent changes

  • patchv1.2.0Pin shipped dependency floors to the version we develop against. Registry items now declare ranges like `^5.1.9` (the actual installed version) instead of collapsing to `^5.0.0`, so consumers start on the known-tested baseline while caret semantics still allow any compatible release within the same major.#133
  • minorv1.1.0Theme docs refresh, readability pass on semantic foregrounds, and consumer-facing Base UI regression fixes.#121
  • minorv1.0.0Post-Base-UI polish. Public API unchanged.#116
  • majorv1.0.0Migrate every Radix-based primitive to `@base-ui/react@^1.4.0` (Base UI).#114
  • minorv0.3.0Add theme-provider component to the registry with documentation and tests. Includes playground type improvements (export RegistryItem, remove as-const boilerplate) and docs site dark mode border color fix.#109
See full history →

Last updated on

Was this page helpful?