Knit UI
GitHub

Playground

Loading playground…

true
false
Playground
<YearsList
  decade="2024-01-01"
  size="md"
  withCellSpacing
  fullWidth={false}
  yearsListFormat="YYYY"
/>

Examples

Default

Default year grid with a selected year.

Loading example…

DefaultSourceStorybook

Custom Format

Custom label format — two-digit years.

Loading example…

Custom FormatSourceStorybook

Bounded

Bounded — years outside [minDate, maxDate] are disabled.

Loading example…

BoundedSourceStorybook

Full Width

Full-width grid stretched to its container's width (controls share each row equally).

Loading example…

Full WidthSourceStorybook

Full Width Filled

fullWidth fills BOTH axes — in a fixed-height box the rows distribute the height and the controls grow taller.

Loading example…

Full Width FilledSourceStorybook

Styled Slots

Per-slot styles sugar — recolour every control via the control slot.

Loading example…

Styled SlotsSourceStorybook

Sizes

Every size token.

Loading example…

SizesSourceStorybook

Props

PropTypeDefaultDescription
decade requiredstring2024-01-01Decade for which the years list is displayed, any date within it (`YYYY-MM-DD`).
disabled systemboolean | undefined
fullWidth systemboolean | undefinedfalseStretch the grid to its container width.
getYearControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefinedPasses props down to each year `PickerControl`, keyed by date (wins over `styles.control`).
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.
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
size systemCalendarSize | undefined
xxs · xs · sm · md · lg · xl · xxl
'md'Width/font of the controls.
styles systemSlotStyles<YearsListStyles> | undefinedPer-slot style sugar — props spread onto the matching styled part. Lives on `YearsListProps` (not the inherited `YearsListSettings`) so the `styles` shape does not flow up the shared Calendar settings chain and collide with sibling components' own `styles` props.
theme systemThemeName | null | undefinedApplies a theme to this element
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
yearsListFormatstring | undefined'YYYY'dayjs format for the year labels.

Style slots

Every part of YearsList can be styled through the styles prop. Explicit props on the component always win over slot styles.

SlotUsage
cellstyles={{ cell: { … } }}
controlstyles={{ control: { … } }}
rootstyles={{ root: { … } }}
rowstyles={{ row: { … } }}
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiElement> | undefined

Plus 498 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.