Drawer

Documentation for the <Drawer /> component. Learn about the available props and how to use it.

Installation

To get started, install @exponentialeducation/betomic via yarn:

# Yarn
yarn add @exponentialeducation/betomic

Basic Example

A Drawer is a panel that is typically overlaid on top of a page.

{/* ... */}
import { Drawer } from '@exponentialeducation/betomic';
function IndexPage() {
const [open, setOpen] = useState<boolean>(false);
return (
<main>
{/* ... */}
<Drawer
open={open}
onClose={() => setOpen(false)}
>
<p>...</p>
<p>...</p>
</Drawer>
{/* ... */}
</main>
)
}

Placements

Three placements are available.

{/* ... */}
import { Drawer } from '@exponentialeducation/betomic';
function IndexPage() {
return (
<main>
{/* ... */}
<Drawer
position="right"
open={open}
onClose={() => setOpen(false)}
>
<p>...</p>
<p>...</p>
</Drawer>
{/* ... */}
</main>
)
}

Props

prop

description

children

node Content will be render

onClose?

function Specify a callback that will be called when a user clicks mask or close button

open?

boolean = false Whether the Drawer dialog is visible or not

position?

"left" | "right" | "bottom" = right The Drawer can appear from three edges of the screen.