Efniv0.1

Components

Date picker

A composition, not a component — Popover + Calendar. Kept as a pattern so consumers can tune the trigger to fit the surrounding form.

When to usewhen a date input needs a calendar for context — deadlines, filters, scheduling.

Import

import { Calendar } from "@ravnhq/efni/calendar"
import { Popover, PopoverContent, PopoverTrigger } from "@ravnhq/efni/popover"

Single date

const [open, setOpen] = useState(false)
const [date, setDate] = useState<Date | undefined>()

<Popover open={open} onOpenChange={setOpen}>
  <PopoverTrigger
    render={
      <Button variant="outline" className="w-56 justify-start">
        <Icon icon={CalendarIcon} />
        {date ? format(date, "PP") : <span className="text-muted-foreground">Pick a date</span>}
      </Button>
    }
  />
  <PopoverContent className="w-auto p-0" align="start">
    <Calendar mode="single" selected={date} onSelect={(d) => { setDate(d); setOpen(false); }} />
  </PopoverContent>
</Popover>

Date range

Accessibility

KeyAction
Enter / SpaceOpen the calendar; select the focused day.
Arrow keysMove by one day / week.
PageUp / PageDownPrevious / next month.
EscapeClose the popover.
  • The trigger should reflect the current value or show a muted placeholder.
  • For scheduling forms, pair with a numeric input so power users can type the date directly.

Props

PropTypeDefaultDescription
mode"single" | "multiple" | "range"—Enable the selection of a single day, multiple days, or a range of days.
numberOfMonthsnumber—The number of displayed months.
disabledMatcher | Matcher[]—Apply the disabled modifier to the matching days. Disabled days cannot be selected when in a selection mode is set.
…propsReact.ComponentProps<typeof DayPicker>—Everything Calendar passes to the element it renders.
Calendar.selected / onSelectDate | DateRange | Date[] / (value) => void—Value shape depends on mode.