CSS Variables
All 168 --tp-* variables in timepicker-ui 4.5.0, with their default values and the classes that read them.
The tables are generated from the CSS and JavaScript in the published package, so they match what you install. Set a variable on .tp-ui-wrapper to change every picker, or on .tp-ui-wrapper.my-picker with ui: { cssClass: 'my-picker' } to change one. Setting Variables has the full example, and Reading the Table explains the entries in each column.
Matches names, default values and the entries in Used by.
168 of 168 variables
Color
| Variable | Default | Used by |
|---|---|---|
--tp-bg | #ece6ee | .tp-ui-wheel-column-wrapper .tp-ui-wrapper |
--tp-surface | #e6e0e9 | .tp-ui-clock-face |
--tp-surface-hover | #c8b3fd | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds2 more.tp-ui-timezone-dropdown .tp-ui-timezone-option |
--tp-input-bg | #e6e0e9 | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds1 more.tp-ui-timezone-dropdown |
--tp-text | #1d1b20 | .tp-ui-dots .tp-ui-hour .tp-ui-input-ripple-wrapper7 more.tp-ui-minutes .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-selected .tp-ui-value-tips .tp-ui-value-tips-24h |
--tp-text-secondary | #49454f | .tp-ui-hour-text .tp-ui-minute-text .tp-ui-range-tab-label6 more.tp-ui-second-text .tp-ui-select-time .tp-ui-timezone-arrow .tp-ui-timezone-label .tp-ui-timezone-menu .tp-ui-timezone-selected |
--tp-text-disabled | hsla(0,1%,61%,.6) | .tp-ui-tips-disabled |
--tp-text-type-time | #49454f | .tp-ui-wrapper-type-time |
--tp-text-icon | #4e545a | .tp-ui-keyboard-icon .tp-ui-keyboard-icon-wrapper |
--tp-am-pm-active | #ffd8e4 | .tp-ui-am .tp-ui-pm |
--tp-am-pm-text-selected | #633b48 | .tp-ui-am .tp-ui-pm |
--tp-am-pm-text-unselected | #49454f | .tp-ui-am .tp-ui-pm |
--tp-primary | #6750a4 | .tp-ui-am .tp-ui-cancel-btn .tp-ui-circle-hand15 more.tp-ui-clear-btn .tp-ui-clock-face .tp-ui-clock-hand .tp-ui-dot .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-range-tab-value .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-option .tp-ui-wheel-column |
--tp-on-primary | #fff | .tp-ui-value-tips .tp-ui-value-tips-24h |
--tp-primary-container | #eaddff | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds1 more.tp-ui-timezone-option |
--tp-on-primary-container | #21005d | .tp-ui-hour .tp-ui-input-ripple-wrapper .tp-ui-minutes2 more.tp-ui-seconds .tp-ui-timezone-option |
--tp-primary-rgb | 103,80,164 | Not read by the library |
--tp-on-surface | #1d1b20 | .tp-ui-range-tab-value |
--tp-on-surface-variant | #49454f | Not read by the library |
--tp-on-surface-rgb | 29,27,32 | Not read by the library |
--tp-surface-container | #f3edf7 | Not read by the library |
--tp-outline-variant | #cac4d0 | .tp-ui-modal .tp-ui-popover .tp-ui-wrapper |
--tp-tertiary-container | #ffd8e4 | Not read by the library |
--tp-on-tertiary-container | #633b48 | Not read by the library |
--tp-border | #000 | .tp-ui-am .tp-ui-pm |
--tp-outline | #6750a4 | .tp-ui-timezone-dropdown |
--tp-hover-bg | #d6d6d6 | Not read by the library |
--tp-error | #d50000 | .tp-ui-invalid-format .tp-ui-invalid-text |
--tp-btn-text | var(--tp-primary)Fallback | .tp-ui-cancel-btn .tp-ui-clear-btn .tp-ui-ok-btn2 more.tp-ui-range-tab .tp-ui-range-tab-value |
Typography
| Variable | Default | Used by |
|---|---|---|
--tp-font-size-xs | 12px | .tp-ui-select-time |
--tp-font-size-sm | 12.8px | Not read by the library |
--tp-font-size-base | 14px | Not read by the library |
--tp-font-size-lg | 16px | .tp-ui-wrapper-type-time |
--tp-font-size-number | 17.6px | Not read by the library |
--tp-font-size-xl | 51.2px | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds |
--tp-font-size-seconds-12h | 36px | .tp-ui-has-seconds .tp-ui-hour .tp-ui-minutes2 more.tp-ui-seconds .tp-ui-wrapper-time |
--tp-font-size-seconds-24h | 44px | .tp-ui-has-seconds .tp-ui-hour .tp-ui-minutes2 more.tp-ui-seconds .tp-ui-wrapper-time-24h |
--tp-font-family | "Roboto",sans-serifFallback | .tp-ui-wrapper |
Size
| Variable | Default | Used by |
|---|---|---|
--tp-size-clock | 256px | Not read by the library |
--tp-size-wrapper | 328px | Not read by the library |
--tp-size-wrapper-expanded | 584px | Not read by the library |
--tp-size-wrapper-portrait | 315px | Not read by the library |
--tp-size-wrapper-landscape-height | 360px | Not read by the library |
--tp-size-wrapper-mobile-height | 258px | Not read by the library |
--tp-size-input | 96px | .tp-ui-hour .tp-ui-input-wrapper .tp-ui-minutes1 more.tp-ui-seconds |
--tp-size-input-height | 80px | .tp-ui-hour .tp-ui-input-ripple-wrapper .tp-ui-minutes1 more.tp-ui-seconds |
--tp-size-input-mobile | 72px | .tp-ui-input-ripple-wrapper .tp-ui-input-wrapper |
--tp-size-hand-circle | 46px | Not read by the library |
--tp-size-hand-circle-small | 36px | Not read by the library |
--tp-size-hand-width | 2px | Not read by the library |
--tp-size-hand-offset | calc(50% - 1px) | Not read by the library |
--tp-size-hand-top | 4px | Not read by the library |
--tp-size-hand-left | 1px | Not read by the library |
--tp-size-button-min | 44px | Not read by the library |
--tp-size-dot | 6px | .tp-ui-dots |
--tp-size-dot-center | 8px | Not read by the library |
--tp-size-am-pm-width | 52px | .tp-ui-pm |
--tp-size-am-pm-height | 40px | .tp-ui-am .tp-ui-pm |
--tp-size-am-pm-height-landscape | 44px | .tp-ui-am .tp-ui-pm |
--tp-size-icon | 24px | Not read by the library |
--tp-size-colon-width | 24px | .tp-ui-dots |
--tp-size-colon-height | 48px | Not read by the library |
--tp-size-input-seconds-12h | 64px | .tp-ui-has-seconds .tp-ui-hour .tp-ui-input-wrapper3 more.tp-ui-minutes .tp-ui-seconds .tp-ui-wrapper-time |
--tp-size-input-seconds-12h-narrow | 58px | .tp-ui-has-seconds .tp-ui-wrapper-time |
--tp-size-colon-seconds-12h | 12px | .tp-ui-dots .tp-ui-has-seconds .tp-ui-wrapper-time |
--tp-size-input-seconds-24h | 80px | .tp-ui-has-seconds .tp-ui-hour .tp-ui-input-wrapper3 more.tp-ui-minutes .tp-ui-seconds .tp-ui-wrapper-time-24h |
--tp-size-input-seconds-24h-narrow | 74px | .tp-ui-has-seconds .tp-ui-wrapper-time-24h |
--tp-size-colon-seconds-24h | 20px | .tp-ui-dots .tp-ui-has-seconds .tp-ui-wrapper-time-24h |
--tp-size-number | 32px | Not read by the library |
--tp-size-inner-circle | 200px | Not read by the library |
--tp-size-inline-min-height | 500px | .tp-ui--inline .tp-ui-wrapper |
--tp-size-padding | 10px | .tp-ui-cancel-btn .tp-ui-clear-btn .tp-ui-hour3 more.tp-ui-minutes .tp-ui-ok-btn .tp-ui-seconds |
Spacing
| Variable | Default | Used by |
|---|---|---|
--tp-spacing-xs | 4px | .tp-ui-cancel-btn .tp-ui-compact-wheel-mode .tp-ui-wheel-column-wrapper1 more.tp-ui-wheel-container |
--tp-spacing-sm | 8px | .tp-ui-keyboard-icon .tp-ui-keyboard-icon-wrapper .tp-ui-range-header4 more.tp-ui-range-mode .tp-ui-range-tab .tp-ui-wheel-container .tp-ui-wheel-mode |
--tp-spacing-md | 12px | .tp-ui-compact-wheel-mode .tp-ui-range-header .tp-ui-range-mode3 more.tp-ui-range-tab .tp-ui-wrapper .tp-ui-wrapper-type-time |
--tp-spacing-lg | 16px | .tp-ui-range-header .tp-ui-wheel-container .tp-ui-wheel-highlight1 more.tp-ui-wrapper-time |
--tp-spacing-xl | 24px | .tp-ui-cancel-btn .tp-ui-clear-btn .tp-ui-footer4 more.tp-ui-header .tp-ui-ok-btn .tp-ui-range-header .tp-ui-select-time |
--tp-spacing-2xl | 36px | .tp-ui-header |
--tp-spacing-3xl | 48px | Not read by the library |
--tp-gap-sm | 8px | Not read by the library |
--tp-gap-md | 12px | Not read by the library |
--tp-position-hidden | -10000px | Not read by the library |
--tp-scrollbar-gap | Not set | Set by the library at runtime |
Shape
| Variable | Default | Used by |
|---|---|---|
--tp-border-radius | 28px | .tp-ui-modal .tp-ui-popover .tp-ui-wrapper |
--tp-border-width | 1px | .tp-ui-am .tp-ui-pm |
--tp-border-width-thick | 2px | .tp-ui-clock-face .tp-ui-hour .tp-ui-invalid-format6 more.tp-ui-minutes .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-option .tp-ui-wheel-highlight .tp-ui-wrapper |
--tp-border-width-half | 0.3752px | .tp-ui-am .tp-ui-pm |
--tp-border-width-pm | 1.5008px | .tp-ui-pm |
--tp-radius-sm | 7px | .tp-ui-am .tp-ui-pm .tp-ui-timezone-dropdown1 more.tp-ui-wheel-column |
--tp-radius-md | 8px | .tp-ui--inline .tp-ui-hour .tp-ui-input-ripple-wrapper7 more.tp-ui-input-wrapper .tp-ui-minutes .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-menu .tp-ui-wheel-highlight .tp-ui-wrapper |
--tp-radius-lg | 20px | .tp-ui-cancel-btn .tp-ui-clear-btn .tp-ui-ok-btn |
--tp-radius-circle | 50% | .tp-ui-keyboard-icon-wrapper |
--tp-radius-full | 100% | Not read by the library |
--tp-btn-radius | var(--tp-radius-lg)Fallback | .tp-ui-cancel-btn .tp-ui-clear-btn .tp-ui-ok-btn |
Focus
| Variable | Default | Used by |
|---|---|---|
--tp-outline-width | 2px | .tp-ui-timezone-option |
--tp-outline-width-thick | 3px | .tp-ui-am .tp-ui-cancel-btn .tp-ui-clear-btn11 more.tp-ui-clock-face .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-option .tp-ui-wheel-column |
--tp-outline-width-contrast | 4px | .tp-ui-am .tp-ui-cancel-btn .tp-ui-clear-btn10 more.tp-ui-clock-face .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-wheel-column |
--tp-outline-offset | 2px | .tp-ui-am .tp-ui-cancel-btn .tp-ui-clear-btn11 more.tp-ui-clock-face .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-option .tp-ui-wheel-column |
--tp-shadow-focus | 0 0 0 4px rgba(98,0,238,.2) | Not read by the library |
--tp-shadow-focus-ring | noneFallback | .tp-ui-am .tp-ui-cancel-btn .tp-ui-clear-btn10 more.tp-ui-clock-face .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-wheel-column |
--tp-focus-ring | var(--tp-primary)Fallback | .tp-ui-am .tp-ui-cancel-btn .tp-ui-clear-btn11 more.tp-ui-clock-face .tp-ui-hour .tp-ui-keyboard-icon .tp-ui-minutes .tp-ui-ok-btn .tp-ui-pm .tp-ui-range-tab .tp-ui-seconds .tp-ui-timezone-dropdown .tp-ui-timezone-option .tp-ui-wheel-column |
Elevation
| Variable | Default | Used by |
|---|---|---|
--tp-shadow | unset | .tp-ui-timezone-menu .tp-ui-wrapper |
--tp-z-backdrop | 5000 | Not read by the library |
--tp-z-modal | 5001 | Not read by the library |
--tp-z-keyboard-icon | 10 | Not read by the library |
--tp-z-hidden | -9999 | Not read by the library |
--tp-shadow-inline | 0 2px 8px rgba(0,0,0,.15) | Not read by the library |
Motion
| Variable | Default | Used by |
|---|---|---|
--tp-duration-fast | 150ms | .tp-ui-modal .tp-ui-range-tab-value .tp-ui-wheel-column-wrapper2 more.tp-ui-wheel-item [data-md3-ripple] |
--tp-duration-base | 200ms | .tp-ui-modal .tp-ui-range-tab-value |
--tp-duration-slow | 300ms | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds2 more.tp-ui-view-switching .tp-ui-wrapper |
--tp-duration-slower | 400ms | Not read by the library |
--tp-duration-slowest | 450ms | Not read by the library |
--tp-duration-animation | 350ms | Not read by the library |
--tp-duration-ripple | 700ms | [data-md3-ripple] |
--tp-duration-ripple-fade | 500ms | [data-md3-ripple] |
--tp-duration-reduced | 0.01ms | .tp-ui |
--tp-easing-standard | cubic-bezier(0.4,0,0.2,1) | .tp-ui-range-tab-value .tp-ui-wheel-column-wrapper .tp-ui-wheel-item1 more[data-md3-ripple] |
--tp-easing-decelerate | cubic-bezier(0,0,0.2,1) | .tp-ui-modal .tp-ui-view-switching .tp-ui-wrapper |
--tp-easing-accelerate | cubic-bezier(0.4,0,1,1) | .tp-ui-modal |
--tp-easing-ease | ease | .tp-ui-hour .tp-ui-minutes .tp-ui-seconds |
--tp-easing-linear | linear | [data-md3-ripple] |
State
| Variable | Default | Used by |
|---|---|---|
--tp-opacity-hover | 0.08 | Not read by the library |
--tp-opacity-focus | 0.12 | Not read by the library |
--tp-opacity-active | 0.16 | Not read by the library |
--tp-opacity-disabled | 0.38 | .tp-ui-ok-btn .tp-ui-range-mode .tp-ui-range-tab |
--tp-state-hover-opacity | 0.08 | [data-md3-ripple] |
--tp-state-focus-opacity | 0.1 | .tp-ui-keyboard-icon-wrapper [data-md3-ripple] |
--tp-state-pressed-opacity | 0.1 | [data-md3-ripple] |
--tp-ripple-opacity | 1 | [data-md3-ripple] |
Backdrop
| Variable | Default | Used by |
|---|---|---|
--tp-backdrop | rgba(0,0,0,.5) | Not read by the library |
--tp-backdrop-filter | unset | .tp-ui-modal |
--tp-opacity-backdrop | 0.6 | Not read by the library |
Wheel
| Variable | Default | Used by |
|---|---|---|
--tp-wheel-item-height | 44px | .tp-ui-compact-wheel-mode .tp-ui-wheel-column-wrapper .tp-ui-wheel-container3 more.tp-ui-wheel-highlight .tp-ui-wheel-item .tp-ui-wheel-padding |
--tp-wheel-visible-items | 5 | .tp-ui-wheel-column-wrapper .tp-ui-wheel-container |
--tp-wheel-column-width | 76px | .tp-ui-wheel-column-wrapper |
--tp-wheel-separator-width | 20px | .tp-ui-wheel-separator |
--tp-wheel-column-width-seconds | 64px | .tp-ui-has-seconds .tp-ui-wheel-container |
--tp-wheel-separator-width-seconds | 16px | .tp-ui-has-seconds .tp-ui-wheel-container |
--tp-wheel-landscape-footer-offset | 72px | .tp-ui-mobile-clock-wrapper .tp-ui-wheel-mode |
--tp-wheel-landscape-compact-width | 360px | .tp-ui-compact-wheel-mode .tp-ui-wrapper |
--tp-wheel-landscape-compact-visible-items | 3 | .tp-ui-compact-wheel-mode .tp-ui-wheel-column-wrapper .tp-ui-wheel-container |
--tp-wheel-highlight-bg | var(--tp-primary-container,rgba(103,80,164,.08)) | .tp-ui-wheel-highlight |
--tp-wheel-highlight-border | var(--tp-outline-variant,rgba(0,0,0,.12)) | .tp-ui-wheel-highlight |
--tp-wheel-text-color | var(--tp-on-surface,#1d1b20) | .tp-ui-wheel-item .tp-ui-wheel-separator |
--tp-wheel-selected-color | var(--tp-primary,#6750a4) | .tp-ui-wheel-item |
--tp-wheel-disabled-opacity | var(--tp-opacity-disabled,0.38) | .tp-ui-wheel-item |
--tp-wheel-font-size | var(--tp-font-size-lg,16px) | .tp-ui-wheel-item |
--tp-wheel-selected-font-size | 22px | .tp-ui-wheel-separator |
--tp-wheel-highlight-radius | var(--tp-radius-md)Fallback | .tp-ui-wheel-highlight |
--tp-wheel-fade-opacity | .6Fallback | .tp-ui-wheel-column-wrapper |
--tp-wheel-ampm-column-width | 64pxFallback | .tp-ui-wheel-ampm .tp-ui-wheel-column-wrapper |
Popover
| Variable | Default | Used by |
|---|---|---|
--tp-popover-gap | 4px | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchored |
--tp-popover-edge-margin | 4px | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchored |
--tp-popover-min-width | 260px | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchored |
--tp-popover-max-width | 328px | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchored |
--tp-popover-shadow | 0 4px 24px rgba(0,0,0,.15) | .tp-ui-modal .tp-ui-popover .tp-ui-wrapper |
--tp-popover-span | span-right | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchored |
--tp-popover-anchor | Not set | .tp-ui-modal .tp-ui-popover .tp-ui-popover-anchoredSet by the library at runtime |
--tp-popover-radius | var(--tp-border-radius)Fallback | .tp-ui-modal .tp-ui-popover .tp-ui-wrapper |
--tp-popover-available-height | Not set | .tp-ui-modal .tp-ui-popover-constrained .tp-ui-wrapperSet by the library at runtime |
Range
| Variable | Default | Used by |
|---|---|---|
--tp-range-tab-value-font-size-seconds | 14px | .tp-ui-has-seconds .tp-ui-range-tab-value |
Timezone
| Variable | Default | Used by |
|---|---|---|
--tp-dropdown-option-bg | #fff | .tp-ui-timezone-menu |
--tp-dropdown-option-text | #000 | .tp-ui-timezone-option |
--tp-dropdown-option-hover-text | var(--tp-dropdown-option-text)Fallback | .tp-ui-timezone-option |
Mobile
| Variable | Default | Used by |
|---|---|---|
--tp-mobile-landscape-width | 328px | .tp-ui-wrapper |
--tp-mobile-landscape-height | 258px | .tp-ui-wrapper |
--tp-mobile-landscape-height-range | 287px | .tp-ui-range-mode .tp-ui-wrapper |
--tp-mobile-landscape-height-timezone | 326px | .tp-ui-tz-mode .tp-ui-wrapper |
Setting Variables
#Most defaults are declared on :root. The built-in themes other than basic set their own values on the modal through its data-theme attribute, which overrides :root. A value you set on .tp-ui-wrapper applies inside the panel with any theme.
/* Every picker */.tp-ui-wrapper {--tp-primary: #0b57d0;}/* One picker, created with ui: { cssClass: 'my-picker' } */.tp-ui-wrapper.my-picker {--tp-primary: #b3261e;--tp-border-radius: 8px;}
import { TimepickerUI } from 'timepicker-ui';import 'timepicker-ui/main.css';const picker = new TimepickerUI('#time', {ui: { cssClass: 'my-picker' },});picker.create();
A variable reaches only the element you set it on and the elements inside it. .tp-ui-wrapper sits inside .tp-ui-modal. When Used by lists .tp-ui-modal, a rule may read the variable on the modal itself, where a value on the wrapper does not reach. Set those variables on .tp-ui-modal or :root.
CSS Classes shows which element each class belongs to. Custom Styling has complete themes and covers the focus ring and the ripple.
Reading the Table
#Default is the value in main.css, which the basic theme uses. Hex, rgb() and hsl() values have a color swatch. Used by lists the classes named in the rules that read the variable. Other entries in these two columns:
- A class, such as
.tp-ui-hour - A rule that names this class reads the variable. A row shows three entries and puts the rest under "more".
- An attribute in brackets
- A rule that matches the attribute, not a class, reads the variable.
[data-md3-ripple]is on the controls that have the ripple and state layer. - Set by the library at runtime
- The picker writes the value as an inline style while it is open, which replaces a value from your stylesheet. You can still read it in your own CSS.
- Not read by the library
- The stylesheet declares it, but no rule reads it and the picker does not set it. Changing it has no visible effect in this version.
- Fallback
- The stylesheet does not declare the variable. The value shown is the fallback written in the
var()that reads it, and it applies until you set the variable. - Not set
- The stylesheet gives the variable no value.
Variables that change nothing
In 4.5.0, no rule reads these variables, so setting them has no effect:
--tp-z-modaland--tp-z-backdrop. The stylesheet setsz-index: 5000on.tp-ui-modaland5001on.tp-ui-wrapper. To change the stacking order, setz-indexon.tp-ui-modalas shown in Troubleshooting.--tp-backdropand--tp-opacity-backdrop. The backdrop color is set on.tp-ui-modalitself. Set itsbackground-colorto change it.--tp-hover-bg. The hover background of the time fields and the timezone list comes from--tp-surface-hover.--tp-radius, which some theme files set. The panel corners come from--tp-border-radius.