Skip to main content
Neural UIv2.0.0Documentation
View v1 GitHub

Dialog

Present a focused task in a modal dialog with optional resizing and maximization.

Category
Overlays
Import
@neural-ui/core/modal
Selector
neu-dialog
import { NeuDialogComponent } from '@neural-ui/core/modal';

Usage

The application owns open. Bind it and handle closeRequested by applying false when closing is accepted. opened and closed report lifecycle transitions, not replacement values for open. Project body content and the available header/footer slots. Keep a named trigger in the page so focus can return after dismissal. disableClose only blocks automatic dismissals; provide an explicit completion action.

Examples

Try this application-owned interaction. Its event handling and initial data are included in Code.

Examples

Events: 0

Try and configure

Change the public options, try the result and inspect the updated template. Code contains the complete executable implementation.

Try and configure

Events: 0

template.html
<button
    neu-button
    (neuClick)="open.set(true)"
  >
    {{ t('Open example', 'Abrir ejemplo') }}</button
  ><neu-dialog
    [maximized]="undefined"
    [responsive]="true"
    [restoreFocus]="true"
    [open]="open()"
    [size]="'md'"
    [disableClose]="false"
    [draggable]="false"
    [resizable]="false"
    [maximizable]="false"
    [layout]="'auto'"
    (closeRequested)="open.set(false); record('closeRequested', $event)"
    (maximizedChange)="onMaximizedChange($event)"
  (opened)="record('opened')"
    (closed)="record('closed')"
  [maximizeLabel]="'Maximize'"
  [resizeLabel]="'Resize'"
  [restoreLabel]="'Restore'"
  [title]="'Review changes'"
><p>
      {{
        t(
          'Review the content, then close to return to the trigger.',
          'Revisa el contenido y cierra para regresar al activador.'
        )
      }}
    </p>
    <button
      neu-button
      variant="ghost"
      (neuClick)="nestedOpen.set(true)"
    >
      {{ t('Open nested dialog', 'Abrir diรกlogo anidado') }}
    </button>
    <neu-dialog
      [open]="nestedOpen()"
      [title]="t('Confirm details', 'Confirmar detalles')"
      (closeRequested)="
        nestedOpen.set(false); record('nestedCloseRequested', $event)
      "
    >
      <p>
        {{
          t(
            'Close this dialog to return to the parent.',
            'Cierra este diรกlogo para volver al padre.'
          )
        }}
      </p>
      <div neu-dialog-footer>
        <button
          neu-button
          (neuClick)="nestedOpen.set(false)"
        >
          {{ t('Return', 'Volver') }}
        </button>
      </div>
    </neu-dialog>
    <div neu-dialog-footer>
      <button
        neu-button
        variant="outline"
        (neuClick)="open.set(false)"
      >
        {{ t('Done', 'Terminar') }}
      </button>
    </div></neu-dialog
  >

State and events

The application owns open. Bind it and handle closeRequested by applying false when closing is accepted. opened and closed report lifecycle transitions, not replacement values for open. Project body content and the available header/footer slots. Keep a named trigger in the page so focus can return after dismissal. disableClose only blocks automatic dismissals; provide an explicit completion action.

Accessibility and keyboard

Tab remains in a modal surface. Escape requests dismissal when enabled. Closing returns focus to the original trigger; persistent Sidebar is normal page navigation rather than a modal task.

Key
Action
Tab In modal mode, move through controls inside the surface. A persistent sidebar follows normal page order.
Shift + Tab Move backwards through the focus order; modal focus stays inside the surface.
Escape Request dismissal when enabled; closing restores focus to the trigger.

API

Inputs, models and Outputs are extracted from the installed Core package. Named public types link to their definitions. Templates below include executable examples.

Inputs

Configure the component with [property]="value". Your application supplies these values; the component does not replace the state you pass in.

Name
Type
Default
Template binding
Description
disableClosebooleanfalse[disableClose]Prevent automatic Escape/backdrop dismissal; keep an explicit completion action available.
draggablebooleanfalse[draggable]Enable dragging the dialog by its header.
layoutNeuDialogLayout'auto'[layout]Panel height strategy: auto fits content; viewport uses the available viewport height.
maximizablebooleanfalse[maximizable]Show the dialog maximize/restore action.
maximizedboolean | undefinedundefined[maximized]Applied maximized state; undefined lets the dialog keep its own maximize state.
maximizeLabelstring'Maximize dialog'[maximizeLabel]Accessible label for the corresponding dialog window action.
openbooleanfalse[open]Application-owned visibility. Apply false when the requested dismissal is accepted.
resizablebooleanfalse[resizable]Allows manual vertical resize when autoResize is off.
resizeLabelstring'Resize dialog'[resizeLabel]Accessible label for the corresponding dialog window action.
responsivebooleantrue[responsive]Enable the dialog responsive layout on narrow screens.
restoreFocusbooleantrue[restoreFocus]Restore focus to the original trigger after closing.
restoreLabelstring'Restore dialog'[restoreLabel]Accessible label for the corresponding dialog window action.
sizeNeuDialogSize'md'[size]Panel size: sm, md, lg, xl or full.
titlestring''[title]Optional visible title above projected content.

Outputs

Listen to an event with (event)="handler($event)". The table explains the data your handler receives and how to use it.

Name
Payload
Template binding
Description
closedvoid(closed)="onClosed($event)"Reports closure of this component. Consult the payload type for the emitted data.
closeRequestedNeuCloseRequest(closeRequested)="onCloseRequested($event)"Requests dismissal with its reason and original event. The application accepts by applying open=false.
maximizedChangeboolean(maximizedChange)="onMaximizedChange($event)"Proposes the next maximized state; apply it when maximized is controlled.
openedvoid(opened)="onOpened($event)"Reports opening of this component. Consult the payload type for the emitted data.

Templates

ng-content projects content into the component. TemplateRef inputs receive a template; ng-template directives identify templates with a typed context. A directive shared by an entrypoint is not necessarily a slot of this component.

Name
Mechanism
Contract
*

Projected content

View example
Content projection

Application-provided content.

<ng-content />

Context used: โ€”

[neu-dialog-footer]View example Content projection<ng-content select="[neu-dialog-footer]" />

Each example demonstrates a different template. Switch between Demo and Code to inspect its implementation, imports and state.

Projected content

*

Projected content

Events: 0

[neu-dialog-footer]

[neu-dialog-footer]

[neu-dialog-footer]

Events: 0

Public Types

Open a type to inspect its definition and interface fields.

Styles and tokens

Use the supported public tokens listed below. Surrounding layout belongs to your application; validate the result in light and dark modes and narrow containers.

Specific tokens

This component uses shared theme tokens rather than dedicated component hooks.

Shared tokens used

Override these on a local wrapper to affect this example. An override on :root affects other components that use the same token.

Token
Purpose here
Other impact
Default / fallback
No data