Componentpickers1.07 KB gzipZero dependencies

MonthPicker

12-month grid for selecting a month with year navigation

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add month-picker

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { MonthPicker } from "@/components/ui/month-picker"; <MonthPicker defaultValue={new Date().getMonth()} onValueChange={(v) => {}} />

Source code

month-picker.tsx + 1 helper

Zero third-party dependencies (2 local files shown in tabs below).

tsxmonth-picker.tsx130 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface MonthPickerProps extends Omit<React.HTMLAttributes<HTMLElement>, "value" | "defaultValue"> {  value?: number; // 0-11  defaultValue?: number;  onValueChange?: (value: number) => void;  year?: number;  onYearChange?: (year: number) => void;  className?: string;} const MONTHS = [  "JANUARY", "FEBRUARY", "MARCH", "APRIL", "MAY", "JUNE",  "JULY", "AUGUST", "SEPTEMBER", "OCTOBER", "NOVEMBER", "DECEMBER",];

Props

Interactive Prop Playground

Tweak parsed AST props below to generate ready-to-paste JSX.

tsx3 lines
import { MonthPicker } from "@/components/ui/month-picker"; <MonthPicker />
PropTypeDescription
valuenumberControlled value.
defaultValuenumberInitial value when uncontrolled.
onValueChange(value: number) => voidCallback invoked on value change.
yearnumberConfigures year.
onYearChange(year: number) => voidCallback invoked on year change.
classNamestringOptional Tailwind or custom CSS classes merged with component styles.