Date picker
A date you can type, or pick from a calendar that opens under it.
A date you can type, or pick from a calendar that opens under it.
npm install @heroui/react
First time with HeroUI? Set it up once.
/**
* Demo from HeroUI, https://heroui.com (docs example date-picker/basic.tsx).
* Apache-2.0, Copyright 2025 NextUI Inc. Full text: https://github.com/heroui-inc/heroui/blob/main/LICENSE
* Changed for Tastebud: a default export (HeroUI's docs use named ones) without the docs site's prop
* controls.
*/
"use client";
import {Calendar, DateField, DatePicker, Label} from "@heroui/react";
export default function DatePickerDemo() {
return (
<DatePicker className="w-72" name="date">
<Label>Date</Label>
<DateField.Group fullWidth>
<DateField.Input>{(segment) => <DateField.Segment segment={segment} />}</DateField.Input>
<DateField.Suffix>
<DatePicker.Trigger>
<DatePicker.TriggerIndicator />
</DatePicker.Trigger>
</DateField.Suffix>
</DateField.Group>
<DatePicker.Popover>
<Calendar aria-label="Event date">
<Calendar.Header>
<Calendar.YearPickerTrigger>
<Calendar.YearPickerTriggerHeading />
<Calendar.YearPickerTriggerIndicator />
</Calendar.YearPickerTrigger>
<Calendar.NavButton slot="previous" />
<Calendar.NavButton slot="next" />
</Calendar.Header>
<Calendar.Grid>
<Calendar.GridHeader>
{(day) => <Calendar.HeaderCell>{day}</Calendar.HeaderCell>}
</Calendar.GridHeader>
<Calendar.GridBody>{(date) => <Calendar.Cell date={date} />}</Calendar.GridBody>
</Calendar.Grid>
<Calendar.YearPickerGrid>
<Calendar.YearPickerGridBody>
{({year}) => <Calendar.YearPickerCell year={year} />}
</Calendar.YearPickerGridBody>
</Calendar.YearPickerGrid>
</Calendar>
</DatePicker.Popover>
</DatePicker>
);
}
Changed for this site: A default export (HeroUI's docs use named ones) without the docs site's prop controls.