import { Calendar } from '@hanzo/ui'
Single mode in a bordered frame; one day starts selected and picking it again clears it.
export function Default() {const [date, setDate] = useState<Date | undefined>(new Date(2026, 8, 15))return (<YStack self="flex-start" borderWidth={1} borderColor="$borderColor" rounded="$3"><Calendar mode="single" selected={date} onSelect={setDate} /></YStack>)}
Each pick grows the range and a pick on either end shrinks it back to that day.
export function Range() {const [range, setRange] = useState<CalendarRange | undefined>({from: new Date(2026, 8, 5),to: new Date(2026, 8, 12),})return <Calendar mode="range" selected={range} onSelect={setRange} />}
Any number of days, each pick toggling its own.
export function Multiple() {const [dates, setDates] = useState<Date[] | undefined>([new Date(2026, 8, 3),new Date(2026, 8, 10),])return <Calendar mode="multiple" selected={dates} onSelect={setDates} />}
`numberOfMonths` lays consecutive months side by side, the week starting on Monday.
export function TwoMonths() {const [range, setRange] = useState<CalendarRange | undefined>({from: new Date(2026, 8, 28),to: new Date(2026, 9, 4),})return <Calendar mode="range" numberOfMonths={2} weekStartsOn={1} selected={range} onSelect={setRange} />}
A predicate keeps days outside a window from being picked, as a date-of-birth field needs.
export function Disabled() {const [date, setDate] = useState<Date | undefined>()const today = new Date(2026, 8, 15)const min = new Date(1900, 0, 1)return (<XStack justify="center"><Calendar mode="single" selected={date} onSelect={setDate} disabled={(d) => d > today || d < min} /></XStack>)}
export type CalendarRange = { from?: Date; to?: Date }
export interface CalendarSingleProps extends CalendarSharedProps {mode?: 'single'selected?: DateonSelect?: (date: Date | undefined) => void}
export interface CalendarMultipleProps extends CalendarSharedProps {mode: 'multiple'selected?: Date[]onSelect?: (dates: Date[] | undefined) => void}
export interface CalendarRangeProps extends CalendarSharedProps {mode: 'range'selected?: CalendarRangeonSelect?: (range: CalendarRange | undefined) => void}
export type CalendarProps = CalendarSingleProps | CalendarMultipleProps | CalendarRangeProps