DatePicker
Date input and calendar popover composition.
Preview
A live, theme-aware example rendered with the published component.
Loading preview…
Import
Import the component from its dedicated entry point to keep the dependency and generated bundle explicit.
tsximport { DatePicker } from "@tavojs/ui/date-picker";Normal Tavo.js applications load component styles through the Tavo.js UI plugin. If the application manages component CSS manually, also import @tavojs/ui/css/date-picker.
When to use
Use it when
Choose something else when
Examples
DatePicker example
tsximport { DatePicker } from "@tavojs/ui/date-picker";
export function DatePickerExample1() {
return (
<>
<DatePicker name="due" value="2026-05-09" />
</>
);
}Common props and defaults
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Optional class hook applied to the public root element owned by the component. |
name | string | — | Configures name for this component. |
value | string | — | Configures value for this component. |
min | string | — | Configures min for this component. |
max | string | — | Configures max for this component. |
size | Size | — | Configures size for this component. |
year | number | — | Configures year for this component. |
month | number | — | Configures month for this component. |
open | boolean | — | Configures open for this component. |
Complete TypeScript API
Import from @tavojs/ui/date-picker. Published exports: DatePicker, DatePickerProps.
DatePickerProps
| Property | Type | Required | Description |
|---|---|---|---|
children | Child | No | Inherited children attribute accepted by DatePicker. |
className | string | No | Optional class hook applied to the public root element owned by the component. |
sx | Sx | No | Inherited sx attribute accepted by DatePicker. |
id | string | No | Inherited id attribute accepted by DatePicker. |
role | string | No | Inherited role attribute accepted by DatePicker. |
style | Record<string, unknown> | No | Inherited style attribute accepted by DatePicker. |
title | string | No | Inherited title attribute accepted by DatePicker. |
tabIndex | number | No | Inherited tabIndex attribute accepted by DatePicker. |
hidden | boolean | No | Inherited hidden attribute accepted by DatePicker. |
disabled | boolean | No | Inherited disabled attribute accepted by DatePicker. |
onClick | TavoEventHandler<MouseEvent> | No | Inherited onClick attribute accepted by DatePicker. |
onChange | TavoEventHandler<Event> | No | Inherited onChange attribute accepted by DatePicker. |
onInput | TavoEventHandler<Event> | No | Inherited onInput attribute accepted by DatePicker. |
onKeyDown | TavoEventHandler<KeyboardEvent> | No | Inherited onKeyDown attribute accepted by DatePicker. |
onFocus | TavoEventHandler<FocusEvent> | No | Inherited onFocus attribute accepted by DatePicker. |
onBlur | TavoEventHandler<FocusEvent> | No | Inherited onBlur attribute accepted by DatePicker. |
name | string | No | Configures name for this component. |
value | string | No | Configures value for this component. |
min | string | No | Configures min for this component. |
max | string | No | Configures max for this component. |
size | Size | No | Configures size for this component. |
year | number | No | Configures year for this component. |
month | number | No | Configures month for this component. |
open | boolean | No | Configures open for this component. |
renderCalendarWhenClosed | boolean | No | Inherited renderCalendarWhenClosed attribute accepted by DatePicker. |
onValueChange | (value: string) => void | No | Inherited onValueChange attribute accepted by DatePicker. |
State ownership and DOM target
| Concern | Contract |
|---|---|
| State | Application controlled through open, value and the matching callback. |
| DOM target | Native input attributes target the owned form control; wrapper-specific props stay on the documented component root. |
Anatomy and related components
Limitations
Avoid DatePicker when wrapping controls without labels or accessible names.
Use only the documented props, entry points, and compound members. Internal DOM nesting and CSS class names can change without becoming part of the public component contract.
Accessibility
Form components pass through native attributes and should be paired with visible labels or accessible names.
Use Field, FormLabel, FormControlLabel, or aria-label for labeling.
Preserve native input semantics whenever possible.
Expose validation with error text and aria-invalid where relevant.
Component status
| Contract | Current value |
|---|---|
| Maturity | stable |
| Category | forms |
| Component import | @tavojs/ui/date-picker |
| Explicit CSS import | @tavojs/ui/css/date-picker |
| Preview | Interactive preview available on this page |