Skip to content
h v3.13.3
Search the docs
Find a component, section or page.

Calendar

A calendar component that allows users to select a date or a range of dates.

MoTuWeThFrSaSu
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6

Installation

pnpm add @heyramzi/ui bits-ui

Usage

import { Calendar } from "@heyramzi/ui/shadcn/calendar";
<Calendar type="single" bind:value captionLayout="dropdown" />

Keyboard and accessibility

Key Does
Arrow Left Moves to the previous day.
Arrow Right Moves to the next day.
Arrow Up Moves to the same day a week earlier.
Arrow Down Moves to the same day a week later.
Space Enter Picks the focused day.
  • Moving past the first or last day turns the month.
  • Weeks start on Monday unless you pass weekStartsOn.
  • The previous and next month buttons are their own Tab stops.

API reference

Day

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.Day from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.Day from bits-ui

Calendar

buttonVariant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed"
Default "ghost"
captionLayout "dropdown" | "dropdown-months" | "dropdown-years" | "label"
Default "label"
months CalendarPrimitive.MonthSelectProps["months"]
years CalendarPrimitive.YearSelectProps["years"]
monthFormat CalendarPrimitive.MonthSelectProps["monthFormat"]
yearFormat CalendarPrimitive.YearSelectProps["yearFormat"]
Default "numeric"
day Snippet<[{ day: DateValue; outsideMonth: boolean }]>
ref bindable HTMLElement | null
Default null
value bindable Calendar.Root
placeholder bindable Calendar.Root
class string
weekdayFormat string
Default "short"
locale string
Default "en-US"
disableDaysOutsideMonth boolean
Default false
weekStartsOn number
Default 1
fixedWeeks boolean
Default true
...rest
Every prop of Calendar.Root from bits-ui except child, children
Prop Type Default
buttonVariant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed" "ghost"
captionLayout "dropdown" | "dropdown-months" | "dropdown-years" | "label" "label"
months CalendarPrimitive.MonthSelectProps["months"]
years CalendarPrimitive.YearSelectProps["years"]
monthFormat CalendarPrimitive.MonthSelectProps["monthFormat"]
yearFormat CalendarPrimitive.YearSelectProps["yearFormat"] "numeric"
day Snippet<[{ day: DateValue; outsideMonth: boolean }]>
ref bindable HTMLElement | null null
value bindable Calendar.Root
placeholder bindable Calendar.Root
class string
weekdayFormat string "short"
locale string "en-US"
disableDaysOutsideMonth boolean false
weekStartsOn number 1
fixedWeeks boolean true
...rest Every prop of Calendar.Root from bits-ui except child, children

Cell

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.Cell from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.Cell from bits-ui

Grid

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.Grid from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.Grid from bits-ui

Header

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.Header from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.Header from bits-ui

Months

ref bindable HTMLDivElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements
Prop Type Default
ref bindable HTMLDivElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLDivElement> from svelte/elements

GridRow

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.GridRow from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.GridRow from bits-ui

Heading

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.Heading from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.Heading from bits-ui

GridBody

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.GridBody from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.GridBody from bits-ui

GridHead

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.GridHead from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.GridHead from bits-ui

HeadCell

ref bindable HTMLElement | null
Default null
class string
...rest
Every prop of Calendar.HeadCell from bits-ui
Prop Type Default
ref bindable HTMLElement | null null
class string
...rest Every prop of Calendar.HeadCell from bits-ui

NextButton

variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed"
Default "ghost"
ref bindable HTMLElement | null
Default null
class string
children Snippet
...rest
Every prop of Calendar.NextButton from bits-ui
Prop Type Default
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed" "ghost"
ref bindable HTMLElement | null null
class string
children Snippet
...rest Every prop of Calendar.NextButton from bits-ui

PrevButton

variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed"
Default "ghost"
ref bindable HTMLElement | null
Default null
class string
children Snippet
...rest
Every prop of Calendar.PrevButton from bits-ui
Prop Type Default
variant "default" | "outline" | "ghost" | "destructive" | "text" | "dashed" "ghost"
ref bindable HTMLElement | null null
class string
children Snippet
...rest Every prop of Calendar.PrevButton from bits-ui

Nav

ref bindable HTMLElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLElement> from svelte/elements
Prop Type Default
ref bindable HTMLElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLElement> from svelte/elements

Month

ref bindable HTMLElement | null
Default null
class string
children Snippet
...rest
Every prop of HTMLAttributes<HTMLElement> from svelte/elements
Prop Type Default
ref bindable HTMLElement | null null
class string
children Snippet
...rest Every prop of HTMLAttributes<HTMLElement> from svelte/elements

YearSelect

ref bindable HTMLElement | null
Default null
class string
value Calendar.YearSelect
...rest
Every prop of Calendar.YearSelect from bits-ui except child, children
Prop Type Default
ref bindable HTMLElement | null null
class string
value Calendar.YearSelect
...rest Every prop of Calendar.YearSelect from bits-ui except child, children

MonthSelect

ref bindable HTMLElement | null
Default null
class string
value Calendar.MonthSelect
onchange Calendar.MonthSelect
...rest
Every prop of Calendar.MonthSelect from bits-ui except child, children
Prop Type Default
ref bindable HTMLElement | null null
class string
value Calendar.MonthSelect
onchange Calendar.MonthSelect
...rest Every prop of Calendar.MonthSelect from bits-ui except child, children

Caption

captionLayout required ComponentProps<typeof Calendar>["captionLayout"]
months required ComponentProps<typeof CalendarMonthSelect>["months"]
monthFormat required ComponentProps<typeof CalendarMonthSelect>["monthFormat"]
years required ComponentProps<typeof CalendarYearSelect>["years"]
yearFormat required ComponentProps<typeof CalendarYearSelect>["yearFormat"]
month required DateValue
placeholder required bindable DateValue | undefined
locale required string
monthIndex number
Default 0
Prop Type Default
captionLayout required ComponentProps<typeof Calendar>["captionLayout"]
months required ComponentProps<typeof CalendarMonthSelect>["months"]
monthFormat required ComponentProps<typeof CalendarMonthSelect>["monthFormat"]
years required ComponentProps<typeof CalendarYearSelect>["years"]
yearFormat required ComponentProps<typeof CalendarYearSelect>["yearFormat"]
month required DateValue
placeholder required bindable DateValue | undefined
locale required string
monthIndex number 0