A DateRangePicker combines two DateFields and a RangeCalendar popover to allow users to enter or select a date range A date range picker can be built using two separate <input type="date"> elements, but this is very limited in functionality, lacking in internationalization capabilities, inconsistent between browsers, and difficult to style. DateRangePicker helps achieve accessible and international date and time range pickers that can be styled as needed.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Date Range Picker [react-aria-components] to your project and fits it to your theme.
Code
How Date Range Picker [react-aria-components] is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import { CalendarIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
CalendarCell,
CalendarGrid,
CalendarGridBody,
CalendarGridHeader,
CalendarHeaderCell,
CalendarHeading,
RangeCalendar,
} from "@/components/ui/calendar"
import {
DatePickerContent,
DateRangePicker,
} from "@/components/ui/date-range-picker"
import { DateInput } from "@/components/ui/datefield"
import { FieldGroup, Label } from "@/components/ui/field"
export function DateRangePickerDemo() {
return (
<DateRangePicker className="min-w-[320px] space-y-1">
<Label>Date range</Label>
<FieldGroup>
<DateInput variant="ghost" slot={"start"} />
<span aria-hidden className="px-2 text-sm text-muted-foreground">
-
</span>
<DateInput className="flex-1" variant="ghost" slot={"end"} />
<Button
variant="ghost"
size="icon"
className="mr-1 size-6 data-[focus-visible]:ring-offset-0"
>
<CalendarIcon aria-hidden className="size-4" />
</Button>
</FieldGroup>
<DatePickerContent>
<RangeCalendar>
<CalendarHeading />
<CalendarGrid>
<CalendarGridHeader>
{(day) => <CalendarHeaderCell>{day}</CalendarHeaderCell>}
</CalendarGridHeader>
<CalendarGridBody>
{(date) => <CalendarCell date={date} />}
</CalendarGridBody>
</CalendarGrid>
</RangeCalendar>
</DatePickerContent>
</DateRangePicker>
)
}
![Date Range Picker [react-aria-components] preview](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=1080,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/date-range-picker/default/preview.png)
![Tag Group [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/tag-group/891/preview.png)
![Grid List [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/grid-list/default/preview.png)
![Switch [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/switch/1023/preview.png)
![Select [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/select/864/preview.png)
![Range Calendar [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/range-calendar/default/preview.png)

![Slider [react-aria-components]](https://cdn.21st.dev/cdn-cgi/image/fit=scale-down,width=640,quality=75,format=webp/https://cdn.21st.dev/user_jolbol1/slider/827/preview.png)
