Drawer
A slide-in panel from the edge of the screen.
Preview
Props
| Prop | Type | Default | Description |
|---|---|---|---|
open | boolean | false | Controls visibility |
onClose | function | — | Close handler |
side | string | 'right' | left, right, top, bottom |
title | string | — | Drawer title |
children | ReactNode | — | Drawer content |
Usage
const { Button, Drawer } = window.ColorSnap;
function App() {
var s = React.useState(false), open = s[0], setOpen = s[1];
return React.createElement(React.Fragment, null,
React.createElement(Button, { onClick: function() { setOpen(true); } }, 'Open Drawer'),
React.createElement(Drawer, { open: open, onClose: function() { setOpen(false); }, title: 'Settings' }, 'Content')
);
}