Date Picker
Date selection. Angular provides a rich picker; HTML and React use the native <input type="date">.
Codeโ
- HTML ยท @primus/ui-core
- React
- Angular
<div class="vstack" style="max-width:280px">
<label>Start Date <input type="date" /></label>
<label>Contract Date <input type="date" min="2026-01-01" max="2026-12-31" /></label>
<div data-field="error">
<label>Expiry <input type="date" aria-invalid="true" /></label>
<span class="error">Please select a valid date.</span>
</div>
</div>
<label>Start Date
<input type="date" value={date} onChange={e => setDate(e.target.value)} />
</label>
<primus-date-picker label="Start Date" placeholder="Select a date"
(valueChange)="onDate($event)">
</primus-date-picker>
<primus-date-picker label="Contract Date" min="2026-01-01" max="2026-12-31"
error="Please select a date." [required]="true">
</primus-date-picker>
Propsโ
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | '' | Label text |
value | `string | null` | null |
min | string | โ | Min date |
max | string | โ | Max date |
error | string | '' | Error message |
Accessibilityโ
- Uses
<input type="date">โ natively accessible and keyboard operable - Screen readers announce the full date when selected
- Add
aria-labelwhen the visual label is not adjacent to the input - Min/max attributes prevent out-of-range dates from being submitted
Version history
See the Changelog for version history and breaking changes.