DatePicker
Calendar popup date picker with locale support
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { DatePicker } from '@dryui/ui';
</script>
<DatePicker.Root bind:value={departureDate} name="departureDate">
<DatePicker.Trigger placeholder="Select departure date" />
<DatePicker.Content>
<DatePicker.Calendar />
</DatePicker.Content>
</DatePicker.Root>Import options
Root package
import { DatePicker } from '@dryui/ui'Per-component subpath
import { DatePicker } from '@dryui/ui/date-picker'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Use DatePicker when the calendar is the primary interaction. For typed date entry, prefer DateField. Add `name` when the selected date should submit with a native form.
Basic Date Picker
<script lang="ts">
let value = $state(null);
</script>
<DatePicker.Root bind:value name="departureDate">
<DatePicker.Trigger placeholder="Pick a date..." />
<DatePicker.Content>
<DatePicker.Calendar />
</DatePicker.Content>
</DatePicker.Root>Date Picker with min/max range
<script lang="ts">
let value = $state(null);
const min = new Date('2024-01-01');
const max = new Date('2024-12-31');
</script>
<DatePicker.Root bind:value name="departureDate" {min} {max}>
<DatePicker.Trigger placeholder="Pick a date in 2024..." />
<DatePicker.Content>
<DatePicker.Calendar />
</DatePicker.Content>
</DatePicker.Root>Structure
Compound components always start with DatePicker.Root. Use this structure block to understand required wrappers before you wire state or styling.
DatePicker.Root
DatePicker.Trigger
DatePicker.Content
DatePicker.Calendar Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
Compound component. Start with DatePicker.Root, then add only the parts you need.
DatePicker.Root
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
open | boolean | — | — | ✓ |
value | Date | null | — | — | ✓ |
name | string Adds a hidden input so the selected date participates in native form submission as YYYY-MM-DD. | — | — | — |
locale | string | — | — | — |
min | Date | null | — | — | — |
max | Date | null | — | — | — |
disabled | boolean | — | — | — |
children | Snippet | — | ✓ | — |
Also accepts standard HTML attributes (class, style, id, etc.)
DatePicker.Trigger
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
size | smmdlg | — | — | — |
placeholder | string | — | — | — |
children | Snippet | — | — | — |
Forwards <button> attributes via rest props. Common examples: type, disabled, name.
DatePicker.Content
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
offset | number | — | — | — |
children | Snippet | — | ✓ | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.
DatePicker.Calendar
| Prop | Type | Default | Required | Bindable |
|---|
Forwards <div> attributes via rest props. Common examples: id, style, role.