Sheet
Extends the Dialog component to display content that complements the main content of the screen.
import { Component } from '@angular/core';
import { provideIcons } from '@ng-icons/core';
import { lucideCross } from '@ng-icons/lucide';
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
import { HlmInputDirective } from '@spartan-ng/ui-input-helm';
import { HlmLabelDirective } from '@spartan-ng/ui-label-helm';
import { BrnSheetContentDirective, BrnSheetTriggerDirective } from '@spartan-ng/brain/sheet';
import {
HlmSheetComponent,
HlmSheetContentComponent,
HlmSheetDescriptionDirective,
HlmSheetFooterComponent,
HlmSheetHeaderComponent,
HlmSheetTitleDirective,
} from '@spartan-ng/ui-sheet-helm';
@Component({
selector: 'spartan-sheet-preview',
standalone: true,
imports: [
BrnSheetTriggerDirective,
BrnSheetContentDirective,
HlmSheetComponent,
HlmSheetContentComponent,
HlmSheetHeaderComponent,
HlmSheetFooterComponent,
HlmSheetTitleDirective,
HlmSheetDescriptionDirective,
HlmButtonDirective,
HlmInputDirective,
HlmIconComponent,
HlmLabelDirective,
],
providers: [provideIcons({ lucideCross })],
template: `
<hlm-sheet side="right">
<button id="edit-profile" variant="outline" brnSheetTrigger hlmBtn>Edit Profile</button>
<hlm-sheet-content *brnSheetContent="let ctx">
<hlm-sheet-header>
<h3 hlmSheetTitle>Edit Profile</h3>
<p hlmSheetDescription>Make changes to your profile here. Click save when you're done.</p>
</hlm-sheet-header>
<div class="py-4 grid gap-4">
<div class="items-center grid grid-cols-4 gap-4">
<label hlmLabel for="name" class="text-right">Name</label>
<input hlmInput id="name" value="Pedro Duarte" class="col-span-3" />
</div>
<div class="items-center grid grid-cols-4 gap-4">
<label hlmLabel for="username" class="text-right">Username</label>
<input hlmInput id="username" value="@peduarte" class="col-span-3" />
</div>
</div>
<hlm-sheet-footer>
<button hlmBtn type="submit">Save Changes</button>
</hlm-sheet-footer>
</hlm-sheet-content>
</hlm-sheet>
`,
})
export class SheetPreviewComponent {}
Installation
npx nx g @spartan-ng/cli:ui sheet
ng g @spartan-ng/cli:ui sheet
Usage
import { BrnSheetContentDirective, BrnSheetTriggerDirective } from '@spartan-ng/brain/sheet';
import {
HlmSheetComponent,
HlmSheetContentComponent,
HlmSheetDescriptionDirective,
HlmSheetFooterComponent,
HlmSheetHeaderComponent,
HlmSheetTitleDirective,
} from '@spartan-ng/ui-sheet-helm';
<hlm-sheet>
<button brnSheetTrigger>Edit Profile</button>
<hlm-sheet-content *brnSheetContent='let ctx'>
<hlm-sheet-header>
<h3 hlmSheetTitle>Edit Profile</h3>
<p hlmSheetDescription>Make changes to your profile here. Click save when you're done.</p>
</hlm-sheet-header>
</hlm-sheet-content>
</hlm-sheet>
Examples
Sides
import { Component } from '@angular/core';
import { provideIcons } from '@ng-icons/core';
import { lucideCross } from '@ng-icons/lucide';
import { HlmButtonDirective } from '@spartan-ng/ui-button-helm';
import { HlmIconComponent } from '@spartan-ng/ui-icon-helm';
import { HlmInputDirective } from '@spartan-ng/ui-input-helm';
import { HlmLabelDirective } from '@spartan-ng/ui-label-helm';
import { BrnSheetContentDirective, BrnSheetTriggerDirective } from '@spartan-ng/brain/sheet';
import {
HlmSheetComponent,
HlmSheetContentComponent,
HlmSheetDescriptionDirective,
HlmSheetFooterComponent,
HlmSheetHeaderComponent,
HlmSheetTitleDirective,
} from '@spartan-ng/ui-sheet-helm';
@Component({
selector: 'spartan-sheet-side-preview',
standalone: true,
imports: [
BrnSheetTriggerDirective,
BrnSheetContentDirective,
HlmSheetComponent,
HlmSheetContentComponent,
HlmSheetHeaderComponent,
HlmSheetFooterComponent,
HlmSheetTitleDirective,
HlmSheetDescriptionDirective,
HlmButtonDirective,
HlmInputDirective,
HlmIconComponent,
HlmLabelDirective,
],
providers: [provideIcons({ lucideCross })],
template: `
<hlm-sheet>
<div class="grid grid-cols-2 gap-2">
<button id="left" variant="outline" brnSheetTrigger side="left" hlmBtn>left</button>
<button id="right" variant="outline" brnSheetTrigger side="right" hlmBtn>right</button>
<button id="top" variant="outline" brnSheetTrigger side="top" hlmBtn>top</button>
<button id="bottom" variant="outline" brnSheetTrigger side="bottom" hlmBtn>bottom</button>
</div>
<hlm-sheet-content *brnSheetContent="let ctx">
<hlm-sheet-header>
<h3 hlmSheetTitle>Edit Profile</h3>
<p hlmSheetDescription>Make changes to your profile here. Click save when you're done.</p>
</hlm-sheet-header>
<div class="py-4 grid gap-4">
<div class="items-center grid grid-cols-4 gap-4">
<label hlmLabel for="name" class="text-right">Name</label>
<input hlmInput id="name" value="Pedro Duarte" class="col-span-3" />
</div>
<div class="items-center grid grid-cols-4 gap-4">
<label hlmLabel for="username" class="text-right">Username</label>
<input hlmInput id="username" value="@peduarte" class="col-span-3" />
</div>
</div>
<hlm-sheet-footer>
<button hlmBtn type="submit">Save Changes</button>
</hlm-sheet-footer>
</hlm-sheet-content>
</hlm-sheet>
`,
})
export class SheetSidePreviewComponent {}