Skip to content

CSS: tray

.instui-tray — An edge-pinned panel that slides in from any side; a native [popover] or <dialog>.

Source: tray.css

Accessibility

The tray is a dialog or popover surface, so name it with aria-label or aria-labelledby, and its close control carries an aria-label (the .instui-close-button in the example uses aria-label="Close").

Usage

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/tray.css";

Examples

html
<div class="instui-tray -size-sm" id="tray-start">
  <div>
    <strong>Filters</strong>
    <button class="instui-close-button" aria-label="Close"></button>
  </div>
  <p class="instui-text -size-sm">A tray slides in from the start edge and fills the viewport height.</p>
</div>
Filters

A tray slides in from the start edge and fills the viewport height.

Structure

text
.instui-tray
  div
    strong
    close-button (component)
  text (component)
flowchart TD n0[".instui-tray"]:::cssdoc-root n1("div"):::cssdoc-part n2("strong"):::cssdoc-part n3(["close-button"]):::cssdoc-component n4(["text"]):::cssdoc-component n1 --> n2 n1 --> n3 n0 --> n1 n0 --> n4 click n3 "/api/css/close-button.md" click n4 "/api/css/text.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
.-placement-bottomPin to the bottom edge.
.-placement-endPin to the end (inline-end) edge.
.-placement-topPin to the top edge.
.-size-largeLarge. Long-form alias of -size-lg.
.-size-lgLarge.
.-size-smSmall.
.-size-smallSmall. Long-form alias of -size-sm.
.-size-x-largeExtra large. Long-form alias of -size-xl.
.-size-x-smallExtra small. Long-form alias of -size-xs.
.-size-xlExtra large.
.-size-xsExtra small.

Conditions

TypeQueryDescription
supports(transition-behavior: allow-discrete)

Tokens consumed

TokenTypeValue
--instui-component-tray-background-color<color>light-dark(#ffffff, #1C222B)LightDark
--instui-component-tray-border-color<color>light-dark(#E8EAEC, #334450)LightDark
--instui-component-tray-border-width<length>0.0625rem
--instui-component-tray-padding<length>1.5rem
--instui-component-tray-width-lg<length>48em
--instui-component-tray-width-md<length>30em
--instui-component-tray-width-sm<length>20em
--instui-component-tray-width-xl<length>62em
--instui-component-tray-width-xs<length>16em
--instui-component-tray-z-index<integer>9999
--instui-elevation-topmost[ inset? && <length>{2,4} && <color>? ]# | none

Browser support

  • Opens with the native [popover] API and @starting-style; the slide-in sits behind an @supports (transition-behavior: allow-discrete) guard, so browsers without it still open the tray, just without the slide.

Subcomponents

  • modal — The same dismissible overlay pattern, centred instead of edge-pinned.
  • popover — The generic top-layer surface this builds on.