Component

Sheet

A panel that slides in from any edge of the screen. Give it a title, description, and icon, project a trigger and body, size it, choose the built-in footer buttons, and drive it as a controlled overlay.

Trigger, form & footer

Last action: —

import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { HbButtonComponent, HbFieldImports, HbInputDirective, HbSheetImports } from '@herbst/ui';

@Component({
  selector: 'hb-demo-sheet-basic',
  imports: [HbSheetImports, HbButtonComponent, HbFieldImports, HbInputDirective],
  template: `
    <div class="flex flex-col items-start gap-2">
      <hb-sheet
        hbTitle="Edit photo"
        hbDescription="Update the record for IMG·019."
        hbOkText="Save"
        hbCancelText="Discard"
        (hbOk)="log.set('saved')"
        (hbCancel)="log.set('discarded')"
      >
        <button hbSheetTrigger hb-button hbType="outline">Open sheet</button>

        <div hbSheetContent class="flex flex-col gap-4">
          <hb-field>
            <label hb-field-label>Title</label>
            <input hb-input value="Oak leaves" />
          </hb-field>
          <hb-field>
            <label hb-field-label>City</label>
            <input hb-input value="Freiburg" />
          </hb-field>
        </div>
      </hb-sheet>

      <p class="font-mono text-[12px] text-muted-foreground">Last action: {{ log() }}</p>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class HbDemoSheetBasicComponent {
  protected readonly log = signal('—');
}

Sides & size

Icon, destructive & events

API reference

hb-sheet — panel

PropertyDescriptionTypeDefault
[hbSide] The edge the sheet slides in from. 'right' | 'left' | 'top' | 'bottom' 'right'
[hbSize] Width (left/right) or height (top/bottom) as any CSS length. string '24rem'
[hbTitle] / [hbDescription] / [hbIcon] The header heading, supporting text, and a leading icon name. string ''
[hbClosable] / [hbShowClose] Allow dismissing via backdrop/Escape, and show the header close button. boolean true
[hbOpen] / (hbOpenChange) Controlled open state (undefined to open via the trigger), and an event as it opens and closes. boolean | undefined / boolean undefined / —

hb-sheet — footer

PropertyDescriptionTypeDefault
[hbShowFooter] / [hbFooterAlign] Show the built-in footer, and how its buttons are justified. boolean / 'start' | 'center' | 'end' | 'between' true / 'end'
[hbOkText] / [hbOkType] / [hbOkIcon] / [hbOkDisabled] The confirm button label, colour, icon, and disabled state. Emits (hbOk) with hbData. string / 'default' | 'destructive' | 'warning' | 'success' 'OK' / 'default'
[hbCancelText] / [hbCancelIcon] / [hbCancelDisabled] The cancel button label, icon, and disabled state. Emits (hbCancel) with hbData. string / boolean 'Cancel'
[hbData] An arbitrary payload passed back through the (hbOk) and (hbCancel) events. object undefined

Slots

PropertyDescriptionTypeDefault
[hbSheetTrigger] The projected element that opens the sheet on click. directive
[hbSheetContent] / [hbSheetFooter] The scrollable body, and extra content placed before the OK/Cancel buttons in the footer. directive