Skip to main content

Sliding Container

shadow

wje-sliding-container displays a contextual panel from the left, right, or bottom edge of its selected layout scope. The direction="left|right|bottom" attribute selects the edge; bottom drawers are not limited to mobile viewports.

directionBehavior
leftHorizontal drawer anchored to the left edge.
rightHorizontal drawer anchored to the right edge. This is the default.
bottomBottom drawer with vertical motion and an optional resize handle. It always uses overlay geometry.

Expanded panel

An open side panel can display a second area with arbitrary content, such as a PDF preview. The application supplies its content through the named expanded slot; the component neither creates nor clears that content.

  • expanded-width sets the width of the expanded area E, not the total width. It accepts valid CSS sizes, including calc() and %; percentages resolve against the base panel width B.
  • expanded-direction sets the physical side where the expanded area is rendered next to the base panel (left or right). When omitted, it defaults to the side opposite direction.
  • expanded-trigger names a document event that toggles the expanded area, just as trigger toggles the base panel.

With variant="in-place", the reserved layout space depends on the relationship between both directions:

variantDirection relationshipSpace reserved in layoutLayer over page content
in-placeexpanded-direction equals directionbase panel Bexpanded area E
in-placeexpanded-direction is opposite to directionexpanded area Ebase panel B
overany combinationnoneboth panels B + E

For example, with B = 444px, E = 700px, direction="left", and expanded-direction="right", expanding shifts the page content by an additional 256px. The mirrored direction="right" and expanded-direction="left" combination behaves the same way from the opposite side. E may also be smaller than B; in that case, the reserved space shrinks. The expanded area has the same height as the base panel and its wrapper uses overflow: hidden, so slotted content controls any scrolling.

<wje-button dialog="contract-detail">Open contract</wje-button>

<wje-sliding-container
id="contract-detail"
trigger="contract-detail"
expanded-trigger="contract-preview"
direction="left"
variant="in-place"
max-width="444px"
expanded-width="700px"
expanded-direction="right"
>
<section>
<h3>Employment contract</h3>
<wje-button dialog="contract-preview">Preview</wje-button>
</section>

<div id="contract-preview-host" slot="expanded">
<iframe title="Contract preview" src="/preview/contract.pdf"></iframe>
</div>
</wje-sliding-container>

Check availability with canExpand() before opening the preview. It returns false when the base panel is closed, the slot has no content, the width is invalid or non-positive, or the requested side would not fit in the current viewport. The component does not automatically flip direction or clamp the width. If an already expanded group stops fitting after a viewport change, the expanded area collapses automatically. Expansion is always disabled with direction="bottom".

APIResult
canExpand(): booleanReports whether the expanded area can currently be displayed.
expand(): Promise<boolean>Opens it and returns true; unavailable or interrupted expansion returns false.
collapse(): Promise<boolean>Collapses only the expanded area and keeps the base panel open.
toggleExpanded(): Promise<boolean>Toggles the expanded area.
resetExpanded(): voidRestores the base state immediately, without animation.
isExpanded: booleanRead-only expanded-state flag.

After collapse, the slotted DOM stays connected, while its wrapper is hidden, inert, and aria-hidden. Closing the whole container resets expansion, so the next open shows only the base panel. When loading another record, the application should call resetExpanded() and clear or replace the slot host content itself:

const panel = document.querySelector('#contract-detail');
const previewHost = document.querySelector('#contract-preview-host');

function loadContractPreview(previewElement) {
panel.resetExpanded();
previewHost.replaceChildren(previewElement);
}

The component dispatches wje-sliding-container:beforeExpand and wje-sliding-container:expand while opening, and wje-sliding-container:beforeCollapse and wje-sliding-container:afterCollapse while collapsing. Style the expanded wrapper through part="expanded"; customize its background with --wje-sliding-container-expanded-background.

Backdrop

The boolean backdrop attribute enables a full-viewport backdrop while the panel is open. The same body-level portaled layer is used for every direction, so stacking and animation remain consistent. The backdrop does not lock document scrolling.

backdrop by itself blocks interaction with the covered content. Add backdrop-dismiss when clicking the backdrop should also close the panel. For new usage, backdrop-dismiss without backdrop does not create a layer.

There is one backwards-compatibility exception: an active legacy mobile-presentation="bottom-sheet" configuration with backdrop-dismiss still creates a backdrop without an explicit backdrop, matching earlier releases. When touching existing code, add backdrop explicitly so the intent is clear and the same configuration also works with direct direction="bottom" usage.

<wje-sliding-container
backdrop
backdrop-dismiss
style="
--wje-sliding-container-backdrop-background: rgba(15, 23, 42, .55);
--wje-sliding-container-backdrop-opacity: .9;
--wje-sliding-container-backdrop-filter: blur(2px);
"
>
<div>Detail</div>
</wje-sliding-container>
CSS tokenPurpose
--wje-sliding-container-backdrop-backgroundBackdrop color or any valid CSS background.
--wje-sliding-container-backdrop-opacityFinal open backdrop opacity; defaults to 1.
--wje-sliding-container-backdrop-filterFilter for content below the backdrop, such as blur(2px); defaults to none.
--wje-sliding-container-backdrop-z-indexGlobal portaled backdrop z-index; defaults to one layer below the host.

Backdrop opening and closing use the same animation-duration and animation-easing as the panel. The older --wje-sliding-container-portal-backdrop-z-index token remains supported as a fallback.

Bottom drawer

Enable bottom presentation directly with direction="bottom". It works on desktop and mobile and does not support the expanded slot. For user-resizable height, add sheet-resizable and set sheet-height, sheet-min-height, and sheet-max-height.

A direct direction="bottom" drawer is scoped to its parent container by default, matching the side directions. Set scope="viewport" to explicitly stretch it across the viewport; scope="container" or scope="parent" keeps it local. An enabled backdrop remains page-wide.

The older sheet-scope and sheet-boundary attributes remain supported. With scope="container" or sheet-scope="container", sheet-boundary can point to the closest composed ancestor selector that should bound the panel.

<wje-button dialog="reservation-panel">Open panel</wje-button>

<wje-sliding-container
trigger="reservation-panel"
direction="bottom"
scope="container"
max-height="85vh"
sheet-resizable
sheet-height="55vh"
sheet-min-height="35vh"
sheet-max-height="92vh"
backdrop
backdrop-dismiss
has-opacity
>
<div class="panel-content">
<h3>Reservation details</h3>
<p>The drawer opens from the bottom edge of its container.</p>
</div>
</wje-sliding-container>

The panel uses the sliding-container part; the resize handle uses sheet-handle-area and sheet-handle.

Legacy responsive API compatibility

Existing mobile-presentation="bottom-sheet" and mobile-break-point usage remains supported. Below the breakpoint it resolves internally to an effective bottom direction; above it, the configured left or right direction is preserved. Without an explicit scope or sheet-scope, the legacy adapter keeps its original viewport scope, and pairing it with backdrop-dismiss preserves the original implicit backdrop.

The public isBottomSheet() method remains available for existing application lifecycle hooks. It returns true for an active legacy mobile presentation and for direct direction="bottom". For new code, prefer direction="bottom" whenever the drawer should stay at the bottom regardless of viewport size.

When to use

Use wje-sliding-container when you need a contextual panel, filter, record detail, or workspace that slides from a viewport edge.

When not to use

Do not use it to solve business logic or for stateful orchestration of components.

Accessibility

Name the panel with label or aria-label, preserve the logical order of focusable elements, and for modal usage verify that the user can close the panel from the keyboard and a visible control.

  • Select the direction and variant first, then fine-tune size and animation.
  • Prefer consistent spacing tokens over ad-hoc margin/padding values.
  • With direction="bottom", test background scrolling, backdrop dismiss, and height changes on desktop and a real mobile viewport.

Attributes and properties

addToHeight

PopisNastavuje rozmery alebo veľkosť pre voľbu add-to-height.
Atribútadd-to-height
Typstring
Predvolené0

animationDuration

PopisNastavuje textovú hodnotu uloženú vo voľbe animation-duration.
Atribútanimation-duration
Typstring
Predvolené500

animationEasing

PopisNastavuje textovú hodnotu uloženú vo voľbe animation-easing.
Atribútanimation-easing
Typstring
Predvolenélinear

backdrop

PopisUrčuje, či je voľba backdrop zapnutá a ovplyvňuje správanie komponentu.
Atribútbackdrop
Typboolean
Predvolenéfalse

backdropDismiss

PopisUrčuje, či je voľba backdrop-dismiss zapnutá a ovplyvňuje správanie komponentu.
Atribútbackdrop-dismiss
Typboolean
Predvolenéfalse

direction

PopisRiadi správanie voľby direction v komponente.
Atribútdirection
Typ'left'|'right'|'bottom'
Predvolené-

expandedDirection

PopisNastavuje textovú hodnotu uloženú vo voľbe expanded-direction.
Atribútexpanded-direction
Typstring
Predvolené-

expandedTrigger

PopisNastavuje textovú hodnotu uloženú vo voľbe expanded-trigger.
Atribútexpanded-trigger
Typstring
Predvolené-

expandedWidth

PopisNastavuje rozmery alebo veľkosť pre voľbu expanded-width.
Atribútexpanded-width
Typstring
Predvolené-

hasOpacity

PopisUrčuje, či je voľba has-opacity zapnutá a ovplyvňuje správanie komponentu.
Atribúthas-opacity
Typboolean
Predvolenéfalse

maxHeight

PopisNastavuje rozmery alebo veľkosť pre voľbu max-height.
Atribútmax-height
Typstring
Predvolenéauto

maxWidth

PopisNastavuje rozmery alebo veľkosť pre voľbu max-width.
Atribútmax-width
Typstring
Predvolenéauto

mobileBreakPoint

PopisNastavuje textovú hodnotu uloženú vo voľbe mobile-break-point.
Atribútmobile-break-point
Typstring
Predvolené768

mobilePresentation

PopisNastavuje textovú hodnotu uloženú vo voľbe mobile-presentation.
Atribútmobile-presentation
Typstring
Predvolené-

removeChildAfterClose

PopisUrčuje, či je voľba remove-child-after-close zapnutá a ovplyvňuje správanie komponentu.
Atribútremove-child-after-close
Typboolean|string
Predvolenéfalse

scope

PopisNastavuje textovú hodnotu uloženú vo voľbe scope.
Atribútscope
Typstring
Predvolené-

screenBreakPoint

PopisNastavuje textovú hodnotu uloženú vo voľbe screen-break-point.
Atribútscreen-break-point
Typstring
Predvolené-

sheetBoundary

PopisNastavuje textovú hodnotu uloženú vo voľbe sheet-boundary.
Atribútsheet-boundary
Typstring
Predvolené-

sheetHeight

PopisNastavuje rozmery alebo veľkosť pre voľbu sheet-height.
Atribútsheet-height
Typstring
Predvolené-

sheetMaxHeight

PopisNastavuje rozmery alebo veľkosť pre voľbu sheet-max-height.
Atribútsheet-max-height
Typstring
Predvolené-

sheetMinHeight

PopisNastavuje rozmery alebo veľkosť pre voľbu sheet-min-height.
Atribútsheet-min-height
Typstring
Predvolené-

sheetResizable

PopisUrčuje, či je voľba sheet-resizable zapnutá a ovplyvňuje správanie komponentu.
Atribútsheet-resizable
Typboolean
Predvolenéfalse

sheetScope

PopisNastavuje textovú hodnotu uloženú vo voľbe sheet-scope.
Atribútsheet-scope
Typstring
Predvolenéviewport

trigger

PopisNastavuje textovú hodnotu uloženú vo voľbe trigger.
Atribúttrigger
Typstring
Predvolenésliding-container

variant

PopisNastavuje ARIA metadáta, ktoré zlepšujú prístupnosť pre asistenčné technológie.
Atribútvariant
Typstring
Predvolenéin-place

Events

NázovPopis
wje-sliding-container:beforeExpandVyvolá sa pri odoslaní udalosti wje-sliding-container:beforeExpand.
wje-sliding-container:expandVyvolá sa pri odoslaní udalosti wje-sliding-container:expand.
wje-sliding-container:beforeCollapseVyvolá sa pri odoslaní udalosti wje-sliding-container:beforeCollapse.
wje-sliding-container:afterCollapseVyvolá sa pri odoslaní udalosti wje-sliding-container:afterCollapse.
wje-sliding-container:beforeOpenVyvolá sa pri otvorení komponentu.
wje-sliding-container:openVyvolá sa pri otvorení komponentu.
wje-sliding-container:beforeCloseVyvolá sa pri zatvorení komponentu.
wje-sliding-container:afterCloseVyvolá sa pri zatvorení komponentu.

Methods

startResizeObservation

PopisSpustí metódu startResizeObservation na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

stopResizeObservation

PopisSpustí metódu stopResizeObservation na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

bindTrigger

PopisSpustí metódu bindTrigger na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

unbindTrigger

PopisSpustí metódu unbindTrigger na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

bindExpandedTrigger

PopisSpustí metódu bindExpandedTrigger na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

unbindExpandedTrigger

PopisSpustí metódu unbindExpandedTrigger na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

usesBottomPresentation

PopisSpustí metódu usesBottomPresentation na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => boolean

usesLegacyBottomSheetPresentation

PopisSpustí metódu usesLegacyBottomSheetPresentation na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => boolean

isBottomSheet

PopisOverí, či je bottom sheet aktuálne pravda.
Signatúra() => boolean

setBaseInteractionState

PopisNastaví base interaction state a aplikuje súvisiace zmeny stavu.
Signatúra(isInteractive: boolean) => void

htmlSheetHandle

PopisVytvorí HTML štruktúru pre html sheet handle.
Signatúra() => HTMLElement

getClosestComposedElement

PopisVráti closest composed element z aktuálneho stavu komponentu.
Signatúra(selector: string) => Element|null

getViewportFrame

PopisVráti viewport frame z aktuálneho stavu komponentu.
Signatúra() => {top: number, left: number, right: number, bottom: number, width: number, height: number}

getBottomScopeElement

PopisVráti bottom scope element z aktuálneho stavu komponentu.
Signatúra() => Element|null

getBottomScopeFrame

PopisVráti bottom scope frame z aktuálneho stavu komponentu.
Signatúra() => {top: number, left: number, right: number, bottom: number, width: number, height: number}

setBottomLayerFrame

PopisNastaví bottom layer frame a aplikuje súvisiace zmeny stavu.
Signatúra(element: HTMLElement|SlidingContainer, frame: object) => void

resetBottomLayerFrame

PopisObnoví bottom layer frame na počiatočné hodnoty.
Signatúra(element: HTMLElement|SlidingContainer) => void

getInlineStyleValue

PopisVráti inline style hodnotu z aktuálneho stavu komponentu.
Signatúra(style: CSSStyleDeclaration, property: string) => string

restoreInlineStyleValue

PopisSpustí metódu restoreInlineStyleValue na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(style: CSSStyleDeclaration, property: string, value: string) => void

setSideOverVariant

PopisNastaví side over variant a aplikuje súvisiace zmeny stavu.
Signatúra() => void

resetSideOverVariant

PopisObnoví side over variant na počiatočné hodnoty.
Signatúra() => void

hasExpandedContent

PopisOverí, či komponent obsahuje expanded content.
Signatúra() => boolean

getBaseWidthInPixels

PopisVráti base width in pixels z aktuálneho stavu komponentu.
Signatúra() => number

resolveExpandedWidth

PopisSpustí metódu resolveExpandedWidth na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => number

positionExpandedPanel

PopisSpustí metódu positionExpandedPanel na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(baseWidth: number) => void

swapsExpandedFlowPanel

PopisSpustí metódu swapsExpandedFlowPanel na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => boolean

getExpandedAnchorLeft

PopisVráti expanded anchor left z aktuálneho stavu komponentu.
Signatúra(baseWidth: number, expandedWidth: number) => number

resetPanelsAnchor

PopisObnoví panels anchor na počiatočné hodnoty.
Signatúra() => void

showExpandedContent

PopisZobrazí expanded content v používateľskom rozhraní komponentu.
Signatúra() => void

hideExpandedContent

PopisSkryje expanded content v používateľskom rozhraní komponentu.
Signatúra() => void

applyExpandedState

PopisSpustí metódu applyExpandedState na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(isExpanded: boolean, baseWidth?: number, expandedWidth?: number) => void

canExpand

PopisSpustí metódu canExpand na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => boolean

syncExpandedAfterDraw

PopisSynchronizuje expanded after draw s externým alebo interným zdrojom stavu.
Signatúra() => void

applyBottomPresentation

PopisSpustí metódu applyBottomPresentation na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

resetBottomPresentation

PopisObnoví bottom presentation na počiatočné hodnoty.
Signatúra() => void

setBottomVisualState

PopisNastaví bottom visual state a aplikuje súvisiace zmeny stavu.
Signatúra(isOpen: boolean) => void

getSheetMaxHeight

PopisVráti sheet max height z aktuálneho stavu komponentu.
Signatúra() => string

setSheetHeight

PopisNastaví sheet height a aplikuje súvisiace zmeny stavu.
Signatúra() => void

getSheetMinHeightInPixels

PopisVráti sheet min height in pixels z aktuálneho stavu komponentu.
Signatúra() => number

getSheetMaxHeightInPixels

PopisVráti sheet max height in pixels z aktuálneho stavu komponentu.
Signatúra() => number

getBottomAvailableHeight

PopisVráti bottom available height z aktuálneho stavu komponentu.
Signatúra() => number

isSheetHandleEvent

PopisOverí, či je sheet handle udalosť aktuálne pravda.
Signatúra(e: Event) => boolean

isEventInsideSheet

PopisOverí, či je udalosť inside sheet aktuálne pravda.
Signatúra(e: Event) => boolean

startSheetDrag

PopisSpustí metódu startSheetDrag na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(pointerId: number|string, startY: number) => void

updateSheetDrag

PopisAktualizuje sheet ťahanie podľa najnovších údajov komponentu.
Signatúra(clientY: number) => void

endSheetDrag

PopisSpustí metódu endSheetDrag na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

beforeExpand

PopisSpustí sa pred expand a pripraví stav komponentu.
Signatúra(e?: Event) => void

afterExpand

PopisSpustí sa po expand a dokončí nadväzujúce operácie.
Signatúra(e?: Event) => void

beforeCollapse

PopisSpustí sa pred collapse a pripraví stav komponentu.
Signatúra(e?: Event) => void

afterCollapse

PopisSpustí sa po collapse a dokončí nadväzujúce operácie.
Signatúra(e?: Event) => void

cancelExpandedTransition

PopisSpustí metódu cancelExpandedTransition na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

completeExpandedTransition

PopisSpustí metódu completeExpandedTransition na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(transition: object) => void

finishExpandedTransitionImmediately

PopisSpustí metódu finishExpandedTransitionImmediately na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

animateExpandedTransition

PopisSpustí metódu animateExpandedTransition na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(target: boolean, baseWidth: number, expandedWidth: number) => Promise<boolean>

expand

PopisRozbalí aktuálnu accordion položku a aktualizuje jej ARIA expanded stav.
Signatúra(e?: Event) => Promise<boolean>

collapse

PopisZbalí aktuálnu accordion položku a aktualizuje jej ARIA expanded stav.
Signatúra(e?: Event) => Promise<boolean>

toggleExpanded

PopisPrepne expanded medzi zapnutým a vypnutým stavom.
Signatúra(e?: Event) => Promise<boolean>

resetExpanded

PopisObnoví expanded na počiatočné hodnoty.
Signatúra() => void

getAnimationOptions

PopisVráti animation položky z aktuálneho stavu komponentu.
Signatúra() => object

finishBaseTransitionImmediately

PopisSpustí metódu finishBaseTransitionImmediately na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra() => void

setSideVisualState

PopisNastaví side visual state a aplikuje súvisiace zmeny stavu.
Signatúra(isOpen: boolean) => void

doAnimateBottomTransition

PopisSpustí metódu doAnimateBottomTransition na vykonanie logiky komponentu a aktualizáciu jeho stavu.
Signatúra(options: object) => Promise<void>

open

PopisOtvorí komponent a nastaví viditeľný stav.
Signatúra(e: Event) => Promise<void>

close

PopisZatvorí komponent a odstráni stav viditeľnosti.
Signatúra(e: Event) => Promise<void>

setBottomClosedState

PopisNastaví bottom closed state a aplikuje súvisiace zmeny stavu.
Signatúra() => void

toggle

PopisPrepne toggle medzi zapnutým a vypnutým stavom.
Signatúra(e: Event) => Promise<void>

CSS shadow parts

NázovPopis
backdropŠtýluje shadow časť backdrop.
sliding-containerŠtýluje shadow časť sliding-container.
expandedŠtýluje shadow časť expanded.
close-buttonŠtýluje shadow časť close-button.
sheet-handle-areaŠtýluje shadow časť sheet-handle-area.
sheet-handleŠtýluje shadow časť sheet-handle.

CSS custom variables

NázovPopis
--wje-sliding-container-backgroundVlastná CSS premenná na štýlovanie komponentu (background).
--wje-sliding-container-expanded-backgroundVlastná CSS premenná na štýlovanie komponentu (expanded background).
--wje-sliding-container-z-indexVlastná CSS premenná na štýlovanie komponentu (z index).
--wje-sliding-container-bottom-sheet-z-indexVlastná CSS premenná na štýlovanie komponentu (bottom sheet z index).
--wje-sliding-container-bottom-sheet-panel-z-indexVlastná CSS premenná na štýlovanie komponentu (bottom sheet panel z index).
--wje-sliding-container-backdrop-z-indexVlastná CSS premenná na štýlovanie komponentu (backdrop z index).
--wje-sliding-container-portal-backdrop-z-indexVlastná CSS premenná na štýlovanie komponentu (portal backdrop z index).
--wje-sliding-container-backdrop-backgroundVlastná CSS premenná na štýlovanie komponentu (backdrop background).
--wje-sliding-container-backdrop-opacityVlastná CSS premenná, ktorá riadi úroveň priehľadnosti.
--wje-sliding-container-backdrop-filterVlastná CSS premenná na štýlovanie komponentu (backdrop filter).
--wje-sliding-container-box-shadowVlastná CSS premenná, ktorá riadi tieň.
--wje-sliding-container-sheet-border-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.
--wje-sliding-container-sheet-handle-area-heightVlastná CSS premenná, ktorá riadi sheet handle area height.
--wje-sliding-container-sheet-handle-widthVlastná CSS premenná, ktorá riadi sheet handle width.
--wje-sliding-container-sheet-handle-heightVlastná CSS premenná, ktorá riadi sheet handle height.
--wje-sliding-container-sheet-handle-backgroundVlastná CSS premenná na štýlovanie komponentu (sheet handle background).
--wje-sliding-container-sheet-handle-radiusVlastná CSS premenná, ktorá riadi zaoblenie rohov.

Slots

NázovPopis
defaultPredvolený slot pre hlavný obsah komponentu.
expandedSlot pre vlastný obsah expanded v komponente.

Content