Date and time fields
Native date, time and date-time inputs styled to match, with the browser picker in the right theme.
Installation
Usage
These are the browser's own date and time inputs: they localize the format, work on every phone and submit ISO values (2026-11-24, 09:30). Use min, max and step to limit them. For a calendar in a popover, use the Date picker or Date range picker.
Accessibility
- Native inputs: every browser and screen reader supports them, including the picker.
- Each has a visible label; the dark theme switches the picker to dark too.
Dependencies
- Bootstrap 5.3+ CSS.
themes/tokens/tokens.css.- The
labelcomponent. - The
inputcomponent.
Source
The exact files the CLI installs (date-field@1.0.0). View on GitHub · Report an issue
html
<div class="bootcn-date-field-row">
<div class="bootcn-field">
<label class="bootcn-label" for="bootcn-date-field-date">Date</label>
<input
class="form-control bootcn-input bootcn-date-field"
type="date"
id="bootcn-date-field-date"
name="date"
value="2026-11-24"
min="2026-01-01"
/>
</div>
<div class="bootcn-field">
<label class="bootcn-label" for="bootcn-date-field-time">Time</label>
<input
class="form-control bootcn-input bootcn-date-field"
type="time"
id="bootcn-date-field-time"
name="time"
value="09:30"
step="900"
/>
</div>
<div class="bootcn-field">
<label class="bootcn-label" for="bootcn-date-field-when">Starts</label>
<input
class="form-control bootcn-input bootcn-date-field"
type="datetime-local"
id="bootcn-date-field-when"
name="starts"
value="2026-11-24T09:30"
/>
</div>
</div>css
.bootcn-date-field-row {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
gap: 1rem;
max-width: 40rem;
}
.bootcn-date-field {
font-variant-numeric: tabular-nums;
}
/* The browser's picker and icon follow the theme. */
[data-bs-theme='dark'] .bootcn-date-field {
color-scheme: dark;
}
.bootcn-date-field::-webkit-calendar-picker-indicator {
border-radius: var(--bootcn-radius-sm);
cursor: pointer;
}
