Drawer
Basic Usage
import { Drawer } from '@krakentech/coral';
const [isOpen, setIsOpen] = useState(false);
<Button onClick={() => setIsOpen(true)}>Open drawer</Button>
<Drawer open={isOpen} onClose={() => setIsOpen(false)}>
<Container padding="lg">
<Typography>Your content here</Typography>
</Container>
</Drawer>Note: The
Drawercomponent does not have any internal padding, it’s advised to use theContainercomponent and theStackcomponent to lay out the content inside theDrawercomponent.
Properties
position
const [isOpen, setIsOpen] = useState(false);
<Button onClick={() => setIsOpen(true)}>Open drawer</Button>
<Drawer
open={isOpen}
onClose={() => setIsOpen(false)}
position="bottom"
>
<Container padding="lg">
<Typography>Your content here</Typography>
</Container>
</Drawer>disableEscapeKeyDown
const [isOpen, setIsOpen] = useState(false);
<Button onClick={() => setIsOpen(true)}>Open drawer</Button>
<Drawer
open={isOpen}
onClose={() => setIsOpen(false)}
disableEscapeKeyDown
>
<Container padding="lg">
<Typography>Your content here</Typography>
</Container>
</Drawer>Event Handlers
<Drawer
onClose={() => {}}
>
...
</Drawer>Full API
Design
Good to know
Usual content found within the slide out is:
- A card to explain how costs are calculated
- Cost breakdown of electricity
- Cost breakdown of gas
- Semi transparent panel to cover to page behind
This can vary depending on the region.
Last updated on