Knit UI
GitHub

Playground

Loading playground…

Playground
<YearLevelGroup
  year="2024-03-15"
/>

Examples

Default

A single year panel (the default).

Loading example…

DefaultSourceStorybook

Two Columns

Two years side by side — one year apart, edge-only navigation controls.

Loading example…

Two ColumnsSourceStorybook

Large

Larger cells via the shared size ladder.

Loading example…

LargeSourceStorybook

Full Width

Stretched to the full width of its container.

Loading example…

Full WidthSourceStorybook

Custom Label Format

A custom year label format via dayjs tokens.

Loading example…

Custom Label FormatSourceStorybook

Bounded

Bounded by minDate/maxDate: the previous/next controls disable at the bounds and out-of-range month cells are disabled (delegated to MonthsList).

Loading example…

BoundedSourceStorybook

Per Month Props

Per-month customization via getMonthControlProps — the "explicit per-item beats sugar" callback (#7), forwarded to every panel. Here it disables June.

Loading example…

Per Month PropsSourceStorybook

Props

PropTypeDefaultDescription
year requiredstring2024-03-15Year of the first (left-most) panel, any date within it (`YYYY-MM-DD`).
disabled systemboolean | undefined
fullWidth systemboolean | undefinedfalseStretch the group (and its panels) to the full width of its container.
getMonthControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefinedPasses props down to each month `PickerControl`, keyed by date (wins over `styles.control`).
hasNextLevelboolean | undefinedtrueWhether the level button can zoom out to the next level.
headerControlsOrderCalendarHeaderControlName[] | undefined['previous', 'level', 'next']Order in which the controls are rendered.
levelControlAriaLabelstring | ((year: DateStringValue) => string) | undefinedLevel control `aria-label`, or a function resolving it from each panel's year.
localestring | undefineddayjs locale; falls back to the value defined in `DatesProvider`.
maxDatestring | Date | undefinedMaximum possible date in `YYYY-MM-DD` format or a `Date` object.
minDatestring | Date | undefinedMinimum possible date in `YYYY-MM-DD` format or a `Date` object.
monthsListFormatstring | undefined'MMM'dayjs format for the month labels.
nextDisabledboolean | undefinedfalseDisables the next control.
nextIconReactNodeReplace the next-button icon.
nextLabelstring | undefinedNext button `aria-label`.
numberOfColumnsnumber | undefined1Number of year panels to display next to each other.
onLevelClick(() => void) | undefinedCalled when the level button is pressed.
onNext(() => void) | undefinedCalled when the next button is pressed.
onPrevious(() => void) | undefinedCalled when the previous button is pressed.
previousDisabledboolean | undefinedfalseDisables the previous control.
previousIconReactNodeReplace the previous-button icon.
previousLabelstring | undefinedPrevious button `aria-label`.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
size systemCalendarSize | undefined'md'Width/font of the header controls and month cells.
theme systemThemeName | null | undefinedApplies a theme to this element
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
yearLabelFormatDateLabelFormat | undefined'YYYY'dayjs format for the year label, or a function returning it.
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 497 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.