Knit UI
GitHub

Playground

Loading playground…

true
true
true
false
false
false
Playground
<CalendarHeader
  label="March 2024"
  size="md"
  hasNextLevel
  withNext
  withPrevious
  nextDisabled={false}
  previousDisabled={false}
  fullWidth={false}
  previousLabel="Previous"
  nextLabel="Next"
  levelControlAriaLabel="Change level"
/>

Examples

Default

The default month-level header (previous / level / next, all interactive).

Loading example…

DefaultSourceStorybook

Top Level

Topmost level — the level control is a static, dimmed, non-interactive label.

Loading example…

Top LevelSourceStorybook

Disabled Control

Bounded — the previous control is disabled (e.g. at minDate).

Loading example…

Disabled ControlSourceStorybook

Full Width

Full-width header — the bar (and its level control) fill the container.

Loading example…

Full WidthSourceStorybook

Custom Icons

Custom previous/next icons replace the default chevron glyphs.

Loading example…

Custom IconsSourceStorybook

Reordered Controls

Reordered controls — level first, then previous / next.

Loading example…

Reordered ControlsSourceStorybook

Styled Parts

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

Loading example…

Styled PartsSourceStorybook

Sizes

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

Loading example…

SizesSourceStorybook

Props

PropTypeDefaultDescription
label requiredReactNodeMarch 2024Label between the previous and next buttons.
disabled systemboolean | undefined——
fullWidth systemboolean | undefinedfalseTake the full width of the container.
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 | undefinedChange levelLevel control `aria-label`.
nextDisabledboolean | undefinedfalseDisable the next control.
nextIconReactNode—Replace the next-button icon.
nextLabelstring | undefinedNextNext button `aria-label`.
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 | undefinedfalseDisable the previous control.
previousIconReactNode—Replace the previous-button icon.
previousLabelstring | undefinedPreviousPrevious 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.
styles systemSlotStyles<CalendarHeaderStyles> | undefined—Per-slot style sugar — props spread onto the matching styled part.
theme systemThemeName | null | undefined—Applies a theme to this element
withNextboolean | undefinedtrueRender the next control.
withPreviousboolean | undefinedtrueRender the previous control.

Style slots

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

SlotTargets
controlProps for each prev/next control button (.Control).
iconProps for the default chevron glyphs (.Icon).
levelProps for the level (label) control (.Level).
levelLabelProps for the level label text (.LevelLabel).
rootProps for the header bar (.Frame).
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.

Edit this page on GitHub