Chapter 06 Overlays
Bottom sheet
A panel that slides up from the bottom of the screen, for a short choice or the details of an item, mostly on phones. It is a dialog docked to the bottom: focus moves into it and stays there, the page behind stops scrolling, and Escape, the close button or a click above it closes it.
import {
DialogCloseDirective,
DialogComponent,A bottom sheet is the dialog with the sheet variant, so everything on that page applies here. It is as tall as its content, up to 85% of the screen; past that the body scrolls. On a wide screen it stays at the dialog size, centred. For a long form, use the drawer.
Order details
The title and the actions stay in view; the details sit between them.
<ng-template #order>
<ui-dialog title="Order 1042" description="Delivered today at 2:40 pm." variant="sheet">
<p>2 × Chicken shawarma, 1 × Lentil soup</p>
<div ui-dialog-actions>
<button ui-button variant="secondary" uiDialogClose>Close</button>
<button ui-button [uiDialogClose]="'reorder'">Order again</button>
</div>
</ui-dialog>
</ng-template>
<button ui-button (click)="show(order)">Order 1042</button>
// In the class
private readonly dialog = inject(UiDialog);
show(content: TemplateRef<unknown>) {
this.dialog.open<string>(content).closed.subscribe((result) => {
if (result === 'reorder') { /* ... */ }
});
}When to use something else
Inputs
| Name | Type | Default | What it does |
|---|---|---|---|
variant | 'default' | 'alert' | 'drawer' | 'sheet' | 'default' | 'sheet': docked to the bottom. Open it with UiDialog.open() as any dialog. |
size | 'sm' | 'md' | 'lg' | 'md' | Its width on a wide screen: 24, 32 or 48rem. The full width on a phone. |
everything else | Dialog API | — | title, description, closeLabel, [ui-dialog-actions], uiDialogClose and the open() config work as in the dialog. |
Keyboard and screen readers
| Keys | What they do |
|---|---|
| Tab or Shift + Tab | Move between the controls inside; focus stays inside. |
| Escape | Close, and put focus back on the button that opened it. |
- A dialog docked to the bottom, named by its title; the page behind stops scrolling.