Skip to content

CSS: drawer-layout ​

.instui-drawer-layout — A split layout with a collapsible side tray and a primary scrollable content pane.

-placement-end and the default (start) both use flex-direction/inset-inline-* logical properties, not left/right, so the tray's side follows direction/dir="rtl" automatically — no separate RTL rules are needed.

Source: drawer-layout.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/drawer-layout.css";

Examples ​

html
<div class="instui-drawer-layout" id="drawer" open>
  <div class="tray" role="region" aria-label="Course panel">Navigation</div>
  <div class="content" role="region" aria-label="Course content">Main content</div>
</div>

Structure ​

text
.instui-drawer-layout
  drawer-layout.tray (component)
  drawer-layout.content (component)
flowchart TD n0[".instui-drawer-layout"]:::cssdoc-root n1(["drawer-layout.tray"]):::cssdoc-component n2(["drawer-layout.content"]):::cssdoc-component n0 --> n1 n0 --> n2 click n1 "/api/css/drawer-layout.tray.md" click n2 "/api/css/drawer-layout.content.md" classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifiers ​

ModifierDescription
.-openShow the tray even when the open attribute is absent.
.-placement-endDock the tray on the inline-end side.
.-placement-startDock the tray on the inline-start side (the default; sets it explicitly).
.-should-overlay-trayInteraction — Render the tray as an overlay instead of shrinking content inline.

Parts ​

PartDescription
.contentThe main pane.
.trayThe side panel.

Custom properties ​

PropertyTypeDefaultDescription
--pantoken-bp-md——Width threshold for overlay mode (30em, themed via responsive utilities).

Accessibility ​

Name every region with aria-label or aria-labelledby. Use div for InstUI-style regions, not <main role="region">. When the tray acts as navigation, use a named <nav> or place one inside the tray.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
less-contrast-stays-readableWCAG 2.2 1.4.3Review neededReview neededReview neededReview needed

The page changes under prefers-contrast: less, but no visible text was measurable.

more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6Review neededReview neededReview neededReview needed

The page changes under prefers-contrast: more, but no visible text was measurable.

reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Browser support ​

  • The drawer-layout.tray/drawer-layout.content members switch to overlay mode automatically via a @container query once this element's inline-size drops below tray-width + --pantoken-bp-md. The @pantoken/interactions behavior additionally toggles [should-overlay-tray]/.-should-overlay-tray (a manual override) and emits overlaytraychange for apps that need the change as an event.

Subcomponents ​

  • tray — A standalone edge overlay; this layout keeps tray and content in the same flow.
  • context-view — A smaller anchored surface for contextual actions and detail.