Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Open from a button

The footer stays pinned while the body scrolls, so the action is always in reach.

Filters drawer
Filters
3 applied

Status, owner and due date narrow the list.

The handle on a phone also answers the arrow keys, Home and End.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#filtersDrawer">Filters</app-button>
<app-drawer id="filtersDrawer" title="Filters" subtitle="3 applied">
    …
    <app-drawer-footer><app-button type="Button" size="WideSize.Sm" data-wui-dismiss>Apply</app-button></app-drawer-footer>
</app-drawer>

Snap points

On a phone the sheet rests at each point, as a percentage of the screen height.

Three heights, opening in the middle
Details

Drag the handle up for more, down for less, and below the lowest point to close.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#snapDrawer">Three heights</app-button>
<app-drawer id="snapDrawer" title="Details" snap-points="30,60,95" default-snap="1">…</app-drawer>

Side and size

Choose the edge the panel slides from, and a preset width for its size.

Large from the start edge
Activity

Recent changes to this record.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#sideDrawer">From the start</app-button>
<app-drawer id="sideDrawer" title="Activity" side="Start" size="Lg">…</app-drawer>
Extra large, 720 px wide
Details

Wide enough for a record beside its list.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#xlDrawer">Extra large</app-button>
<app-drawer id="xlDrawer" title="Details" size="Xl">…</app-drawer>

A side panel on every screen

Set sheet to false to keep a menu or filter panel at the side on a phone too.

Filters with an icon
Filters

Status, owner and due date narrow the list.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#filtersPanel">Filters</app-button>
<app-drawer id="filtersPanel" title="Filters" title-icon="filter" width="420px" sheet="false">…</app-drawer>

Forced choice

Use a static backdrop when the drawer must not close on a backdrop click, Escape or a drag down.

Only the close button closes
Review

The backdrop, Escape and a drag down do nothing here.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#staticDrawer">Static</app-button>
<app-drawer id="staticDrawer" title="Review" static-backdrop="true">…</app-drawer>

Ask before discarding edits

Ask before closing a form that has unsaved changes, so an edit is not thrown away by mistake.

Guard a form's edits
Change the name, then press Cancel: the footer asks before the edit is thrown away.
Edit contact
Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#discardDrawer">Edit</app-button>
<app-drawer id="discardDrawer" title="Edit contact" confirm-discard="Discard your changes?">
    <form>…</form>
    <app-drawer-footer>…</app-drawer-footer>
</app-drawer>

Custom header

Replace the default header with your own markup when the panel needs a heading of its own.

A header of its own
Saved views

Owner, status and due date narrow the list.

Show code
<app-button type="Button" variant="Outline" size="WideSize.Sm" data-wui-open="#headerDrawer">Saved views</app-button>
<app-drawer id="headerDrawer" close-label="Dismiss" body-class-name="p-3">
    <app-drawer-header>…</app-drawer-header>
    …
    <app-drawer-footer><app-button type="Button" size="WideSize.Sm" data-wui-dismiss>Apply</app-button></app-drawer-footer>
</app-drawer>

Every option

Every value of every prop, one cell each.

id

id="mx-id"

Status, owner and due date narrow the list.

open

open="false" (default)

Status, owner and due date narrow the list.

onClose

onClose: React callback; Razor listens for wui-drawer-close

Status, owner and due date narrow the list.

title

title="Filters"
Filters

Status, owner and due date narrow the list.

titleIcon

title-icon="filter"
Filters

Status, owner and due date narrow the list.

header

<app-drawer-header>
Saved views

Status, owner and due date narrow the list.

subtitle

subtitle="3 applied"
Filters
3 applied

Status, owner and due date narrow the list.

ariaLabel

aria-label="Filters"

Status, owner and due date narrow the list.

width

width="420px"
Filters

Status, owner and due date narrow the list.

maxWidth

max-width="600px"

Status, owner and due date narrow the list.

sheet

sheet="true" (default)

Status, owner and due date narrow the list.

sheet="false"
Filters

Status, owner and due date narrow the list.

closeLabel

close-label="Dismiss"

Status, owner and due date narrow the list.

sheetHeightLabel

sheet-height-label="Height"

Status, owner and due date narrow the list.

headerClassName

header-class-name="fw-bold"
Filters

Status, owner and due date narrow the list.

bodyClassName

body-class-name="p-0"

Status, owner and due date narrow the list.

side

side="end" (default)

Status, owner and due date narrow the list.

side="start"

Status, owner and due date narrow the list.

size

size="sm"

Status, owner and due date narrow the list.

size="md" (default)

Status, owner and due date narrow the list.

size="lg"

Status, owner and due date narrow the list.

size="xl"

Status, owner and due date narrow the list.

snapPoints

snap-points="50,90" (default)

Status, owner and due date narrow the list.

snap-points="30,60,95"

Status, owner and due date narrow the list.

snap-points="40"

Status, owner and due date narrow the list.

snap-points="100"

Status, owner and due date narrow the list.

defaultSnap

default-snap="0" (default)

Status, owner and due date narrow the list.

default-snap="1"

Status, owner and due date narrow the list.

onSnapChange

onSnapChange: React callback; Razor listens for wui-drawer-snap

Status, owner and due date narrow the list.

onOpened

onOpened: React callback; Razor listens for wui-drawer-opened

Status, owner and due date narrow the list.

onClosed

onClosed: React callback; Razor listens for wui-drawer-closed

Status, owner and due date narrow the list.

dismissible

dismissible="true" (default)

Status, owner and due date narrow the list.

dismissible="false"

Status, owner and due date narrow the list.

staticBackdrop

static-backdrop="true" (default)

Status, owner and due date narrow the list.

static-backdrop="false"

Status, owner and due date narrow the list.

confirmDiscard

confirm-discard="Discard your changes?"

dirty

dirty: React prop; Razor asks once a field in the drawer changes

footer

no footer (default)

Status, owner and due date narrow the list.

<app-drawer-footer>

Status, owner and due date narrow the list.

className

class: React className; a plain class attribute on app-drawer

Status, owner and due date narrow the list.

style

style: React style; a plain style attribute on app-drawer

Status, owner and due date narrow the list.

Guidance

What to do, and what to avoid.

Use it when

  • A filter, detail or edit panel that must not squeeze the page on a phone.
  • A menu or filter panel that stays a side panel on a phone (sheet false).
  • Secondary content the user opens, reads or edits, then dismisses.

Reach for something else when

  • A short confirmation or a form that needs the user's full attention. → AppModal
  • Content that belongs beside a list. → AppSplitView

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

end start
sm md lg xl
50,90 30,60,95 40 100
React, generated from the controls
<AppDrawer open={open} onClose={close} title="Filters" size="sm" footer={<AppButton>Apply</AppButton>}>…</AppDrawer>
Razor, the same props
<app-drawer id="pgDrawer" title="Filters" size="Sm">…<app-drawer-footer>…</app-drawer-footer></app-drawer>
Filters

Status, owner and due date narrow the list. Drag the handle or the header on a phone to move the sheet between its heights.

21 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
titledefault - string - The heading, and the dialog's accessible name.
sidedefault end end | start end Which edge the side drawer slides from.
opendefault false bool false Whether the drawer is open. The caller owns it and closes it in onClose.
widthdefault - string - The panel's CSS width, such as 420px. Overrides size.
sheetdefault true bool true Below md the drawer is a bottom sheet that rests on snapPoints. false keeps the side panel at every width, for a menu or a filter panel.

Less common 16 props

PropTypeDefaultDescription
iddefault required string required The id a data-wui-open="#id" trigger names.
subtitledefault - string - A line under the title.
aria-labeldefault - string - The dialog's accessible name when there is no title.
sizedefault md sm | md | lg | xl md The side drawer's width: 360, 480, 640 or 720 px.
snap-pointsdefault 50,90 string 50,90 The sheet's resting heights as a comma list, each 10 to 100 percent of the screen height.
default-snapdefault 0 int 0 Which of the sorted snap points it opens on.
dismissibledefault true bool true Show the close button.
static-backdropdefault true bool true The backdrop, Escape and a drag down leave it open; only the close button or open closes it. Set false to let them close it.
confirm-discarddefault - string - Ask before closing while dirty: this text, with Discard and Keep editing in the footer.
title-icondefault - string - Library icon beside the title.
max-widthdefault 92vw string 92vw Caps the panel's width, such as 600px. Unset, the theme caps it at 92vw.
close-labeldefault Close string Close The close button's accessible name, for other languages.
sheet-height-labeldefault Sheet height string Sheet height The sheet handle's accessible name, for other languages.
header-class-namedefault '' string '' Classes on the default header, so a product can style it without restyling the library class. Ignored when header replaces it.
body-class-namedefault '' string '' Classes on the scrolling body, such as p-0 to drop its padding.
app-drawer-headerdefault - element - A child that replaces the default title, subtitle and close button.

Screen reader

3 notes
  • The panel is a native dialog, named by ariaLabel, else by the title.
  • The sheet handle is a vertical slider labelled Sheet height, and the close button is labelled Close.
  • Focus moves in on open, Tab moves through the drawer, then on to the browser, without wrapping, Escape leaves it open unless staticBackdrop is false, and focus returns to what opened it.