Skip to content

CSS: tray

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

Start/end placements resolve against inset-inline (logical, direction-aware); the slide-in transform mirrors automatically under an ancestor [dir="rtl"], so no extra markup is needed for right-to-left layouts.

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 -placement-end -size-sm">
  <span class="instui-heading -level-h3">Filters</span>
  <p class="-size-sm">A tray slides in from the start edge and fills the viewport height.</p>
</div>
<button class="instui-button -toggle">toggle tray</button>

Structure

text
.instui-tray
  close-button (component, 0..1)
  ‹content›
flowchart TD n0[".instui-tray"]:::cssdoc-root n1(["close-button"]):::cssdoc-component n2[/"‹content›"/]:::cssdoc-slot n0 -.->|0..1| n1 n0 --> n2 click n1 "/api/css/close-button.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-start(default) Pin to the start (inline-start) edge.
.-placement-topPin to the top edge.
.-size-largeLarge. Long-form alias of -size-lg.
.-size-lgLarge.
.-size-md(default) Medium.
.-size-medium(default) Medium. Long-form alias of -size-md.
.-size-regularDeprecated — use .-size-md.
.-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>LightDarklight-dark(#ffffff, #1C222B)
--instui-component-tray-border-color<color>LightDarklight-dark(#E8EAEC, #334450)
--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-topmostnone | <shadow>#
--tray-slide-x-100%
--tray-slide-y0%

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.