Logo

Component Blueprint

X: 1280 · Y: 720 · Grid: 8px

Modal

Dialog primitives powered by Angular CDK with trigger, close, layout, and programmatic opening support.

01 Hero Preview

Grid: 8px · Scale: 1:1

02 Usage

TS

import { Component, inject } from '@angular/core';
import { FrButtonModule } from '@frame-ui-ng/components/button';
import { FR_MODAL_DATA, FrModalModule, FrModalRef, FrModalService } from '@frame-ui-ng/components/modal';

type SettingsModalData = {
  workspace: string;
};

@Component({
  selector: 'app-settings-modal',
  imports: [FrButtonModule, FrModalModule],
  templateUrl: './settings-modal.html',
})
class SettingsModalComponent {
  readonly data = inject<SettingsModalData>(FR_MODAL_DATA);
  private readonly modalRef = inject(FrModalRef<SettingsModalComponent, 'cancel' | 'saved'>);

  close(result: 'cancel' | 'saved'): void {
    this.modalRef.close(result);
  }
}

readonly modal = inject(FrModalService);

openSettings(): void {
  const modalRef = this.modal.open(SettingsModalComponent, {
    workspace: 'Platform',
  }, {
    ariaLabel: 'Workspace settings',
    width: '32rem',
  });

  modalRef.closed.subscribe((result) => {
    // handle cancel or saved
  });
}

HTML

<button frButton type="button" (click)="openSettings()">Open modal</button>

HTML

<div frModalPanel>
  <div frModalHeader>
    <h2 frModalTitle>{{ data.workspace }} settings</h2>
    <p frModalDescription>Make focused changes without leaving the current page.</p>
  </div>

  <div frModalBody>
    Modal content goes here.
  </div>

  <div frModalFooter>
    <button frButton appearance="outline" type="button" (click)="close('cancel')">Cancel</button>
    <button frButton type="button" (click)="close('saved')">Save changes</button>
  </div>
</div>

03 Examples

Basic

Inject FrModalService and open a dedicated modal component for the common modal composition.

Component Sheet

Grid: 8px · Scale: 1:1

Programmatic open

Inject FrModalService to open a modal component with data and dialog config from application logic.

Component Sheet

Grid: 8px · Scale: 1:1

Without default close button

Set showCloseButton to false when users should choose an explicit footer action.

Component Sheet

Grid: 8px · Scale: 1:1

Disable outside close

Pass disableClose in the service config when backdrop clicks should be ignored and the modal must be closed through explicit controls.

Component Sheet

Grid: 8px · Scale: 1:1

Scrollable with sticky footer

Enable scrollable and stickyFooter on the panel for longer content while keeping actions visible.

Component Sheet

Grid: 8px · Scale: 1:1

04 Custom Styling

Override modal tokens on a local wrapper when a product flow needs a branded surface, stronger radius, or more prominent elevation without replacing the CDK Dialog foundation.

Component Sheet

Grid: 8px · Scale: 1:1

05 Token Inspector

Hover the modal surface, header, title, description, body, or footer to inspect the tokens that shape the dialog composition.

Workspace settings

A composable modal built on top of Angular CDK Dialog.

Configure a focused workflow without sending people to a new route.

06 Design Tokens

Use these CSS custom properties to tune the modal surface, backdrop, spacing, radius, shadow, and close affordance.

SCSS


  --frame-modal-backdrop-blur: 3px;
  --frame-modal-backdrop-bg: rgb(0 0 0 / 0.52);
  --frame-modal-bg: var(--frame-background);
  --frame-modal-border: var(--frame-border);
  --frame-modal-color: var(--frame-foreground);
  --frame-modal-muted-color: var(--frame-muted-foreground);
  --frame-modal-radius: var(--frame-radius-lg);
  --frame-modal-shadow: 0 24px 80px rgb(0 0 0 / 0.18), 0 8px 24px rgb(0 0 0 / 0.12);
  --frame-modal-padding: 1.5rem;
  --frame-modal-gap: 1rem;
  --frame-modal-scrollable-height: min(calc(100dvh - 2rem), 28rem);
  --frame-modal-close-bg: transparent;
  --frame-modal-close-color: var(--frame-muted-foreground);
  --frame-modal-close-hover-bg: var(--frame-muted);
  --frame-modal-close-hover-color: var(--frame-foreground);
  --frame-modal-z-index: 1000;