Simple Date Picker
A text-only field for manually entering dates without a calendar dropdown. Useful for memorable dates like birthdays or expiration dates.
Always communicate the expected date format with the label or helper prop. Placeholder text disappears as soon as the user starts typing, so never rely on it alone.
<template>
<NbDatePicker
v-model="date"
type="simple"
label="Date of birth"
placeholder="dd/mm/yyyy"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const date = ref<string | null>(null)
</script>Single Date Picker
Combines a text input with a calendar dropdown. Users can type a date or select one from the calendar.
<template>
<NbDatePicker v-model="date" label="Start date" placeholder="dd/mm/yyyy" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
const date = ref<string | null>(null)
</script>Typing a date
A typed date is read in the field order of the locale, the same order the field displays dates in. With locale="en-GB", 05/12/2024 is 5 December. With locale="en-US", it is 12 May. Day, month and year can be separated by /, ., - or spaces, and the year needs four digits. An ISO date (2024-12-05) is accepted in any locale, and so is a date that starts with a four-digit year.
Nothing is emitted until the text is a complete date that exists on the calendar, so the field is never rewritten while someone is still typing. 31/02/2024 emits nothing. Clearing the field emits null.
Date Range Picker
Two inputs for selecting a start and end date. Selecting the start date automatically moves focus to the end date input.
<template>
<NbDatePicker
v-model="start"
v-model:end-value="end"
type="range"
label="Date range"
placeholder="Start date"
end-placeholder="End date"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const start = ref<string | null>(null)
const end = ref<string | null>(null)
</script>Per-field labels
Give each range field its own label with endLabel. When set, label sits above the start field and endLabel above the end field, so screen readers announce each input unambiguously.
<NbDatePicker
v-model="start"
v-model:end-value="end"
type="range"
label="Start date"
end-label="End date"
/>Min and Max Dates
Constrain the selectable date range. Dates outside the bounds are visually dimmed in the calendar and cannot be selected, and dates typed into the field are rejected when they fall outside the bounds.
<NbDatePicker
v-model="date"
label="Appointment"
min="2026-04-10"
max="2026-04-25"
/>Disabled Dates
Beyond min/max, individual dates can be blocked with disabledDates: either an array of ISO strings or a predicate function. Use it for holidays, weekends, or fully booked days. Disabled dates stay keyboard-focusable so their labels remain discoverable, but they cannot be selected.
<template>
<NbDatePicker
v-model="date"
label="Delivery date"
helper="Weekends are unavailable"
:disabled-dates="isWeekend"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const date = ref<string | null>(null)
function isWeekend(iso: string): boolean {
const day = new Date(iso + 'T00:00:00').getDay()
return day === 0 || day === 6
}
</script>Validation States
Use error or warning props to display validation feedback below the field. error takes precedence over warning, which takes precedence over helper.
<NbDatePicker
v-model="date"
label="Departure"
error="A valid date is required"
/>
<NbDatePicker
v-model="date"
label="Return"
warning="This date falls on a holiday"
/>Per-field validation (range)
In a range picker each field validates independently, so users can see exactly which field needs correction. error/warning mark only the start field; endError/endWarning mark only the end field.
<NbDatePicker
v-model="start"
v-model:end-value="end"
type="range"
label="Start date"
end-label="End date"
end-error="End date must be after the start date"
/>Helper Text
<NbDatePicker v-model="date" label="Invoice date" helper="Format: dd/mm/yyyy" />Sizes
Four sizes matching the rest of the design system, fields and buttons alike: xs (24px), sm (32px), md (40px, default), and lg (48px). The calendar button is an NbButton of the same size.
<NbDatePicker v-model="date" label="Extra small" size="xs" />
<NbDatePicker v-model="date" label="Small" size="sm" />
<NbDatePicker v-model="date" label="Medium" size="md" />
<NbDatePicker v-model="date" label="Large" size="lg" />Disabled and Read-only
A disabled field cannot be interacted with at all. A read-only field remains focusable and its value can be copied, but it cannot be edited and the calendar does not open.
<NbDatePicker v-model="date" label="Disabled" disabled />
<NbDatePicker v-model="date" label="Read-only" readonly />Fluid Variant
The fluid variant places the label inside the field, where the placeholder would be while it is empty, and steps it up and smaller once there is a date or focus, the same behaviour as the fluid NbTextInput. Validation feedback appears as an icon on the value line (hover it for the full message). The field keeps the height of its size (xs is drawn at sm).
<NbDatePicker
v-model="date"
variant="fluid"
label="Delivery date"
placeholder="dd/mm/yyyy"
/>
<NbDatePicker
v-model="date"
variant="fluid"
label="Delivery date"
error="A valid date is required"
/>In an Input Group
Inside an NbInputGroup the picker is one member of the row. It takes the group's size, disabled state and error or warning, points at the group's message, and renders no label or message of its own, so its box lines up with the buttons beside it. Give the label and the message to the group.
<template>
<NbInputGroup label="Due date" :error="dueError">
<template #default="{ size }">
<NbDatePicker v-model="due" />
<NbButton variant="primary" :size="size" @click="save">Set</NbButton>
</template>
</NbInputGroup>
</template>Week Starting on Sunday
<NbDatePicker v-model="date" label="Date" :week-start="0" />Props
| Prop | Type | Default | Description |
|---|---|---|---|
modelValue | string | null | null | Selected date as ISO string (YYYY-MM-DD) |
type | 'simple' | 'single' | 'range' | 'single' | Picker variant |
endValue | string | null | null | End date for range type (v-model:end-value) |
label | string | '' | Label text |
placeholder | string | locale hint | Placeholder text (defaults to locale date format hint) |
endPlaceholder | string | '' | Placeholder for the end date input (range only) |
endLabel | string | '' | Label for the end field (range only); when set, label and endLabel render above their own fields |
variant | 'default' | 'fluid' | 'default' | Presentation variant |
size | 'xs' | 'sm' | 'md' | 'lg' | 'md' | Field height: 24px, 32px, 40px, or 48px |
min | string | undefined | Minimum selectable date (ISO YYYY-MM-DD) |
max | string | undefined | Maximum selectable date (ISO YYYY-MM-DD) |
disabledDates | string[] | (date: string) => boolean | undefined | Individual unselectable dates: ISO string array or predicate |
weekStart | 0 | 1 | 1 | First day of the week: 0 = Sunday, 1 = Monday |
locale | string | browser locale | BCP 47 locale tag for month/weekday labels, the format hint and typed date order |
helper | string | '' | Helper text below the field |
error | string | '' | Error message for the start field (takes precedence over warning and helper) |
warning | string | '' | Warning message for the start field (shown when no error) |
endError | string | '' | Error message for the end field (range only) |
endWarning | string | '' | Warning message for the end field (range only, shown when no endError) |
disabled | boolean | false | Disables the input and calendar |
readonly | boolean | false | Read-only: focusable and copyable, but not editable and the calendar does not open |
required | boolean | false | Marks the field as required |
name | string | '' | HTML name attribute |
id | string | auto-generated | Explicit element id |
Events
| Event | Payload | Description |
|---|---|---|
update:modelValue | string | null | Selected date changed |
update:endValue | string | null | End date changed (range type only) |
change | string | null | Emitted alongside modelValue updates |
Exposed Methods
| Method | Description |
|---|---|
open | Opens the calendar dropdown |
close | Closes the calendar dropdown |
focus | Focuses the start date input |