Calendar
Month grid for choosing a single date, several dates or a range.
Installation
bun add @xerobi/ui
import { Calendar, CalendarDayButton } from "@xerobi/ui/calendar"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Single date
import * as React from "react"
import { Calendar } from "@xerobi/ui/calendar"
export function CalendarSingle() {
const [date, setDate] = React.useState<Date | undefined>(new Date())
return <Calendar mode="single" selected={date} onSelect={setDate} className="rounded-lg border" />
}API reference
Calendar
| Prop | Type | Description |
|---|---|---|
| buttonVariant | "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "soft" |
CalendarDayButton
| Prop | Type | Description |
|---|---|---|
| locale | { labels?: DayPickerLocaleLabels | undefined; code?: string | undefined; formatDistance?: FormatDistanceFn | undefined; formatRelative?: FormatRelativeFn | u... |
Styling hooks: [data-slot="calendar"].