Skip to main content

Customization

Use custom CSS classes​

You can change the look and feel of a timepicker.

Timepicker styled with a custom red color showing hour and minute sliders in DHTMLX Suite

Related sample: Timepicker. Styling (custom CSS)

Follow these steps:

  • Add one or more CSS classes with the settings you need. Place them in the <style> section of your HTML page or in a separate stylesheet. If you use a stylesheet, include it on the page:
<style>
.my-first-class {
/*some styles*/
}

.my-second-class {
/*some styles*/
}
</style>
  • Specify the name of the class you created (or several class names separated by spaces) as the value of the css property in the Timepicker configuration:
const timepicker = new dhx.Timepicker("timepicker_container", { 
css:"my-first-class my-second-class"
});

For example:

<style>
.custom {
--dhx-font-color-primary: #c00;
--dhx-color-primary: #ff5c5c;
}
</style>

<script>
const timepicker = new dhx.Timepicker("timepicker_container", {
css: "custom dhx_widget--bordered"
});
</script>