| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, Portal } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerBasic = () => {
return (
<DatePicker.Root maxWidth="20rem">
<DatePicker.Label>Date of birth</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Anatomy
import { DatePicker } from '@chakra-ui/react'<DatePicker.Root>
<DatePicker.Label />
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger />
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>Date values are represented by objects from
@internationalized/date,
which handle timezone-safe, locale-aware date math. The parseDate helper and
the DateValue type are re-exported from @chakra-ui/react, so you don't need
to install the package yourself.
import { parseDate } from '@chakra-ui/react'
import type { DateValue } from '@chakra-ui/react'Examples
Basic
Compose DatePicker.Input with a DatePicker.Trigger to render a text input
that opens a calendar popover.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, Portal } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerBasic = () => {
return (
<DatePicker.Root maxWidth="20rem">
<DatePicker.Label>Date of birth</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Sizes
Use the size prop to change the size of the date picker.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, For, Portal, Stack } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerWithSizes = () => {
return (
<Stack gap={4} maxWidth="20rem">
<For each={["xs", "sm", "md", "lg", "xl"]}>
{(size) => (
<DatePicker.Root key={size} size={size}>
<DatePicker.Label>Select date - {size}</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)}
</For>
</Stack>
)
}
Variants
Use the variant prop to change the visual style of the date picker.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, For, Portal, Stack } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerWithVariants = () => {
return (
<Stack gap={4} maxWidth="20rem">
<For each={["outline", "subtle", "flushed"]}>
{(variant) => (
<DatePicker.Root key={variant} variant={variant}>
<DatePicker.Label>Select date - {variant}</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)}
</For>
</Stack>
)
}
Controlled
Use the value and onValueChange props to control the selected date. The
value is always an array of DateValue objects, even in single selection mode.
Selected: 2026-01-26
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import type { DateValue } from "@chakra-ui/react"
import { DatePicker, Portal, Stack, Text, parseDate } from "@chakra-ui/react"
import { useState } from "react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerControlled = () => {
const [value, setValue] = useState<DateValue[]>([parseDate("2026-01-26")])
return (
<Stack gap={4} maxWidth="20rem">
<Text textStyle="sm">
Selected: {value.map((d) => d.toString()).join(", ")}
</Text>
<DatePicker.Root value={value} onValueChange={(e) => setValue(e.value)}>
<DatePicker.Label>Date of birth</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
</Stack>
)
}
Range Selection
Set the selectionMode prop to "range" to allow selecting a start and end
date. Render two DatePicker.Input components and pass the index prop to bind
each one to a side of the range.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, Portal } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerRangeSelection = () => {
return (
<DatePicker.Root selectionMode="range" maxWidth="20rem">
<DatePicker.Label>Select range</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input index={0} />
<DatePicker.Input index={1} />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Min and Max
Use the min and max props to restrict date selection to a specific range.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
23 | 24 | 25 | 26 | 27 | 28 | 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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, Portal, parseDate } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerMinMax = () => {
return (
<DatePicker.Root
min={parseDate("2025-03-05")}
max={parseDate("2025-03-31")}
maxWidth="20rem"
>
<DatePicker.Label>Date of creation</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Clear Trigger
Use DatePicker.Context to swap the trigger for a DatePicker.ClearTrigger
once a date has been selected.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker, Portal } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerWithClear = () => {
return (
<DatePicker.Root maxWidth="20rem">
<DatePicker.Label>Date of birth</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
<DatePicker.IndicatorGroup>
<DatePicker.Context>
{(context) =>
context.value.length ? (
<DatePicker.ClearTrigger />
) : (
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
)
}
</DatePicker.Context>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Presets
Render the DatePicker.PresetTrigger component to provide quick date selection
options like "Last 7 days" or "This month" next to the calendar.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { Button, DatePicker, Flex, Portal, VStack } from "@chakra-ui/react"
import { LuCalendar } from "react-icons/lu"
export const DatePickerPresets = () => {
return (
<DatePicker.Root selectionMode="range" maxWidth="32rem">
<DatePicker.Label>Select range</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input index={0} />
<DatePicker.Input index={1} />
<DatePicker.IndicatorGroup>
<DatePicker.Trigger>
<LuCalendar />
</DatePicker.Trigger>
</DatePicker.IndicatorGroup>
</DatePicker.Control>
<Portal>
<DatePicker.Positioner>
<DatePicker.Content maxW="100dvw" w="fit-content" overflow="auto">
<Flex
px={{ base: "3", sm: "4" }}
py={{ base: "3", sm: "4" }}
gap={{ base: "3", sm: "6" }}
flexDirection={{ base: "column", sm: "row" }}
>
<VStack
align="stretch"
gap={{ base: "1.5", sm: "2" }}
minW={{ base: "full", sm: "140px" }}
height="100%"
>
<DatePicker.PresetTrigger value="last7Days" asChild>
<Button variant="surface" size="sm" width="100%">
Last 7 days
</Button>
</DatePicker.PresetTrigger>
<DatePicker.PresetTrigger value="last30Days" asChild>
<Button variant="surface" size="sm" width="100%">
Last 30 days
</Button>
</DatePicker.PresetTrigger>
<DatePicker.PresetTrigger value="thisMonth" asChild>
<Button variant="surface" size="sm" width="100%">
This month
</Button>
</DatePicker.PresetTrigger>
<DatePicker.PresetTrigger value="lastMonth" asChild>
<Button variant="surface" size="sm" width="100%">
Last month
</Button>
</DatePicker.PresetTrigger>
<DatePicker.PresetTrigger value="thisYear" asChild>
<Button variant="surface" size="sm" width="100%">
This year
</Button>
</DatePicker.PresetTrigger>
<DatePicker.PresetTrigger value="lastYear" asChild>
<Button variant="surface" size="sm" width="100%">
Last year
</Button>
</DatePicker.PresetTrigger>
</VStack>
<Flex direction="column" flex="1" minW={0}>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</Flex>
</Flex>
</DatePicker.Content>
</DatePicker.Positioner>
</Portal>
</DatePicker.Root>
)
}
Calendar
Set the inline prop on DatePicker.Root to render the calendar directly on
the page, without the input, positioner and popup content. Use this when the
calendar is the main interface, like a booking or scheduling view.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker } from "@chakra-ui/react"
export const DatePickerCalendarBasic = () => {
return (
<DatePicker.Root inline width="fit-content">
<DatePicker.Content unstyled>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Root>
)
}
Inline calendars support every selection mode. Set selectionMode to "range"
to let people pick a start and end date without opening a popup.
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
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 | 31 | 1 | 2 | 3 | 4 | 5 |
Jan | Feb | Mar | Apr |
May | Jun | Jul | Aug |
Sep | Oct | Nov | Dec |
2020 | 2021 | 2022 | 2023 |
2024 | 2025 | 2026 | 2027 |
2028 | 2029 |
"use client"
import { DatePicker } from "@chakra-ui/react"
export const DatePickerCalendarRangeSelection = () => {
return (
<DatePicker.Root inline selectionMode="range" width="fit-content">
<DatePicker.Content unstyled>
<DatePicker.View view="day">
<DatePicker.Header />
<DatePicker.DayTable />
</DatePicker.View>
<DatePicker.View view="month">
<DatePicker.Header />
<DatePicker.MonthTable />
</DatePicker.View>
<DatePicker.View view="year">
<DatePicker.Header />
<DatePicker.YearTable />
</DatePicker.View>
</DatePicker.Content>
</DatePicker.Root>
)
}
Date Input
Render only DatePicker.Control with a DatePicker.Input to get a date field
without a calendar popup. Use this when people already know the date they want
and typing it is faster than picking it, for example a date of birth.
"use client"
import { DatePicker } from "@chakra-ui/react"
export const DatePickerInputOnly = () => {
return (
<DatePicker.Root maxWidth="20rem">
<DatePicker.Label>Date of birth</DatePicker.Label>
<DatePicker.Control>
<DatePicker.Input />
</DatePicker.Control>
</DatePicker.Root>
)
}
Props
Root
| Prop | Default | Type |
|---|---|---|
closeOnSelect | true | booleanWhether the calendar should close after the date selection is complete. This is ignored when the selection mode is `multiple`. |
defaultView | '\'day\'' | DateViewThe default view of the calendar |
hideMode | ''display-none'' | HideModeHow to hide content when mounted but not present. - `'display-none'`: HTML `hidden` attribute. Effects stay alive. - `'activity'`: React 19 `<Activity mode="hidden">`. Effects pause. Requires React 19+. |
lazyMount | false | booleanWhether to enable lazy mounting |
locale | '\'en-US\'' | stringThe locale (BCP 47 language tag) to use when formatting the date. |
maxView | '\'year\'' | DateViewThe maximum view of the calendar |
minView | '\'day\'' | DateViewThe minimum view of the calendar |
openOnClick | false | booleanWhether to open the calendar when the input is clicked. |
outsideDaySelectable | false | booleanWhether day outside the visible range can be selected. |
selectionMode | '\'single\'' | SelectionModeThe selection mode of the calendar. - `single` - only one date can be selected - `multiple` - multiple dates can be selected - `range` - a range of dates can be selected |
skipAnimationOnMount | false | booleanWhether to allow the initial presence animation. |
timeZone | '\'UTC\'' | stringThe time zone to use |
unmountOnExit | false | booleanWhether to unmount on exit. |
colorPalette | 'gray' | 'base' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'red' | 'orange' | 'amber' | 'yellow' | 'lime' | 'green' | 'emerald' | 'teal' | 'cyan' | 'sky' | 'blue' | 'indigo' | 'violet' | 'purple' | 'fuchsia' | 'pink' | 'rose' | 'sidebar' | 'sidebar.accent' | 'interaction' | 'accent' | 'presence' | 'status' | 'slate'The color palette of the component |
size | 'md' | 'xs' | 'sm' | 'md' | 'lg' | 'xl'The size of the component |
variant | 'outline' | 'outline' | 'subtle' | 'flushed'The variant of the component |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
createCalendar | (identifier: CalendarIdentifier) => CalendarA function that creates a Calendar object for a given calendar identifier. Enables non-Gregorian calendar support (Persian, Buddhist, Islamic, etc.) without bundling all calendars by default. | |
defaultFocusedValue | DateValueThe initial focused date when rendered. Use when you don't need to control the focused date of the date picker. | |
defaultOpen | booleanThe initial open state of the date picker when rendered. Use when you don't need to control the open state of the date picker. | |
defaultValue | DateValue[]The initial selected date(s) when rendered. Use when you don't need to control the selected date(s) of the date picker. | |
disabled | booleanWhether the calendar is disabled. | |
fixedWeeks | booleanWhether the calendar should have a fixed number of weeks. This renders the calendar with 6 weeks instead of 5 or 6. | |
focusedValue | DateValueThe controlled focused date. | |
format | (date: DateValue, details: LocaleDetails) => stringThe format of the date to display in the input. | |
id | stringThe unique identifier of the machine. | |
ids | Partial<{ root: string; label: (index: number) => string; table: (id: string) => string; tableHeader: (id: string) => string; tableBody: (id: string) => string; tableRow: (id: string) => string; content: string; ... 10 more ...; positioner: string; }>The ids of the elements in the date picker. Useful for composition. | |
immediate | booleanWhether to synchronize the present change immediately or defer it to the next frame | |
inline | booleanWhether to render the date picker inline | |
invalid | booleanWhether the date picker is invalid | |
isDateUnavailable | (date: DateValue, locale: string) => booleanReturns whether a date of the calendar is available. | |
max | DateValueThe maximum date that can be selected. | |
maxSelectedDates | numberThe maximum number of dates that can be selected. This is only applicable when `selectionMode` is `multiple`. | |
min | DateValueThe minimum date that can be selected. | |
name | stringThe `name` attribute of the input element. | |
numOfMonths | numberThe number of months to display. | |
onExitComplete | VoidFunctionFunction called when the animation ends in the closed state | |
onFocusChange | (details: FocusChangeDetails) => voidFunction called when the focused date changes. | |
onOpenChange | (details: OpenChangeDetails) => voidFunction called when the calendar opens or closes. | |
onValueChange | (details: ValueChangeDetails) => voidFunction called when the value changes. | |
onViewChange | (details: ViewChangeDetails) => voidFunction called when the view changes. | |
onVisibleRangeChange | (details: VisibleRangeChangeDetails) => voidFunction called when the visible range changes. | |
open | booleanThe controlled open state of the date picker | |
parse | (value: string, details: LocaleDetails) => DateValue | undefinedFunction to parse the date from the input back to a DateValue. | |
placeholder | stringThe placeholder text to display in the input. | |
positioning | PositioningOptionsThe user provided options used to position the date picker content | |
present | booleanWhether the node is present (controlled by the user) | |
readOnly | booleanWhether the calendar is read-only. | |
required | booleanWhether the date picker is required | |
showWeekNumbers | booleanWhether to show the week number column in the day view. | |
startOfWeek | numberThe first day of the week. `0` - Sunday `1` - Monday `2` - Tuesday `3` - Wednesday `4` - Thursday `5` - Friday `6` - Saturday | |
translations | IntlTranslationsThe localized messages to use. | |
value | DateValue[]The controlled selected date(s). | |
view | DateViewThe view of the calendar | |
hideOutsideDays | 'true' | 'false'The hideOutsideDays of the component |
Input
| Prop | Default | Type |
|---|---|---|
fixOnBlur | true | booleanWhether to fix the input value on blur. |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
index | numberThe index of the input to focus. |
View
| Prop | Default | Type |
|---|---|---|
view * | DateView | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |
TableCell
| Prop | Default | Type |
|---|---|---|
value * | number | DateValue | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. | |
columns | number | |
disabled | boolean | |
visibleRange | VisibleRange |
PresetTrigger
| Prop | Default | Type |
|---|---|---|
value * | PresetTriggerValue | |
asChild | booleanUse the provided child element as the default rendered element, combining their props and behavior. For more details, read our Composition guide. |