Skip to content

Early previewhamur is not on npm yet. The components are being built in the open, follow along on GitHub.

UIComponentsReact

Month Picker

A field the reader types a month into, with a button that opens a month calendar in a popup to pick it from.

Built on the headless Month Picker.See its API in Docs

Rendered by React 19.3.1

month-picker.tsx

Installation

npx shadcn@4.23.0 add https://hamur.dev/r/react/month-picker.json

It also adds utils, button, month-calendar, popover. The app needs its setup first: Installation.

Usage

The parts are the Date Picker's for a month: MonthPicker holds a MonthPickerControl with MonthPickerInput, MonthPickerClear and MonthPickerTrigger, and a MonthPickerPortal with a MonthPickerPositioner, a MonthPickerPopup and a MonthPickerCalendar. Name the control (aria-label, or a Field label around the picker). MonthPickerPreset sets a month from a function of the current month and MonthPickerClose closes the popup. The value is a '2026-11' string; min, max, isMonthDisabled, isMonthUnavailable, locale, visibleYears, closeOnSelect and the rest are the headless Month Picker's Root props.

import {
  MonthPicker,
  MonthPickerCalendar,
  MonthPickerClear,
  MonthPickerClose,
  MonthPickerControl,
  MonthPickerInput,
  MonthPickerPopup,
  MonthPickerPortal,
  MonthPickerPositioner,
  MonthPickerPreset,
  MonthPickerSegment,
  MonthPickerTrigger,
} from '@/components/ui/month-picker'

Examples

Default

An input with the clear and calendar buttons beside it.

Its preview and code are at the top of the page.

shadcn has no month picker. This item follows the Date Picker's composition with the Month Calendar's markup in the popup, so it differs from shadcn's date picker page in the same places. The calendar in the popup has no box of its own, since the popup draws it.

API reference

The styled parts pass every prop to the headless part they wrap and add classes. The props, data attributes and keyboard are on Month Picker's API reference.