Skip to content

Props and Events

Props

PropTypeDefaultDescription
modelValuestring''Selected value (ISO date, time, or datetime string)
type'date' | 'datetime-local' | 'time''date'Picker mode
displayFormatstring--Display format (e.g. DD/MM/YYYY). Falls back to Intl.DateTimeFormat
placeholderstringLocale defaultInput placeholder text
disabledbooleanfalseDisable the picker
requiredbooleanfalseMark as required
labelstring--Label text above the trigger
langstring'tr'Language code. See Localization
localestring--Intl locale string for month/weekday formatting
minstring--Minimum selectable date (YYYY-MM-DD)
maxstring--Maximum selectable date (YYYY-MM-DD)
rangebooleanfalseEnable date range selection
rangeStartstring--Start date for range (v-model:range-start)
rangeEndstring--End date for range (v-model:range-end)
rangePlaceholderstringLocale defaultPlaceholder for empty range state
hourFormat'24' | '12''24'Time display format
minuteStepnumber1Minute increment step
errorstring--Error message (red border + text)
hintstring--Hint text below the trigger
disabledDatesstring[] | (date: Date) => boolean--Disable specific dates (array of ISO strings or predicate function)
markedDatesMarkedDate[][]Mark dates with colored dots and optional tooltips

Events

EventPayloadDescription
update:modelValuestringEmitted when a value is selected
update:rangeStartstringEmitted when range start date is selected
update:rangeEndstringEmitted when range end date is selected

Slots

SlotScoped PropsDescription
mark-tooltip{ marks: MarkedDate[], day: string }Custom tooltip content for marked dates
footer-prependContent rendered before the Today/Now button
footer-appendContent rendered after the Clear button
vue
<DatePicker v-model="date">
  <template #footer-prepend>
    <span style="font-size: 0.7rem; opacity: 0.6;">⚡ Quick</span>
  </template>
  <template #footer-append>
    <button class="bt-today-btn" @click="date = '2026-01-01'">📆 NYE</button>
  </template>
</DatePicker>

mark-tooltip Slot Example

vue
<DatePicker v-model="date" :marked-dates="marks">
  <template #mark-tooltip="{ marks, day }">
    <strong>{{ day.date }} {{ day.monthName }}</strong>
    <div v-for="m in marks" :key="m.tooltip">
      <span :style="{ color: m.color }">●</span> {{ m.tooltip }}
    </div>
  </template>
</DatePicker>

Format Tokens

Use these tokens in the displayFormat prop:

TokenOutputExample
YYYY4-digit year2026
YY2-digit year26
MMMMFull month nameFebruary
MMMShort month nameFeb
MM2-digit month02
MMonth (1-12)2
DD2-digit day14
DDay (1-31)7
HH2-digit hour (24h)09
HHour (0-23)9
mm2-digit minute30
mMinute (0-59)5

TIP

Month and weekday names respect the lang prop -- they're generated via Intl.DateTimeFormat.

CSS Variables

The component uses CSS custom properties for theming. Override them anywhere in your CSS.

Dark Theme (Default)

css
:root {
  --bt-primary: #8b5cf6;
  --bt-primary-light: #a78bfa;
  --bt-secondary: #ec4899;
  --bt-error: #ef4444;
  --bt-text: #f8fafc;
  --bt-text-secondary: #94a3b8;
  --bt-text-muted: #64748b;
  --bt-bg: #1e1e2e;
  --bt-popup-bg: #16161f;
  --bt-border: #2a2a3d;
  --bt-border-hover: #3d3d55;
  --bt-hover-bg: rgba(139, 92, 246, 0.1);
  --bt-hover-border: rgba(139, 92, 246, 0.2);
  --bt-focus-shadow: rgba(139, 92, 246, 0.15);
  --bt-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --bt-popup-blur: blur(20px) saturate(180%);
  --bt-popup-glass-bg: rgba(22, 22, 31, 0.85);
  --bt-popup-glass-border: rgba(255, 255, 255, 0.08);
  --bt-popup-inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  --bt-radius-sm: 0.375rem;
  --bt-radius-md: 0.5rem;
  --bt-radius-lg: 0.75rem;
  --bt-radius-xl: 1rem;
}

Light Theme

The light theme activates automatically via @media (prefers-color-scheme: light), or manually with data-theme="light" or the .light class:

css
[data-theme="light"],
.light {
  --bt-text: #1e293b;
  --bt-text-secondary: #475569;
  --bt-text-muted: #94a3b8;
  --bt-bg: #ffffff;
  --bt-popup-bg: #f8fafc;
  --bt-border: #e2e8f0;
  --bt-border-hover: #cbd5e1;
  --bt-hover-bg: rgba(139, 92, 246, 0.06);
  --bt-hover-border: rgba(139, 92, 246, 0.15);
  --bt-focus-shadow: rgba(139, 92, 246, 0.12);
  --bt-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
  --bt-popup-blur: blur(20px) saturate(180%);
  --bt-popup-glass-bg: rgba(255, 255, 255, 0.78);
  --bt-popup-glass-border: rgba(255, 255, 255, 0.5);
  --bt-popup-inner-glow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

Theme Activation Methods

MethodHow
Auto (system)No config needed -- uses prefers-color-scheme
Data attribute<html data-theme="light"> or <html data-theme="dark">
CSS class<html class="light"> or <html class="dark">
Custom overrideOverride --bt-* variables in any parent element

Tooltip Variables

These variables let you customize the appearance of marked-date tooltips:

VariableDefaultDescription
--bt-tooltip-bgvar(--bt-popup-bg)Tooltip background
--bt-tooltip-colorvar(--bt-text)Tooltip text color
--bt-tooltip-font-size0.75remTooltip font size
--bt-tooltip-padding6px 10pxTooltip padding
--bt-tooltip-radiusvar(--bt-radius-sm)Tooltip border radius
--bt-tooltip-widthautoExact tooltip width
--bt-tooltip-min-widthautoMinimum tooltip width
--bt-tooltip-max-width220pxMaximum tooltip width

Exported Utilities

ts
import {
  DatePicker,
  useDatePickerCalendar,
  formatISO,
  padTime,
  formatDateToken,
  formatDisplayDate,
  formatShortDate,
  useTimePicker,
  getLocale,
  registerLocale,
  getWeekDays,
  getMonthNames,
} from "@bturkis/datepicker";

import type {
  CalendarDay,
  MarkedDate,
  UseTimePickerOptions,
  BtLocale,
} from "@bturkis/datepicker";

Released under the MIT License.