Skip to content

Date picker ​

te-date-picker binds a Date and closes when you click outside of it, which relies on the v-click-outside directive the plugin registers.

Inside a te-field it takes the id its label points at, its description and its invalid state from the wrapper.

Basic ​

vue
<te-date-picker />

Localised month and day names ​

vue
<te-date-picker
  placeholder="Selecciona una fecha"
  :days="['Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb']"
  :month-names="['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']"
/>

Inside a scrolling container ​

An ancestor with overflow: hidden or its own scrollbar clips the open calendar. append-to-body renders it in <body> instead, anchored to the field while the page or the container scrolls.

vue
<div class="h-32 overflow-auto">
  <te-date-picker append-to-body v-model="date" />
</div>

Keyboard ​

Enter, Space or ↓ on the field opens the calendar on the selected day. The grid is one tab stop — the arrows move the day and cross into the next or previous month on their own.

KeyDoes
← →Previous / next day.
↑ ↓Same weekday, a week back or forward.
Home EndFirst / last day of that week.
PageUp PageDownSame day of the previous / next month.
Enter SpacePick the focused day. Dates outside minDate/maxDate or in notAllowedDates do nothing.
EscClose and go back to the field.

Props ​

PropTypeDefaultDescription
modelValueDate | nullnullSelected date. Supports v-model.
placeholderstring'Select a date'Placeholder of the trigger input.
disabledbooleanfalseDisables the trigger input.
minDate / maxDateDate | nullnullSelectable range. Also limits the year list and the arrows.
notAllowedDatesDate[][]Individual dates to block.
monthNamesstring[]English monthsTwelve month names.
daysstring[]['Sun', …]Seven weekday labels, starting on Sunday.
appendToBodybooleanfalseRenders the calendar in <body> so it is not clipped by a scrolling or overflow: hidden container.

Events ​

EventPayloadDescription
update:modelValueDateA date was picked. The panel closes.

Slots ​

SlotPropsDescription
trigger—Replaces the input that opens the calendar.
icon—Replaces the calendar icon.