Drawer
The Drawer component opens a side overlay on the left or right of the screen.
It's best used for things like mobile navigation menus or sidebars.
Uses the Reach UI Modal component to cover accessibility requirements.
Usage
import { Drawer, DrawerHeader, DrawerBody, DrawerFooter, useDisclosure,} from 'minerva-ui';
Drawer Placement
Drawer can be positioned to the left
or right
of the screen.
Animations
Animations are included by default in the <GlobalStyles />
component:
@keyframes slideright { from { transform: translateX(-100%); } to { transform: translateX(0%); }}@keyframes slideleft { from { transform: translateX(100%); } to { transform: translateX(0%); }}[data-minerva-drawer='left'] { animation: slideright 0.18s;}[data-minerva-drawer='right'] { animation: slideleft 0.18s;}
Props
Props are the same as the <Modal />
component, with the addition of placement
.
<Drawer />
Name | Type | Is Required | Default | Description |
---|---|---|---|---|
isOpen | boolean | required | false | Sets if Drawer is open |
onClose | function | optional | none | Action to take when Drawer is closed |
placement | left or right | optional | right | Control placement of drawer on screen |
<DrawerHeader />
Name | Type | Is Required | Default | Description |
---|---|---|---|---|
onClose | function | optional | none | Action to take when Drawer is closed |
children | node | optional | none |
<DrawerBody />
and <DrawerFooter />
Name | Type | Is Required | Default | Description |
---|---|---|---|---|
children | node | optional | none |