Sheet
A dialog at the edge of the screen, sliding in from its side. In the look of the app's style.
Usage
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScField, ScFieldGroup, ScInput, ScLabel, ScSelectOnFocus, ScSheet, ScSheetClose, ScSheetDescription, ScSheetFooter, ScSheetHeader, ScSheetPortal, ScSheetProvider, ScSheetTitle, ScSheetTrigger,} from '@semantic-components/ui';import { SiXIcon } from '@semantic-icons/lucide-icons';
@Component({ selector: 'app-sheet-usage-demo', imports: [ ScButton, ScField, ScFieldGroup, ScInput, ScLabel, ScSelectOnFocus, ScSheet, ScSheetClose, ScSheetDescription, ScSheetFooter, ScSheetHeader, ScSheetPortal, ScSheetProvider, ScSheetTitle, ScSheetTrigger, SiXIcon, ], template: ` <div scSheetProvider [(open)]="open"> <button scButton scSheetTrigger variant="outline">Open</button> <ng-template scSheetPortal> <div scSheet> <div scSheetHeader> <h2 scSheetTitle>Edit profile</h2> <p scSheetDescription> Make changes to your profile here. Click save when you're done. </p> </div> <div scFieldGroup class="px-4"> <div scField> <label scLabel>Name</label> <input cdkFocusInitial scSelectOnFocus="program" scInput value="Pedro Duarte" /> </div> <div scField> <label scLabel>Username</label> <input scInput value="@peduarte" /> </div> </div> <div scSheetFooter> <button scButton type="submit" (click)="open.set(false)"> Save changes </button> <button scSheetClose variant="outline" size="default">Close</button> </div> <button scSheetClose> <svg siXIcon></svg> <span class="sr-only">Close</span> </button> </div> </ng-template> </div> `, host: { class: 'flex w-full justify-center' }, encapsulation: ViewEncapsulation.None,})export class SheetUsageDemo { private readonly open = signal(false);}Anatomy
Every part is a directive on your element; the trigger, the title, the content and the close buttons are yours.
import { ScSheetProvider, ScSheetTrigger, ScSheetPortal, ScSheet, ScSheetHeader, ScSheetTitle, ScSheetDescription, ScSheetFooter, ScSheetClose,} from '@semantic-components/ui';<div scSheetProvider side="…"> <button scButton scSheetTrigger>…</button> <ng-template scSheetPortal> <div scSheet> <div scSheetHeader> <h2 scSheetTitle>…</h2> <p scSheetDescription>…</p> </div> … <div scSheetFooter>…</div> <button scSheetClose>…</button> </div> </ng-template></div>Accessibility
- A modal dialog (role="dialog", aria-modal), named by its title and described by its description.
- Focus moves into it and stays there; closing gives it back to the trigger. Escape or a press on the backdrop closes it.
- Name the ✕: it is an icon — sr-only text.
Examples
Side
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScSheet, ScSheetClose, ScSheetDescription, ScSheetHeader, ScSheetPortal, ScSheetProvider, ScSheetTitle,Inline sides
import { Component, ViewEncapsulation } from '@angular/core';import { ScButton, ScSheet, ScSheetClose, ScSheetDescription, ScSheetHeader, ScSheetPortal, ScSheetProvider, ScSheetTitle,No close button
import { Component, ViewEncapsulation, signal } from '@angular/core';import { ScButton, ScKbd, ScSheet, ScSheetDescription, ScSheetHeader, ScSheetPortal, ScSheetProvider, ScSheetTitle,RTL
import { Dir } from '@angular/cdk/bidi';import { Component, LOCALE_ID, ViewEncapsulation } from '@angular/core';import { ScButton, ScSheet, ScSheetClose, ScSheetDescription, ScSheetHeader, ScSheetPortal, ScSheetProvider,API reference
Each part takes class, merged over the style (cn: a later class wins).
| Part | Selector | Description |
|---|---|---|
ScSheetProvider | div[scSheetProvider], span[scSheetProvider] | [(open)], side ('inline-end' by default — the reading end: the right, the left in RTL; 'inline-start', 'top', 'bottom', 'left', 'right'). |
ScSheetTrigger | button[scSheetTrigger] | Opens it, on any button (aria-haspopup, aria-expanded). |
ScSheetPortal, ScSheet | ng-template[…], div[scSheet] | The content, rendered while open; the panel (role="dialog", aria-modal), named and described, sliding from its side. |
ScSheetHeader, ScSheetTitle, ScSheetDescription, ScSheetFooter | div[…], h2[…], p[…], div[…] | Its title and description at the top; its actions at the bottom. |
ScSheetClose | button[scSheetClose] | Closes it: the style's button (ghost, icon-sm); straight in the panel, in its corner. In the footer: variant and size of your choice. |