Knit UI
GitHub

Playground

Loading playground…

Playground
<YearPicker />

Examples

Default

Single year selection.

Loading example…

DefaultSourceStorybook

Range

Range of years (type="range").

Loading example…

RangeSourceStorybook

Multiple

Multiple years toggled into an array.

Loading example…

MultipleSourceStorybook

Props

PropTypeDefaultDescription
allowDeselect(Type extends "default" ? boolean : never) | undefined—Whether the user can deselect a date by clicking it again — `type="default"` only.
allowSingleDateInRange(Type extends "range" ? boolean : never) | undefined—Whether a single day can be selected as a range — `type="range"` only.
ariaLabelsCalendarAriaLabels | undefined—`aria-label`s for the controls on the different levels.
columnsToScrollnumber | undefined`numberOfColumns`Number of columns to scroll with the next/prev buttons.
datestring | Date | undefined—Displayed date in controlled mode.
decadeLabelFormatDecadeLabelFormat | undefined'YYYY'dayjs format for the decade label, or a function returning it.
defaultDatestring | Date | undefined—Initial displayed date in uncontrolled mode.
defaultValueDatePickerValue<Type, DateValue> | undefined—Default value for uncontrolled component.
disabled systemboolean | undefined——
fullWidth systemboolean | undefinedfalseStretch the list (and its controls) to the full width of its container.
getYearControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefined—Passes props down to each year `PickerControl`, keyed by date (wins over `styles.control`).
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.
nextLabelstring | undefined—Next-button `aria-label`.
numberOfColumnsnumber | undefined1Number of columns displayed next to each other.
onChange((value: DatePickerValue<Type, string>) => void) | undefined—Called when value changes.
onDateChange((date: DateStringValue) => void) | undefined—Called when the displayed date changes.
onMouseLeave((event: unknown) => void) | undefined—Called when the pointer leaves the calendar root (web hover; used by range pickers to clear the hover preview). Cross-platform — the event type is opaque, never a DOM event; Tamagui no-ops it on native.
onNextDecade((date: DateStringValue) => void) | undefined—Called when the next-decade button is clicked.
onPreviousDecade((date: DateStringValue) => void) | undefined—Called when the previous-decade button is clicked.
onYearSelect((date: DateStringValue) => void) | undefined—Called when a year is selected.
presetsYearPickerPreset<Type>[] | undefined—Predefined values to pick from.
previousLabelstring | undefined—Previous-button `aria-label`.
refRef<TamaguiElement> | undefined——
shadow system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined——
size systemCalendarSize | undefined'md'Width/font of the controls.
theme systemThemeName | null | undefined—Applies a theme to this element
typeDatePickerType | Type | undefined—Picker type: `range`, `multiple` or `default`.
valueDatePickerValue<Type, DateValue> | undefined—Value for controlled component.
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
yearsListFormatstring | undefined'YYYY'dayjs format for the year labels.

Plus 495 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