Date Range Picker

A date range selector composing Calendar in range mode with a Popover trigger. Displays a formatted summary of the selected from/to dates in the trigger button.

1/10/2024 → 1/24/2024

import { DateRangePicker } from "@aetherstack/patterns"

Installation

terminal
npx aether-ui add date-range-picker

Import

import.tsx
import { DateRangePicker } from "@aetherstack/patterns"

Usage

date-range-picker.tsx
import * as React from "react"
import { DateRangePicker } from "@aetherstack/patterns"

export function MyDateRange() {
  const [value, setValue] = React.useState<{ from?: Date; to?: Date }>({})
  return (
    <DateRangePicker
      value={value}
      onValueChange={setValue}
      placeholder="Pick a date range"
    />
  )
}

Props

PropTypeDefaultDescription
value*{ from?: Date; to?: Date }Controlled selected date range.
onValueChange*(value: { from?: Date; to?: Date }) => voidCallback fired when the range changes.
placeholderstring"Pick a date range"Trigger button text when no range is selected.
disabledbooleanfalseDisables the trigger button.
classNamestringAdditional classes on the popover trigger.

* Required

Accessibility

  • The trigger button carries an accessible label derived from the selected range or the placeholder.
  • Calendar uses a grid role with arrow-key navigation; Enter selects a date.
  • Popover closes on Escape and when focus leaves the floating panel.