Zero dependencies
No jQuery, no Moment, no framework. Drop it into any project — vanilla JS, Vue, React, Svelte, or a plain HTML page.
One constructor call, a fully accessible dropdown, keyboard navigation, async validation, and CSS-variable theming — all in under 10 kB.
import { Timepicker } from '@tito10047/vanilla-js-timepicker'
import '@tito10047/vanilla-js-timepicker/dist/timepicker.css'
const tp = new Timepicker('#departure', {
format: 'HH:mm',
minTime: '06:00',
maxTime: '22:00',
minuteStep: 15,
showNowButton: true,
showClearButton: true,
locale: 'en',
validate: async (value) => {
const reserved = await fetchReservedTimes()
return reserved.includes(value) ? `${value} is already reserved` : true
},
onChange: (value, event) => {
console.log('Selected:', value, '| Previous:', event.prev)
},
})
// Programmatic control
await tp.setValue('09:00')
console.log(tp.getValue()) // '09:00'
console.log(tp.getDate()) // Date object at 09:00
await tp.open()
await tp.close()
tp.destroy()That is the whole integration: no Application, no imports beyond the class and CSS.
Ready? Continue with Getting Started.