Component · top layer

Sidepanel and Sheet

The modal dialog along an edge, or from the bottom on a phone. Same behaviour, different placement.

Filters

Filter 1. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 2. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 3. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 4. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 5. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 6. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 7. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 8. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 9. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 10. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 11. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 12. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 13. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Filter 14. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Menu

Choose one

Option 3 selected · 30 options

No swipe

This one is not closed by swiping it down.

Astro

---
import Sidepanel from '@subfloor/astro/Sidepanel.astro'
---
<button command="show-modal" commandfor="filters">Filters</button>

<!-- placement: "end" (default) | "start" | "bottom" (a sheet) -->
<Sidepanel id="filters" title="Filters" placement="end">
  …
</Sidepanel>

React has the same component: <Sidepanel placement="bottom"> from @subfloor/react. The markup is the Modal's with another data-placement.

Behaviour

Beside a list

With inlineAt (a media query; data-inline-at in plain HTML) the sidepanel opens beside the page's content where the query matches, in its own place in your layout. It is still a dialog, but not modal: no backdrop, no scroll lock, and the page stays usable, so a user can pick another item of the list while it is open. Escape (with focus in it) and the close button close it; a press beside it does not. Opening moves focus in. Closing gives it back only if it was still in the panel, to the last control used beside it. Where the query does not match it opens in its placement, for example as a sheet on a phone, and it switches form if the window crosses the query while it is open.

Without JavaScript the button opens the modal form at every width. In React, keep the component mounted and drive open from the chosen item: choosing another one changes the content, and the panel stays open.

---
import Sidepanel from '@subfloor/astro/Sidepanel.astro'
---
<div class="orders">
  <ul>…<button command="show-modal" commandfor="order">Order 2</button>…</ul>
  <!-- beside the list from 768px; a sheet below that, and without JavaScript -->
  <Sidepanel id="order" title="Order" placement="bottom"
    inlineAt="(min-width: 768px)">
    …
  </Sidepanel>
</div>

<style>
  /* your layout gives it its place and height */
  @media (min-width: 768px) {
    .orders:has(> dialog[open]) { display: grid; grid-template-columns: 1fr 20rem; }
    .orders > dialog { position: sticky; top: 0; height: 80dvh; }
  }
</style>

Try it beside a list

Customisation

.wide-sidepanel {
  --sf-sidepanel-width: 32rem;
}
.short-sheet {
  --sf-sheet-max-height: 60dvh;
  --sf-sheet-bar-color: rebeccapurple;
}
TokenDefault
--sf-color-backdroprgb(9 9 11 / 50%)
--sf-radius-overlay12px
--sf-shadow-overlay0 20px 50px rgb(0 0 0 / 20%)
--sf-overlay-guttervar(--sf-space-4)
--sf-sidepanel-width24rem
--sf-sidepanel-inline-shadownone
--sf-sheet-max-height90dvh
--sf-sheet-bar-width44px
--sf-sheet-bar-height5px
--sf-sheet-bar-offsetvar(--sf-space-2)
--sf-sheet-bar-colorvar(--sf-field-border-color)
--sf-button-spin-duration800ms
--sf-duration-enter200ms
--sf-duration-exit150ms
--sf-ease-entercubic-bezier(0.2, 0.8, 0.2, 1)
--sf-ease-exitcubic-bezier(0.4, 0, 1, 1)

Background

Content 1. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 2. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 3. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 4. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 5. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 6. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 7. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 8. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 9. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 10. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 11. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.

Content 12. Background text that only exists so there is something to scroll. When an overlay is open, this must stay exactly where it is, whatever the wheel, the keyboard or a finger does.