Installation
Get started with Timepicker-UI in your project
Package Manager
#Install via npm, yarn, or pnpm:
npm install timepicker-uiyarn add timepicker-uipnpm add timepicker-ui
Box Sizing
#You do not need a global box-sizing reset for the picker. It sets box-sizing: border-box on its own modal and on every element inside it.
If your own layout already uses the common reset below, keep it. It does not conflict with the picker.
*,*::before,*::after {box-sizing: border-box;}
Import Styles
#Import the library styles in your main entry file:
import "timepicker-ui/main.css";
CDN
#For quick prototyping, use the CDN version:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/timepicker-ui@4.7.0/dist/css/main.css"><script src="https://cdn.jsdelivr.net/npm/timepicker-ui@4.7.0/dist/index.umd.js"></script><script>// The UMD build exposes the class as the global TimepickerUIconst picker = new TimepickerUI('#timepicker');picker.create();</script>
Plugins load as separate UMD files after the core script. Each one sets its own global: TimepickerUIRange exposes RangePlugin, TimepickerUITimezone exposes TimezonePlugin and TimepickerUIWheel exposes WheelPlugin. Register them once with TimepickerUI.PluginRegistry.register() before creating a picker, then turn the feature on in the options.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/timepicker-ui@4.7.0/dist/css/main.css"><script src="https://cdn.jsdelivr.net/npm/timepicker-ui@4.7.0/dist/index.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/timepicker-ui@4.7.0/dist/plugins/range.umd.js"></script><script>TimepickerUI.PluginRegistry.register(TimepickerUIRange.RangePlugin);const picker = new TimepickerUI('#timepicker', { range: { enabled: true } });picker.create();</script>
Ready for the next step?