> Markdown version of [Styling](https://vaadin.com/docs/next/components/date-time-picker/styling). Section index: [llms.txt](https://vaadin.com/docs/next/components/llms.txt)

# Date Time Picker Styling

## <a id="style-variants"></a>Style Variants

The following style variants can be applied:

| Variant              | Description                                                                                                                  | Supported by |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `align-left`         | Aligns the text to the left side of the field (default)                                                                      | Aura, Lumo   |
| `align-center`       | Centers the text within the field                                                                                            | Aura, Lumo   |
| `align-right`        | Aligns the text to the right side of the field. Recommended for numerical values when presented in vertical groups.          | Aura, Lumo   |
| `align-start`        | Aligns the text to the start side of the field, taking into account the current text direction (left for LTR, right for RTL) | Aura         |
| `align-end`          | Aligns the text to the end side of the field, taking into account the current text direction (right for LTR, left for RTL)   | Aura         |
| `small`              | Renders a more compact field                                                                                                 | Aura, Lumo   |
| `helper-above-field` | Renders the helper above the field, and below the label                                                                      | Aura, Lumo   |

**Lit** — `date-time-picker-styles.ts`

```typescript
<vaadin-date-time-picker
  theme="align-right small helper-above-field"
  label="Label"
  helper-text="Helper text"
  value="2020-06-12T12:30"
></vaadin-date-time-picker>
```

**Flow** — `DateTimePickerStyles.java`

```java
DateTimePicker field = new DateTimePicker();
field.addThemeVariants(DateTimePickerVariant.SMALL,
        DateTimePickerVariant.ALIGN_RIGHT,
        DateTimePickerVariant.HELPER_ABOVE);
```

**React** — `date-time-picker-styles.tsx`

```tsx
<DateTimePicker
  theme="align-right small helper-above-field"
  label="Label"
  helperText="Helper text"
  value="2020-06-12T12:30"
/>
```

## <a id="style-properties"></a>Style Properties

The following style properties can be used in CSS stylesheets to customize the appearance of this component.

To apply values to these properties globally in your application UI, place them in a CSS block using the `html {…​}` selector. See [Component Style Properties](https://vaadin.com/docs/next/styling/styling-components.md#component-style-properties) for more information on style properties.

| Property                        | Supported by |
| ------------------------------- | ------------ |
| `--vaadin-date-time-picker-gap` | Aura         |

### <a id="animation"></a>Animation (since V25.3)

The overlay has a built-in opening and closing animation, which is disabled until an animation duration is set. The `closed` properties define the state that the overlay animates from when it opens, and to when it closes. The Aura theme sets these properties for some components. Lumo has its own overlay animations, which these properties don’t affect.

While an animation runs, the component has the `opening` or `closing` state attribute, so separate values can be applied to each direction. The backdrop always fades, and only the opacity is animated when the user prefers reduced motion.

| Property                                     | Value syntax                   | Initial value |
| -------------------------------------------- | ------------------------------ | ------------- |
| `--vaadin-overlay-animation-delay`           | `<time>`                       | `0s`          |
| `--vaadin-overlay-animation-duration`        | `<time>`                       | `0s`          |
| `--vaadin-overlay-animation-timing-function` | `<easing-function>`            | `ease`        |
| `--vaadin-overlay-opacity-closed`            | `<number>`                     | `0`           |
| `--vaadin-overlay-scale-closed`              | `<number>` or `<percentage>`   | `1`           |
| `--vaadin-overlay-transform-closed`          | `<transform-list>`             | `none`        |
| `--vaadin-overlay-translate-closed`          | `<length>+` or `<percentage>+` | `0px`         |

> **Note:** These properties are set on the sub-fields, `vaadin-date-time-picker > vaadin-date-picker` and `vaadin-date-time-picker > vaadin-time-picker`, not on the `vaadin-date-time-picker` root element.

### <a id="label"></a>Label

| Property                                        | Supported by |
| ----------------------------------------------- | ------------ |
| `--vaadin-input-field-focused-label-color`      | Lumo         |
| `--vaadin-input-field-hovered-label-color`      | Lumo         |
| `--vaadin-input-field-label-color`              | Aura, Lumo   |
| `--vaadin-input-field-label-font-size`          | Aura, Lumo   |
| `--vaadin-input-field-label-font-weight`        | Aura, Lumo   |
| `--vaadin-input-field-label-line-height`        | Aura, Lumo   |
| `--vaadin-input-field-required-indicator-color` | Aura, Lumo   |
| `--vaadin-input-field-required-indicator`       | Aura, Lumo   |

### <a id="helper"></a>Helper

| Property                                  | Supported by |
| ----------------------------------------- | ------------ |
| `--vaadin-input-field-helper-color`       | Aura, Lumo   |
| `--vaadin-input-field-helper-font-size`   | Aura, Lumo   |
| `--vaadin-input-field-helper-font-weight` | Aura, Lumo   |
| `--vaadin-input-field-helper-line-height` | Aura, Lumo   |
| `--vaadin-input-field-helper-spacing`     | Lumo         |

### <a id="error-message"></a>Error Message

| Property                                 | Supported by |
| ---------------------------------------- | ------------ |
| `--vaadin-input-field-error-color`       | Aura, Lumo   |
| `--vaadin-input-field-error-font-size`   | Aura, Lumo   |
| `--vaadin-input-field-error-font-weight` | Aura, Lumo   |
| `--vaadin-input-field-error-line-height` | Aura, Lumo   |

## <a id="css-selectors"></a>CSS Selectors

The following CSS selectors can be used in stylesheets to target the various parts and states of the component. See the [Styling documentation](https://vaadin.com/docs/next/styling.md) for more details on how to style components.

> **Important: Not for Shadow DOM**
>
> These selectors should be used in `styles.css` or another stylesheet loaded with the `@StyleSheet` annotation or the `@import` CSS rule. **They do not work in the shadow DOM of Vaadin components**, such as in stylesheets in the `components` sub-folder or loaded with the `@CssImport` annotation’s `themeFor` property.

---

- Root element

  `vaadin-date-time-picker`

### <a id="states"></a>States

- Required

  `vaadin-date-time-picker[required]`

- Focused

  `vaadin-date-time-picker[focused]`

- Keyboard focused

  `vaadin-date-time-picker[focus-ring]`

- Read-only

  `vaadin-date-time-picker[readonly]`

- Disabled

  `vaadin-date-time-picker[disabled]`

- Not empty

  `vaadin-date-time-picker[has-value]`

- With tooltip

  `vaadin-date-time-picker[has-tooltip]`

- Hovered

  `vaadin-date-time-picker:hover`

### <a id="sub-fields"></a>Sub-Fields

- Date Picker

  `vaadin-date-time-picker > vaadin-date-picker`

- Time Picker

  `vaadin-date-time-picker > vaadin-time-picker`

*See [Date Picker](https://vaadin.com/docs/next/components/date-picker/styling.md) and [Time Picker](https://vaadin.com/docs/next/components/time-picker/styling.md) selectors for details*

### <a id="label-2"></a>Label

- Field with label

  `vaadin-date-time-picker[has-label]`

- Label

  `vaadin-date-time-picker::part(label)`

- Label text

  `vaadin-date-time-picker > label`

- Required indicator

  `vaadin-date-time-picker::part(required-indicator)`

### <a id="helper-and-validation-error"></a>Helper and Validation Error

- Field with helper

  `vaadin-date-time-picker[has-helper]`

- Helper

  `vaadin-date-time-picker::part(helper-text)`

- Helper text

  `vaadin-date-time-picker > [slot="helper"]`

- Invalid field

  `vaadin-date-time-picker[invalid]`

- Field with error message

  `vaadin-date-time-picker[has-error-message]`

- Error message

  `vaadin-date-time-picker::part(error-message)`

- Error message text

  `vaadin-date-time-picker > [slot="error-message"]`
