DateField components allow users to select a date using an interactive calendar picker with full keyboard navigation support.
Prop | Type | Default |
|---|---|---|
No dataThere are no records to display | ||
The DateField component provides comprehensive keyboard navigation for improved accessibility and user experience:
| Key | Description |
|---|---|
| Arrow Keys | Navigate between days (←/→) and weeks (↑/↓) |
| Enter | Select the focused day |
| Escape | Close the calendar picker |
| PageUp | Go to previous month |
| PageDown | Go to next month |
| Home | Go to first day of the month |
| End | Go to last day of the month |
<script>
import { DateField } from 'ui-svelte';
let date = $state(null);
</script>
<DateField name="birthdate" bind:value={date} /> <script>
import { DateField } from 'ui-svelte';
let date = $state(null);
const today = new Date();
const minDate = new Date(today.getFullYear(), today.getMonth(), 1);
const maxDate = new Date(today.getFullYear(), today.getMonth() + 1, 0);
</script>
<DateField
name="appointment"
label="Fecha de cita"
minDate={minDate}
maxDate={maxDate}
bind:value={date}
/> <script>
import { DateField } from 'ui-svelte';
let date = $state(null);
const handleDateChange = (newDate) => {
console.log('Selected date:', newDate);
// Perform additional actions
};
</script>
<DateField
name="date"
label="Selecciona una fecha"
onchange={handleDateChange}
bind:value={date}
/>