Backpack drawer component.
Check the main Readme for a complete installation guide.
import BpkDrawer from '@skyscanner/backpack-web/bpk-component-drawer';
import { BpkButtonV2 as BpkButton } from '@skyscanner/backpack-web/bpk-component-button';
import { useState } from 'react';
function App() {
const [isOpen, setIsOpen] = useState(false);
render() {
return (
<div>
<div id="pagewrap">
<BpkButton onClick={() => setIsOpen(true)}>Open drawer</BpkButton>
</div>
<BpkDrawer
id="my-drawer"
isOpen={isOpen}
onClose={() => setIsOpen(false)}
title="Drawer title"
closeLabel="Close drawer"
getApplicationElement={() => document.getElementById('pagewrap')}
>
This is a drawer. You can put anything you want in here.
</BpkDrawer>
</div>
);
}
}
Check out the full list of props on Skyscanner's design system documentation website.