@element-public/react-drawer
TypeScript icon, indicating that this package has built-in type declarations

5.54.0 • Public • Published

Drawer

Description

Navigation drawers provide access to destinations and app functionality, such as switching accounts. It can either be permanently on-screen or controlled by a navigation menu icon. A navigation drawer is recommended for: 1. Apps with five or more top-level destinations 2. Apps with two or more levels of navigation hierarchy 3. Quick navigation between unrelated destinations

See live demos on storybook

Storybook Drawer Demos

Install from Artifactory

  • Verify that you have access to (https://docs.int.bayer.com/cloud/devops/artifactory/)[Bayer Artifactory]
    • Verify your token is correctly set up in your .npmrc as per the link above
  • Verify you have the @element scope configured in your .npmrc
    • @element:registry=https://artifactory.bayer.com/artifactory/api/npm/npm-platforms-engineering/
  • Install the component and themes bundles
    • npm i @element/react-components @element/themes
      • alternatively install the component individually along with the themes bundle npm i @element/react-drawer @element/themes

Notes

The Drawer component works with, or include, other components, like Button, to open, close, and navigate the Drawer, Typography, to apply certain styles and sizes of text in the Drawer, and List, to improve the flow of the Drawer's contents for users.

Usage

Different Drawers should be used in various cases. For example, a Permanent Drawer could be used to prevent a user from closing or navigating away from the Drawer, so it is always visible. Alternatively, a Dismissible Drawer can be opened and closed by clicking a button, so it only appears when the user wants it to.

Sub Components

Drawer uses the following sub components:

Name Description
Drawer Primary container for all the drawer contents
DrawerHeader Contains the top title portion of the drawer.
DrawerContent The container for the main body of the drawer.
DrawerScrim Covers the screen behind the drawer component to focus the users attention.
DrawerAppContent Container for app contents. Its child is resized when the drawer opens/closes.

Drawer Props

Name Type Default Required Description
belowTopAppBar boolean null false Positions the modal lower, below the TopAppBar.
className string undefined false The css class name to be passed through to the component markup.
open boolean null false Displays the drawer when variant is either dismissible or modal`
variant string empty string false Defines the type of drawer. By default the drawer will be always shown, a permanent drawer. If defined, either modal or dismissible
Accepted Values: modal, dismissible

Drawer Deprecated Props

Name Type Default Required Deprecated Description
dismissible boolean undefined false Use variant='dismissible' instead. Enables a dismissible drawer.
modal boolean undefined false Use variant='modal' instead. Enabled a modal drawer.

Drawer Render Props

Name Type Default Required Description
children React.ReactNode null false Content to be rendered inside the Drawer

Drawer Events

Name Default Required Params Description
onClose null false Fired when drawer is closed.
onOpen null false Fired when drawer is opened.

Drawer Breaking Changes

Description
Drawer: Child component DrawerToolbarSpacer has been removed. See DrawerAppContent.

Drawer App Content Props

Name Type Default Required Description
belowTopAppBar boolean null false Positions the modal lower, below the TopAppBar.
className string undefined false The css class name to be passed through to the component markup.

Drawer App Content Render Props

Name Type Default Required Description
children React.ReactNode null false Content to be rendered inside the DrawerAppContent

Drawer Content Props

Name Type Default Required Description
className string undefined false The css class name to be passed through to the component markup.

Drawer Content Render Props

Name Type Default Required Description
children React.ReactNode null false Content to be rendered inside the drawer. Most commonly a list, but accepts any valid markup.

Drawer Header Props

Name Type Default Required Description
className string undefined false The css class name to be passed through to the component markup.
subtitle string empty string false Subtitle of Drawer Header
title string empty string false Title of Drawer Header

Drawer Header Render Props

Name Type Default Required Description
avatar React.ReactNode null false Most commonly an avatar style image, but accepts any valid markup.
children React.ReactNode null false Most commonly a text or a Typography component, but accepts any valid markup.

Readme

Keywords

none

Package Sidebar

Install

npm i @element-public/react-drawer

Weekly Downloads

101

Version

5.54.0

License

none

Unpacked Size

85.3 kB

Total Files

7

Last publish

Collaborators

  • arkadiusz.slowikowski
  • peon125
  • slowikowskiarkadiusz