Skip to content

Drawer Component: Combining features #342

Answered by claviska
jmbishop97 asked this question in Help
Discussion options

You must be logged in to vote

That would look something like this. Example adapted from here.

<sl-drawer label="Drawer" class="drawer-no-overlay-dismiss" style="--size: 50vw;">
  This drawer will not be closed when you click outside of it.
  <sl-button slot="footer" type="primary">Close</sl-button>
</sl-drawer>

<sl-button>Open Drawer</sl-button>

<script>
  (() => {
    const drawer = document.querySelector('.drawer-no-overlay-dismiss');
    const openButton = drawer.nextElementSibling;
    const closeButton = drawer.querySelector('sl-button[type="primary"]');

    openButton.addEventListener('click', () => drawer.show());
    closeButton.addEventListener('click', () => drawer.hide());

    drawer.addEventListener('s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by claviska
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants