Style guide of datedropper JS

Version:

On this page:

    Try the new datedropper JS configurator to easily get the best plugin configuration!
    Configure now

    How to Customize Datepicker Style

    To customize the datepicker style, copy and paste the code below into your CSS stylesheet or create a new stylesheet and link it to the <head> of your website.

    :root {
      --dd-overlay: rgba(0, 0, 0, 0.75);
      --dd-background: #FFFFFF;
      --dd-text1: #333333;
      --dd-text2: #FFFFFF;
      --dd-primary: #FD4741;
      --dd-gradient: linear-gradient(45deg, #e61e68 0%, #FD4741 100%);
      --dd-radius: 0.35em;
      --dd-shadow: 0 0 2.5em rgba(0, 0, 0, 0.1);
      --dd-range: rgba(0, 0, 0, 0.05);
    }

    The CSS variables are defined in the :root selector, making them globally applicable. However, you can style individual datepickers using the customClass option, as shown below:

    <input type="date" data-option-custom-class="style1">
    <input type="date" data-option-custom-class="style2">

    This allows you to customize the style for each datepicker instance. For example, to change the primary color of specific datepickers while maintaining the default root styles, use the following approach:

    .style1 {
      --dd-primary: red;
    }
    .style2 {
      --dd-primary: green;
    }

    In this example, each datepicker uses a unique primary color while relying on the default root styles for other properties. You can also inspect and customize any CSS classes used by the datepicker components by adding your own styles to the CSS file.


    Style Options

    Below are all the available style variables and their default values:

    VariableDefault Value
    --dd-overlayrgba(0, 0, 0, 0.75)
    --dd-background#FFFFFF
    --dd-text1#333333
    --dd-text2#FFFFFF
    --dd-primary#FD4741
    --dd-gradientlinear-gradient(45deg, #e61e68 0%, #FD4741 100%)
    --dd-radius0.35em
    --dd-shadow0 0 2.5em rgba(0, 0, 0, 0.1)
    --dd-rangergba(0, 0, 0, 0.05)
    --dd-monthBackgroundvar(--dd-gradient)
    --dd-monthTextvar(--dd-text2)
    --dd-monthBordertransparent
    --dd-confirmButtonBackgroundvar(--dd-gradient)
    --dd-confirmButtonTextvar(--dd-text2)
    --dd-selectedBackgroundvar(--dd-gradient)
    --dd-selectedTextvar(--dd-text2)

    Style Presets

    Datedropper includes three pre-built style presets. You can apply them as follows:

    <input type="date" data-option-custom-class="dd--theme-[NAME]">
    Preset NamePreview
    dd--theme-dark
    dd--theme-bootstrap