Pit Viper

v1.90.0

Pit Viper

v1.90.0
v1 / v2

  • Home
  • Components
  • Drawer

Drawer

Drawer

Toggles a container that slides in from the right, taking the entire height of the viewport.

You can override the default width by using the following custom property in an inline style attribute.

Custom Property Default Value Description
--max-width 600px The maxiumum width of the drawer

Requires some JavaScript, included in the HTML sample.

Example
A button that triggers a drawer.

Select Providers

Hold shift to select consecutive orgs.

#
Name NPI
MSDRG Average Rate Average % of Medicare
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
1

BWI Maryland Hospital

1234567890

4
$ 456,427.97
451.64 %
HTML
<button type="button" id="provider-drawer-trigger" class="pv-button-primary">Choose Provider</button>
<dialog id="provider-drawer" class="pv-drawer pv-surface">
...
</dialog>
<script>
function collapseSidebar() {
let layout = document.querySelector('.pv-layout-primary');
layout.toggleAttribute('data-collapsed');
}
const providerDrawer = document.querySelector('#provider-drawer');
const providerDrawerTrigger = document.querySelector('#provider-drawer-trigger');
providerDrawerTrigger.addEventListener('click', openDrawer);
function openDrawer() {
providerDrawer.showModal();
}
providerDrawer.addEventListener('click', closeDrawer);
function closeDrawer(e) {
//the below ensures that only clicking the overlay will close the dialog, not elements inside the dialog
if (e.target.nodeName === 'DIALOG') {
providerDrawer.close();
}
}
</script>