Hone UI
Components

Drawer

A panel at the edge of the screen.

Drawer holds navigation or a side sheet at one edge. A temporary drawer opens over the page like a dialog; a persistent or permanent drawer sits beside the content.

import Drawer from '@hone-ui/react/Drawer';

Examples

Messages

<Box sx={{ display: 'flex', minHeight: 200 }}>
  <Drawer
    variant="permanent"
    sx={{ width: 200 }}
    slotProps={{ paper: { style: { position: 'static', width: 200 } } }}
  >
    <List>
      <ListItem disablePadding>
        <ListItemButton>
          <ListItemText primary="Inbox" />
        </ListItemButton>
      </ListItem>
      <ListItem disablePadding>
        <ListItemButton>
          <ListItemText primary="Drafts" />
        </ListItemButton>
      </ListItem>
    </List>
  </Drawer>
  <Box sx={{ p: 2 }}>
    <Typography>Messages</Typography>
  </Box>
</Box>

Props

PropTypeDefaultDescription
anchor'left', 'right', 'top', 'bottom''left'The edge it comes from.
variant'temporary', 'persistent', 'permanent''temporary'Modal over the page, or docked beside it.
openbooleanfalseShows it. permanent ignores it.
onClose(event, reason) => voidreason is backdropClick or escapeKeyDown.
elevationnumber16The temporary paper's shadow.
hideBackdropbooleanfalseLeaves out the dimmed layer.
transitionDurationnumber, { enter, exit }themeThe slide length in milliseconds.
PaperProps, slotProps.paperPaper propsProps for the surface.
slotProps.backdropBackdrop propsProps for the backdrop.
sx, className, style, refStandard.

Notes

  • Every paper is fixed to its edge. A docked root keeps the space in the page, so give the root and the paper the same width.
  • A closed persistent drawer stays mounted, hidden and inert.
  • ModalProps, SlideProps and SwipeableDrawer are not supported.

Accessibility

A temporary drawer is a modal dialog: focus is trapped, the page is hidden from screen readers and focus returns to the opener. A drawer has no title part, so it needs an accessible name: set aria-label or aria-labelledby.

On this page