timepicker-ui
4.7.0GitHub
timepicker-ui
Getting Started / Installation

Installation

Get started with Timepicker-UI in your project

Package Manager

#

Install via npm, yarn, or pnpm:

index.sh
npm install timepicker-ui
yarn add timepicker-ui
pnpm 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.

index.css
*,
*::before,
*::after {
box-sizing: border-box;
}

Import Styles

#

Import the library styles in your main entry file:

index.ts
import "timepicker-ui/main.css";

CDN

#

For quick prototyping, use the CDN version:

index.html
<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 TimepickerUI
const 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.

index.html
<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?

Check out the Quick Start guide to start building with Timepicker-UI
Esc