Skip to content

Cookbook ​

The cookbook contains ready-to-use patterns for common integration scenarios. Each recipe is self-contained — copy the code and adapt it to your context.

Recipes ​

RecipeWhat it covers
Async ValidationReject specific times with a server-side check or custom rule. Display a human-readable error message.
Min / Max TimeRestrict the selectable range to working hours, business hours, or any interval.
Programmatic ControlsetValue, getValue, setNow, clear, open, close, toggle — control the picker from your own buttons and logic.
Custom LocaleRegister a French (or any) locale and use it in all pickers on the page.
Auto-Init via data attributeInitialize pickers from HTML attributes without writing any JavaScript per-input.
Before-open / before-change GuardsBlock the picker from opening or a value from being committed based on async conditions.
Cell RendererStyle individual grid cells with custom CSS classes, tooltips, and non-clickable state — synchronously or asynchronously.

Common imports ​

All recipes assume:

ts
import { Timepicker } from '@tito10047/vanilla-js-timepicker'
import '@tito10047/vanilla-js-timepicker/dist/timepicker.css'

Released under the MIT License.