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>) | undefined—Passes 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) | undefined—Level control `aria-label`, or a function resolving it from each panel's year.
localestring | undefined—dayjs locale; falls back to the value defined in `DatesProvider`.
maxDatestring | Date | undefined—Maximum possible date in `YYYY-MM-DD` format or a `Date` object.
minDatestring | Date | undefined—Minimum 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.
nextIconReactNode—Replace the next-button icon.
nextLabelstring | undefined—Next button `aria-label`.
numberOfColumnsnumber | undefined1Number of year panels to display next to each other.
onLevelClick(() => void) | undefined—Called when the level button is pressed.
onNext(() => void) | undefined—Called when the next button is pressed.
onPrevious(() => void) | undefined—Called when the previous button is pressed.
previousDisabledboolean | undefinedfalseDisables the previous control.
previousIconReactNode—Replace the previous-button icon.
previousLabelstring | undefined—Previous 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 | undefined—Applies 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.

Edit this page on GitHub