Skip to content

Latest commit

 

History

History

bpk-component-drawer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

bpk-component-drawer

Backpack drawer component.

Installation

Check the main Readme for a complete installation guide.

Usage

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>
    );
  }
}

Props

Check out the full list of props on Skyscanner's design system documentation website.