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

# Dialog Styling

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

The following variants are supported:

| Variant      | Description                                        | Supported by |
| ------------ | -------------------------------------------------- | ------------ |
| `no-padding` | Used to remove the content area’s built-in padding | Aura, Lumo   |

**Lit** — `dialog-no-padding.ts`

```html
<vaadin-dialog
  theme="no-padding"
  header-title="Filter reports by users:"
  .opened="${this.dialogOpened}"
  @closed="${() => {
    this.dialogOpened = false;
  }}"
>
  <vaadin-grid
    .items="${this.people}"
    style="width: 500px; max-width: 100%; border-radius: 0;"
  >
    <vaadin-grid-selection-column></vaadin-grid-selection-column>
    <vaadin-grid-column
      header="Name"
      ${columnBodyRenderer<Person>((item) => html`${item.firstName} ${item.lastName}`, [])}
    ></vaadin-grid-column>
  </vaadin-grid>
  <div slot="footer">
    <vaadin-button theme="primary" @click="${this.close}">Filter</vaadin-button>
  </div>
</vaadin-dialog>
```

**Flow** — `DialogNoPadding.java`

```java
dialog.addThemeVariants(DialogVariant.NO_PADDING);
```

**React** — `dialog-no-padding.tsx`

```tsx
<Dialog
  theme="no-padding"
  header-title="Filter reports by users:"
  opened={dialogOpened.value}
  onClosed={() => {
    dialogOpened.value = false;
  }}
  footer={
    <Button
      theme="primary"
      onClick={() => {
        dialogOpened.value = false;
      }}
    >
      Filter
    </Button>
  }
>
  <Grid items={people.value} style={{ width: '500px', maxWidth: '100%', borderRadius: '0' }}>
    <GridSelectionColumn />
    <GridColumn header="Name">
      {({ item }) => (
        <>
          {item.firstName} {item.lastName}
        </>
      )}
    </GridColumn>
  </Grid>
</Dialog>
```

## <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-dialog-background`                | Aura         |
| `--vaadin-dialog-border-color`              | Aura         |
| `--vaadin-dialog-border-radius`             | Aura         |
| `--vaadin-dialog-border-width`              | Aura         |
| `--vaadin-dialog-max-width`                 | Aura         |
| `--vaadin-dialog-min-width`                 | Aura         |
| `--vaadin-dialog-overflow-indicator-color`  | Aura         |
| `--vaadin-dialog-overflow-indicator-height` | Aura         |
| `--vaadin-dialog-padding`                   | Aura         |
| `--vaadin-dialog-shadow`                    | Aura         |
| `--vaadin-dialog-title-color`               | Aura         |
| `--vaadin-dialog-title-font-size`           | Aura         |
| `--vaadin-dialog-title-font-weight`         | Aura         |
| `--vaadin-dialog-title-line-height`         | Aura         |
| `--vaadin-overlay-backdrop-background`      | Aura         |
| `--vaadin-overlay-viewport-inset`           | Aura, Lumo   |

### <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`         |

For example, the following makes dialogs with the `slide-in` class name fade in while sliding up a short distance when opened, and fade out while sliding back down when closed. The animation timing comes from the theme:

```css
vaadin-dialog.slide-in {
  --vaadin-overlay-translate-closed: 0 2rem;
  --vaadin-overlay-scale-closed: 1;
}
```

Lumo uses its own Dialog animation, which these properties don’t affect. With Lumo, replace the built-in overlay animation in the `opening` and `closing` states with keyframes that combine the same fade with a slide. Using the same durations, delays, and easing curves as the built-in animation keeps it in sync with the backdrop fade and the timing Lumo expects before the dialog is removed:

```css
vaadin-dialog.slide-in[opening]::part(overlay) {
  animation: 0.12s 0.05s slide-in-enter cubic-bezier(0.215, 0.61, 0.355, 1) both;
}

vaadin-dialog.slide-in[closing]::part(overlay) {
  animation: 0.1s 0.03s slide-in-exit cubic-bezier(0.55, 0.055, 0.675, 0.19) both;
}

@keyframes slide-in-enter {
  from {
    opacity: 0;
    translate: 0 2rem;
  }
}

@keyframes slide-in-exit {
  to {
    opacity: 0;
    translate: 0 2rem;
  }
}
```

## <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-dialog`

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

- Non-modal

  `vaadin-dialog[modeless]`

- Dialog with header

  `vaadin-dialog[has-header]`

- Dialog with footer

  `vaadin-dialog[has-footer]`

- Resizable

  `vaadin-dialog[resizable]`

- Draggable

  `vaadin-dialog[draggable]`

### <a id="parts"></a>Parts

- Modality curtain (backdrop)

  `vaadin-dialog::part(backdrop)`

- Dialog surface

  `vaadin-dialog::part(overlay)`

- Header

  `vaadin-dialog::part(header)`

- Title wrapper

  `vaadin-dialog::part(title)`

- Title element

  `vaadin-dialog > [slot="title"]`

- Header custom content wrapper

  `vaadin-dialog::part(header-content)`

- Content area

  `vaadin-dialog::part(content)`

- Footer

  `vaadin-dialog::part(footer)`
