A mobile-style action sheet built on the Bootstrap 6 Drawer, opening from the bottom of the screen. It has a drag handle, a header that names the item, a row of round share targets, a list of edit actions with a pin toggle and a red delete option, and a full-width Cancel button. Use it for "more" menus in notes, file or task apps.
How it works
The "⋯" button (.bas-more) opens <dialog class="drawer drawer-bottom drawer-sheet bas-sheet"> through the data API (data-bs-toggle="drawer"). drawer-bottom docks the panel to the bottom edge. drawer-sheet makes it flush with the screen edges, and on wide screens it is centered and limited by --bs-drawer-sheet-width. --bs-drawer-height: auto lets the sheet grow to fit its content, up to 88dvh.
The share targets are buttons inside ul.bas-share, which scrolls sideways on narrow phones. The edit actions use a Bootstrap list-group list-group-flush of list-group-item-action buttons. The delete row adds theme-danger. Every action carries data-bas-action. One delegated click listener in script.js runs the action, closes the sheet with Drawer.getOrCreateInstance(sheet).hide() and then shows a Bootstrap 6 Toast with the message from the MESSAGES map. "Copy link" tries navigator.clipboard.writeText() inside try/catch, because sandboxed previews block the clipboard. "Pin" toggles aria-pressed, swaps its label and shows a pin mark on the note.
In the demo the dialog has the open attribute, so the sheet is visible on load. A :has() rule dims the page behind it until the sheet is opened as a real modal with its own backdrop.
Customization
--bas-accenton.bas-root: the indigo accent for the copy-link circle, focus rings, the pin state and toast icons..bas-i1to.bas-i5: the background colors of the five share circles.--bs-drawer-sheet-widthon.bas-sheet: the maximum width of the sheet on large screens (640px here).--bs-drawer-border-radiuson.bas-sheet: how round the top corners are.MESSAGESinscript.js: the toast text for eachdata-bas-action. Replace these with calls to your own share and edit functions.data-bs-delayon.bas-toast: how long the confirmation toast stays visible.- Remove
openfrom the<dialog>to start with the sheet closed.
Use cases
- Notes apps: a more button opens a bottom sheet with edit actions for the selected note
- File and task apps: a row of round share targets sits above the list of actions
- Mobile web apps: a drag handle, pin toggle and red delete option feel like a native sheet
- Item menus: a full-width Cancel button closes the sheet, and toasts confirm each action
Accessibility
The sheet is a native <dialog> labelled by its title. After the first open it is modal, with a focus trap, Escape to close and a backdrop click to dismiss. On mobile it also closes with a downward swipe. Share and edit groups have visually hidden headings, and every icon is aria-hidden next to a visible text label. The pin action exposes its state with aria-pressed. The toast uses role="status". Focus goes back to the "⋯" button when the sheet closes, and the script keeps that button's aria-expanded in sync.
Bootstrap 6 notes
- The Bootstrap 5
offcanvas-bottombecomes<dialog class="drawer drawer-bottom">, and the newdrawer-sheetmodifier gives the native bottom-sheet look. - Buttons use
btn-subtle theme-*. - List items take
theme-dangerinstead oflist-group-item-danger. - The toast is shown with the
Toastexport from the ES module bundle. - This snippet is built on 6.0.0-alpha.1.