www/docs/components/offcanvas.mdx
import Basic from '!!raw-loader!../examples/Offcanvas/Basic'; import Backdrop from '!!raw-loader!../examples/Offcanvas/Backdrop'; import StaticBackdrop from '!!raw-loader!../examples/Offcanvas/StaticBackdrop'; import Responsive from '!!raw-loader!../examples/Offcanvas/Responsive'; import Placement from '!!raw-loader!../examples/Offcanvas/Placement';
Offcanvas includes support for a header with a close button and an optional body class for some initial padding. We suggest that you include offcanvas headers with dismiss actions whenever possible, or provide an explicit dismiss action.
Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual.
<CodeBlock language="jsx" live> {Responsive} </CodeBlock>Offcanvas supports a few different placements:
start places offcanvas on the left of the viewportend places offcanvas on the right of the viewporttop places offcanvas on the top of the viewportbottom places offcanvas on the bottom of the viewportScrolling the <body> element is disabled when an offcanvas and its backdrop are
visible. Use the scroll prop to toggle <body> scrolling and the backdrop prop
to toggle the backdrop.
When backdrop is set to static, the offcanvas will not close when clicking outside of it.