> For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt.

# Layering

**Components:** [`Drawer`](https://wallarm.github.io/design-system/components/drawer.md), [`Dialog`](https://wallarm.github.io/design-system/components/dialog.md), [`DropdownMenu`](https://wallarm.github.io/design-system/components/dropdown-menu.md), [`Select`](https://wallarm.github.io/design-system/components/select.md), [`Popover`](https://wallarm.github.io/design-system/components/popover.md), [`HoverCard`](https://wallarm.github.io/design-system/components/hover-card.md), [`Calendar`](https://wallarm.github.io/design-system/components/calendar.md), [`FilterCascade`](https://wallarm.github.io/design-system/components/filter-cascade.md)


+8 more

[`Tooltip`](https://wallarm.github.io/design-system/components/tooltip.md), [`Toaster`](https://wallarm.github.io/design-system/components/toast.md), [`SearchModal`](https://wallarm.github.io/design-system/components/search-modal.md), [`Tour`](https://wallarm.github.io/design-system/components/tour.md), [`SelectionBulkBar`](https://wallarm.github.io/design-system/components/selection.md), [`TableActionBar`](https://wallarm.github.io/design-system/components/table.md), [`FeedbackPulse`](https://wallarm.github.io/design-system/components/feedback-pulse.md), [`PageHeader`](https://wallarm.github.io/design-system/components/page.md)

Overlays stack themselves by nesting depth. App code never sets z-index on a design-system overlay.

## What you use

| Need                                                                         | Use                                                                                 | Not                                 |
| ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------- |
| A panel over the page                                                        | `Drawer`                                                                            | A `fixed` div with `z-50`           |
| A modal over the page or over a drawer                                       | `Dialog` from `@wallarm-org/design-system/Dialog`                                   | A second `Drawer` styled as a modal |
| A menu, select, popover, hover card or date picker inside a drawer or dialog | `DropdownMenu`, `Select`, `Popover`, `HoverCard`, `Calendar`, `FilterCascade` as-is | A `z-[100]` class on the content    |
| A hint above everything                                                      | `Tooltip`                                                                           | A `Popover` with a raised z-index   |
| A notification above every drawer and dialog                                 | `useToast()` from `@wallarm-org/design-system/Toast`, plus one `Toaster`            | A `Drawer` without overlay          |
| A sticky page header                                                         | `PageHeader` with `sticky`                                                          | `sticky top-0 z-50` in app code     |
| Bulk actions for a table in a drawer or dialog                               | Buttons in `DrawerFooter` or `DialogFooter`                                         | `TableActionBar`                    |

What does not exist:

- No z-index token scale and no `z-overlay`, `z-modal`, `z-popover` or `z-toast` utility.
- No `zIndex` prop on any overlay.
- No `portal={false}` or container prop on `Drawer`, `Dialog`, `DropdownMenu`, `Select`, `Popover` or `Tooltip`.
- No `Overlay` export. The backdrop comes from `Drawer` and `Dialog` when `overlay` is `true`.
- No `Dialog` in the package root. Import it from `@wallarm-org/design-system/Dialog`.

## Rules

- If an overlay opens from inside another overlay, render it as a React child of the parent's content. Depth comes from the React tree.
- If you open a `Dialog` from a `Drawer`, put the `Dialog` inside `DrawerContent`. Only a React-ancestor drawer or dialog dismisses the nested one.
- If you nest a `Drawer` in a `Drawer`, or a `Dialog` in a `Dialog`, expect the parent to scale back. A `Dialog` over a `Drawer` does not scale the drawer.
- If a dropdown, select, popover, calendar or tooltip sits in any overlay, use it as-is. It already paints above its host.
- If your app has its own fixed element (chat widget), keep its z-index below 40. At 40 or higher it paints over the drawer backdrop.
- If your app has its own sticky element inside a scroll area, use `z-10`.
- **Never** add a `z-*` class or `style={{ zIndex }}` to `DrawerContent`, `DropdownMenuContent`, `SelectPositioner`, `PopoverContent`, `HoverCardContent`, `CalendarContent` or `TooltipContent`.
- If chrome you can't change (a framework or docs-site header) sits at z-index 40 or higher, raise `--drawer-overlay-z-index` and `--drawer-positioner-z-index` together on `:root` above it, positioner 10 higher. Keep both under 900.
- **Never** override `--tooltip-z-index` or `--toast-z-index`, and never change only one of the two drawer variables.
- **Never** wrap an overlay trigger in `transform`, `filter` or `isolation: isolate` to fix stacking. Overlay content is portaled to `document.body`.
- **Never** open `SearchModal` from inside a `Drawer` or `Dialog`. The backdrops cover the search box.
- **Never** start a `Tour` while a `Drawer` or `Dialog` is open. The drawer ties with or covers the tour.
- **Never** show `TableActionBar` for a table inside a `Drawer` or `Dialog`. The drawer ties with or covers the bar.

## Examples

A menu inside a drawer paints above the drawer with no z-index class.

```tsx
<DrawerContent>
  <DrawerBody>
    <DropdownMenu>
      <DropdownMenuTrigger asChild>
        <Button variant='outline' color='neutral'>Actions</Button>
      </DropdownMenuTrigger>
      <DropdownMenuContent>
        <DropdownMenuItem>Duplicate</DropdownMenuItem>
      </DropdownMenuContent>
    </DropdownMenu>
  </DrawerBody>
</DrawerContent>
```

A confirm dialog opened from a drawer is a React child of `DrawerContent`.

```tsx
import { Dialog, DialogContent, DialogTitle, DialogTrigger } from '@wallarm-org/design-system/Dialog';

<DrawerFooter>
  <Dialog>
    <DialogTrigger asChild>
      <Button variant='primary' color='brand'>Delete</Button>
    </DialogTrigger>
    <DialogContent>
      <DialogTitle>Delete rule?</DialogTitle>
    </DialogContent>
  </Dialog>
</DrawerFooter>
```

An app-owned floating widget stays below the drawer backdrop.

```tsx
<div className='fixed right-16 bottom-16 z-30'>{chat}</div>
```

## Reference

### Depth-based overlays

`Drawer`, `Dialog`, `DropdownMenu`, `Select`, `Popover`, `HoverCard`, `Calendar` and `FilterCascade`. Each level adds 20.

| Depth | Backdrop | Content |
| ----- | -------- | ------- |
| 0     | 40       | 50      |
| 1     | 60       | 70      |
| 2     | 80       | 90      |
| 3     | 100      | 110     |

### Fixed overlays

| Component                                   | z-index |
| ------------------------------------------- | ------- |
| `Tooltip`                                   | 1000    |
| `Toaster`                                   | 900     |
| `SelectionBulkBar` (`placement='floating'`) | 200     |
| `TableActionBar`, `Tour`, `FeedbackPulse`   | 50      |
| `SearchModal`                               | 41      |
| `Tour` backdrop                             | 40      |

### Variables

| Variable                      | Value |
| ----------------------------- | ----- |
| `--drawer-overlay-z-index`    | 40    |
| `--drawer-positioner-z-index` | 50    |
| `--toast-z-index`             | 900   |
| `--tooltip-z-index`           | 1000  |

### In-flow values

In-component only; never competes with overlays.

| Value            | Where                                                                    |
| ---------------- | ------------------------------------------------------------------------ |
| `z-10`           | `PageHeader` `sticky`, sticky menu group labels, pinned table body cells |
| `z-30` to `z-40` | Table headers                                                            |
