You are currently on Anvil1, which is now in maintenance mode. Visit Anvil2 to get the latest version of the design system.
components / Structure

Drawer

A drawer without a backdrop allows a user to continue to interact with the rest of the page. This can be useful when you wants users to have the ability to interact with the page and the drawer at the same time.

Over all Content

Closing a Drawer

Drawers without a backdrop are closed through an explicit control. This is typically through clicking a ×, a Drawer footer button, or a labeled button on the page. Clicking outside the drawer should not close it.


Drawer with a Backdrop

A backdrop restricts user interaction to just the Drawer. This is useful when a task is focused. Drawers with backdrops close similar to the Modal component.

Non-closable Drawers

When a workflow is mandatory, the close functionalities — clicking the backdrop or × — can be removed. A user would have to complete a task to proceed.

When to use a backdrop

When a Drawer is being used as an informational display, or supplementary to a page task, a backdrop is usually not needed on a Drawer. When a Drawer is an essential part of a workflow, or involves a lot of data manipulation where data conflicts with the page can occur, a backdrop is preferred.


Drawer Sizes

Drawer sizes mimic the sizes of the Modal. Each size has a built in 90% width value and a maximum width value. If a design needs to occupy 100% of the screen, consider using a Takeover.


Drawer Header

Drawer headers typically have a title and a close icon. A header can also be customized to use other Anvil components. Any action element added to the header (such as a Button) should not close the Drawer, and should use a secondary style.

Header Examples


Drawer footers generally provide flow controls such as cancel and submit, or secondary actions for the Drawer. These controls can also close the Drawer when applicable. While it is possible to have multi-step Drawers, it should be avoided. Footers are not required, which can be useful when a Drawer has no actions or when real estate is critical.


Drawer Body

The body section is where most of the Drawer content exists.

Scrollable Content

Drawer header and footers are fixed to the top and bottom of the page. The drawer's body automatically scrolls when not enough space is available.


Examples

Drawer Content Modifying Main Content


Best Practices

  • Drawers work well for:
    • Completing quick sub-tasks in a flow.
    • Aiding in completing a task on the page.
  • Drawer actions shouldn't reset when closed.

  • To completely hide the context of the page, use the Takeover component.
  • For a small, floating container of information, use the Popover component.
  • To more directly interrupt the user flow with content, use the modal component.

Importing

import { Drawer } from '@servicetitan/design-system';