Knit UI
GitHub

Playground

Loading playground…

true
true
false
Playground
<DecadeLevel
  decade="2024-01-01"
  size="md"
  withNext
  withPrevious
  fullWidth={false}
  previousLabel="Previous decade"
  nextLabel="Next decade"
  levelControlAriaLabel="Decade"
/>

Examples

Default

The default decade level (header + the 3/3/3/1 year grid).

Loading example…

DefaultSourceStorybook

Custom Label

A two-arg decadeLabelFormat function overrides the start – end label.

Loading example…

Custom LabelSourceStorybook

Bounded

Bounded — minDate/maxDate auto-disable the prev/next controls at the edges.

Loading example…

BoundedSourceStorybook

Full Width

Full-width level — the header and grid fill the container.

Loading example…

Full WidthSourceStorybook

Styled Parts

Per-slot styles sugar — round the header controls and recolor the label.

Loading example…

Styled PartsSourceStorybook

Sizes

Every size from the shared xxs…xxl cell-metrics ladder.

Loading example…

SizesSourceStorybook

Props

PropTypeDefaultDescription
decade requiredstring2024-01-01A date within the displayed decade (`YYYY-MM-DD`).
decadeLabelFormatDecadeLabelFormat | undefined'YYYY'dayjs format for the decade label, or a function returning it.
disabled systemboolean | undefined
fullWidth systemboolean | undefinedfalseTake the full width of the container.
getYearControlProps((date: DateStringValue) => Partial<PickerControlProps>) | undefinedPasses props down to each year `PickerControl`, keyed by date (wins over `styles.control`).
headerControlsOrderCalendarHeaderControlName[] | undefined['previous', 'level', 'next']Order in which the controls are rendered.
levelControlAriaLabelstring | undefinedDecadeLevel control `aria-label`.
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.
nextDisabledboolean | undefinedfalseDisables the next control.
nextIconReactNodeReplace the next-button icon.
nextLabelstring | undefinedNext decadeNext button `aria-label`.
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 decadePrevious button `aria-label`.
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 header controls and year cells.
styles systemSlotStyles<DecadeLevelStyles> | undefinedPer-slot style sugar — props spread onto the matching part (header + grid).
theme systemThemeName | null | undefinedApplies a theme to this element
withCellSpacingboolean | undefinedtrueSeparate controls/rows with spacing.
withNextboolean | undefinedtrueRender the next control.
withPreviousboolean | undefinedtrueRender the previous control.
yearsListFormatstring | undefined'YYYY'dayjs format for the year labels.

Style slots

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

SlotUsage
headerstyles={{ header: { … } }}
headerControlstyles={{ headerControl: { … } }}
headerIconstyles={{ headerIcon: { … } }}
headerLevelstyles={{ headerLevel: { … } }}
headerLevelLabelstyles={{ headerLevelLabel: { … } }}
liststyles={{ list: { … } }}
rootstyles={{ root: { … } }}
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.