# Modal

Modal dialog built on the native dialog element, with focus trapping and a close button.

- Category: Overlay
- Status: stable
- Registry: https://markas.jenderalcorp.com/r/modal.json
- CLI: `npx markasui@latest add modal`

## When to use

Confirming an important action or a short form that needs full attention.

- Footer buttons that should close the modal must be type=submit
- Never nest a modal inside another modal
- Use Drawer for side panels, not Modal

## Code

### Blade

Save at `resources/views/components/markas/modal.blade.php`. Dependencies: alpinejs.

```blade
@props([
    'title',
    'closeLabel' => 'Close',
])

@php
    $dialog = 'm-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40';
    $panel = 'grid gap-4 p-6';
    $header = 'flex items-start justify-between gap-4';
    $titleClass = 'text-lg font-semibold text-ink';
    $body = 'text-sm text-muted';
    $footerClass = 'flex flex-wrap justify-end gap-2';
    $close = 'inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none';

    // Same id on every render, so Livewire's morph (which matches elements by id) keeps the element. Pass `id` to set it.
    $idKey = 'markas-modal|'.(isset($this) && $this instanceof \Livewire\Component ? $this->getId() : '').'|'.($attributes->get('wire:key') ?? $attributes->whereStartsWith('wire:model')->first() ?? $attributes->get('name')).'|';
    for ($idIndex = 0; $__env->hasRenderedOnce($idKey.$idIndex); $idIndex++);
    $__env->markAsRenderedOnce($idKey.$idIndex);
    $id = $attributes->get('id') ?? 'markas-modal-'.hash('xxh32', $idKey.$idIndex);
@endphp

{{-- wire:model and x-model bind the open state (x-modelable), so a boolean property can open and close the dialog. --}}
<div
    class="contents"
    x-data="{
        open: false,
        init() {
            this.$watch('open', (value) => {
                const dialog = this.$refs.dialog;
                if (value && ! dialog.open) dialog.showModal();
                if (! value && dialog.open) dialog.close();
            });
        },
    }"
    x-modelable="open"
    {{ $attributes->whereStartsWith(['wire:model', 'x-model']) }}
>
    @isset($trigger)
        <div class="contents" @click="$refs.dialog.showModal(); open = true">{{ $trigger }}</div>
    @endisset
    <dialog
        wire:ignore.self
        x-ref="dialog"
        :data-state="open ? 'open' : 'closed'"
        @close="open = false"
        @click.self="$refs.dialog.close()"
        {{ $attributes->whereDoesntStartWith(['wire:model', 'x-model'])->merge(['id' => $id, 'aria-labelledby' => $id.'-title', 'data-state' => 'closed'])->class([$dialog]) }}
    >
        <div class="{{ $panel }}">
            <div class="{{ $header }}">
                <h2 id="{{ $id }}-title" class="{{ $titleClass }}">{{ $title }}</h2>
                <form method="dialog">
                    <button type="submit" class="{{ $close }}" aria-label="{{ $closeLabel }}">
                        <svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12" /></svg>
                    </button>
                </form>
            </div>
            <div class="{{ $body }}">{{ $slot }}</div>
            @isset($footer)
                <form method="dialog" class="{{ $footerClass }}">{{ $footer }}</form>
            @endisset
        </div>
    </dialog>
</div>
```

```blade
<x-markas.modal title="Delete project?">
    <x-slot:trigger>
        <x-markas.button variant="danger">Delete</x-markas.button>
    </x-slot:trigger>

    The project and all of its data will be deleted permanently.

    <x-slot:footer>
        <x-markas.button variant="secondary" type="submit" value="cancel">Cancel</x-markas.button>
        <x-markas.button variant="danger" type="submit" value="delete">Delete</x-markas.button>
    </x-slot:footer>
</x-markas.modal>
```

Needs Alpine.js. Livewire 3 and 4 already ship it.

### Livewire

```blade
<x-markas.modal title="Edit profile" wire:model="showEdit">
    ...
</x-markas.modal>
```

`wire:model` binds the open state: set `$showEdit = true` in an action to open the dialog, `false` to close it. Closing with Escape, the close button, or the backdrop sets it back to `false`. The dialog keeps its open state across re-renders.

### React

Save at `src/components/markas/Modal.tsx`. No extra dependencies.

```tsx
"use client";

import {
  useId,
  useRef,
  useState,
  type ComponentProps,
  type MouseEvent,
  type ReactNode,
} from "react";

const dialogClass =
  "m-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40";
const panel = "grid gap-4 p-6";
const header = "flex items-start justify-between gap-4";
const titleClass = "text-lg font-semibold text-ink";
const body = "text-sm text-muted";
const footerClass = "flex flex-wrap justify-end gap-2";
const close =
  "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";
const cx = (...c: (string | false | null | undefined)[]) =>
  c.filter(Boolean).join(" ");

export type ModalProps = Omit<
  ComponentProps<"dialog">,
  "title" | "ref" | "open"
> & {
  title: ReactNode;
  trigger?: ReactNode;
  footer?: ReactNode;
  /** Label aksesibel tombol tutup. */
  closeLabel?: string;
};

export function Modal({
  title,
  closeLabel = "Close",
  trigger,
  footer,
  id,
  className,
  children,
  onClose,
  onClick,
  ...props
}: ModalProps) {
  const generatedId = useId();
  const dialogId = id ?? generatedId;
  const dialogRef = useRef<HTMLDialogElement>(null);
  const [open, setOpen] = useState(false);

  const show = () => {
    dialogRef.current?.showModal();
    setOpen(true);
  };
  const handleClick = (event: MouseEvent<HTMLDialogElement>) => {
    if (event.target === event.currentTarget) dialogRef.current?.close();
    onClick?.(event);
  };

  return (
    <div className="contents">
      {trigger && (
        <div className="contents" onClick={show}>
          {trigger}
        </div>
      )}
      <dialog
        ref={dialogRef}
        id={dialogId}
        aria-labelledby={`${dialogId}-title`}
        data-state={open ? "open" : "closed"}
        className={cx(dialogClass, className)}
        onClose={(event) => {
          setOpen(false);
          onClose?.(event);
        }}
        onClick={handleClick}
        {...props}
      >
        <div className={panel}>
          <div className={header}>
            <h2 id={`${dialogId}-title`} className={titleClass}>
              {title}
            </h2>
            <form method="dialog">
              <button type="submit" className={close} aria-label={closeLabel}>
                <svg
                  className="size-4"
                  viewBox="0 0 24 24"
                  fill="none"
                  stroke="currentColor"
                  strokeWidth="1.5"
                  strokeLinecap="round"
                  strokeLinejoin="round"
                  aria-hidden="true"
                >
                  <path d="M18 6 6 18M6 6l12 12" />
                </svg>
              </button>
            </form>
          </div>
          <div className={body}>{children}</div>
          {footer && (
            <form method="dialog" className={footerClass}>
              {footer}
            </form>
          )}
        </div>
      </dialog>
    </div>
  );
}
```

```tsx
import { Button } from "@/components/markas/Button";
import { Modal } from "@/components/markas/Modal";

<Modal
  title="Delete project?"
  trigger={<Button variant="danger">Delete</Button>}
  footer={
    <>
      <Button variant="secondary" type="submit" value="cancel">
        Cancel
      </Button>
      <Button variant="danger" type="submit" value="delete">
        Delete
      </Button>
    </>
  }
  onClose={(e) => console.log(e.currentTarget.returnValue)}
>
  The project and all of its data will be deleted permanently.
</Modal>;
```

### Vue

Save at `src/components/markas/Modal.vue`. No extra dependencies.

```vue
<script setup lang="ts">
import { computed, ref, useId, useTemplateRef } from "vue";

defineOptions({ inheritAttrs: false });

const props = withDefaults(
  defineProps<{
    title: string;
    id?: string;
    closeLabel?: string;
  }>(),
  { id: undefined, closeLabel: "Close" },
);

const dialogClass =
  "m-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40";
const panel = "grid gap-4 p-6";
const header = "flex items-start justify-between gap-4";
const titleClass = "text-lg font-semibold text-ink";
const body = "text-sm text-muted";
const footerClass = "flex flex-wrap justify-end gap-2";
const close =
  "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";

const generatedId = useId();
const dialogId = computed(() => props.id ?? generatedId);
const dialog = useTemplateRef<HTMLDialogElement>("dialog");
const open = ref(false);

function show() {
  dialog.value?.showModal();
  open.value = true;
}
</script>

<template>
  <div class="contents">
    <div v-if="$slots.trigger" class="contents" @click="show">
      <slot name="trigger" />
    </div>
    <dialog
      :id="dialogId"
      ref="dialog"
      :aria-labelledby="`${dialogId}-title`"
      :data-state="open ? 'open' : 'closed'"
      :class="dialogClass"
      v-bind="$attrs"
      @close="open = false"
      @click.self="dialog?.close()"
    >
      <div :class="panel">
        <div :class="header">
          <h2 :id="`${dialogId}-title`" :class="titleClass">
            {{ props.title }}
          </h2>
          <form method="dialog">
            <button type="submit" :class="close" :aria-label="props.closeLabel">
              <svg
                class="size-4"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
              >
                <path d="M18 6 6 18M6 6l12 12" />
              </svg>
            </button>
          </form>
        </div>
        <div :class="body"><slot /></div>
        <form v-if="$slots.footer" method="dialog" :class="footerClass">
          <slot name="footer" />
        </form>
      </div>
    </dialog>
  </div>
</template>
```

```vue
<template>
  <Modal title="Delete project?">
    <template #trigger>
      <Button variant="danger">Delete</Button>
    </template>

    The project and all of its data will be deleted permanently.

    <template #footer>
      <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
      <Button variant="danger" type="submit" value="delete">Delete</Button>
    </template>
  </Modal>
</template>
```

### Svelte

Save at `src/lib/components/markas/Modal.svelte`. No extra dependencies.

```svelte
<script lang="ts">
  import type { Snippet } from "svelte";
  import type { HTMLDialogAttributes } from "svelte/elements";

  const dialogClass =
    "m-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40";
  const panel = "grid gap-4 p-6";
  const header = "flex items-start justify-between gap-4";
  const titleClass = "text-lg font-semibold text-ink";
  const body = "text-sm text-muted";
  const footerClass = "flex flex-wrap justify-end gap-2";
  const close =
    "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";

  type Props = Omit<HTMLDialogAttributes, "title" | "open"> & {
    title: string;
    /** Accessible label of the close button. */
    closeLabel?: string;
    trigger?: Snippet;
    footer?: Snippet;
    children?: Snippet;
  };

  let {
    title,
    closeLabel = "Close",
    id,
    class: className,
    trigger,
    footer,
    children,
    onclose,
    onclick,
    ...rest
  }: Props = $props();

  const generatedId = $props.id();
  const dialogId = $derived(id ?? generatedId);
  let dialog = $state<HTMLDialogElement>();
  let open = $state(false);

  function show() {
    dialog?.showModal();
    open = true;
  }

  function handleClose(event: Event & { currentTarget: HTMLDialogElement }) {
    open = false;
    onclose?.(event);
  }

  function handleClick(
    event: MouseEvent & { currentTarget: HTMLDialogElement },
  ) {
    if (event.target === event.currentTarget) dialog?.close();
    onclick?.(event);
  }
</script>

<div class="contents">
  {#if trigger}
    <!-- svelte-ignore a11y_click_events_have_key_events -->
    <!-- svelte-ignore a11y_no_static_element_interactions -->
    <div class="contents" onclick={show}>{@render trigger()}</div>
  {/if}
  <dialog
    bind:this={dialog}
    id={dialogId}
    aria-labelledby={`${dialogId}-title`}
    data-state={open ? "open" : "closed"}
    class={[dialogClass, className]}
    onclose={handleClose}
    onclick={handleClick}
    {...rest}
  >
    <div class={panel}>
      <div class={header}>
        <h2 id={`${dialogId}-title`} class={titleClass}>{title}</h2>
        <form method="dialog">
          <button type="submit" class={close} aria-label={closeLabel}>
            <svg
              class="size-4"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="1.5"
              stroke-linecap="round"
              stroke-linejoin="round"
              aria-hidden="true"
            >
              <path d="M18 6 6 18M6 6l12 12" />
            </svg>
          </button>
        </form>
      </div>
      <div class={body}>{@render children?.()}</div>
      {#if footer}
        <form method="dialog" class={footerClass}>{@render footer()}</form>
      {/if}
    </div>
  </dialog>
</div>
```

```svelte
<script lang="ts">
  import Button from "$lib/components/markas/Button.svelte";
  import Modal from "$lib/components/markas/Modal.svelte";
</script>

<Modal
  title="Delete project?"
  onclose={(e) => console.log(e.currentTarget.returnValue)}
>
  {#snippet trigger()}
    <Button variant="danger">Delete</Button>
  {/snippet}

  The project and all of its data will be deleted permanently.

  {#snippet footer()}
    <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
    <Button variant="danger" type="submit" value="delete">Delete</Button>
  {/snippet}
</Modal>
```

### Astro

Save at `src/components/markas/Modal.astro`. No extra dependencies.

```astro
---
import type { HTMLAttributes } from "astro/types";

const dialogClass =
  "m-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40";
const panel = "grid gap-4 p-6";
const header = "flex items-start justify-between gap-4";
const titleClass = "text-lg font-semibold text-ink";
const body = "text-sm text-muted";
const footerClass = "flex flex-wrap justify-end gap-2";
const close =
  "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";

type Props = Omit<HTMLAttributes<"dialog">, "title" | "open"> & {
  title: string;
  /** Accessible label of the close button. */
  closeLabel?: string;
};

const { title, closeLabel = "Close", id, class: className, ...rest } =
  Astro.props;
const dialogId = id ?? `markas-modal-${crypto.randomUUID().slice(0, 8)}`;
---

<div class="contents">
  {
    Astro.slots.has("trigger") && (
      <div class="contents" data-markas-modal-trigger={dialogId}>
        <slot name="trigger" />
      </div>
    )
  }
  <dialog
    id={dialogId}
    aria-labelledby={`${dialogId}-title`}
    data-state="closed"
    data-markas-modal
    class:list={[dialogClass, className]}
    {...rest}
  >
    <div class={panel}>
      <div class={header}>
        <h2 id={`${dialogId}-title`} class={titleClass}>{title}</h2>
        <form method="dialog">
          <button type="submit" class={close} aria-label={closeLabel}>
            <svg
              class="size-4"
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="1.5"
              stroke-linecap="round"
              stroke-linejoin="round"
              aria-hidden="true"
            >
              <path d="M18 6 6 18M6 6l12 12"></path>
            </svg>
          </button>
        </form>
      </div>
      <div class={body}><slot /></div>
      {
        Astro.slots.has("footer") && (
          <form method="dialog" class={footerClass}>
            <slot name="footer" />
          </form>
        )
      }
    </div>
  </dialog>
</div>

<script>
  // One listener per page serves every modal, including markup added later and pages
  // reached through view transitions.
  const isModal = (node: EventTarget | null): node is HTMLDialogElement =>
    node instanceof HTMLDialogElement && node.hasAttribute("data-markas-modal");

  document.addEventListener("click", (event) => {
    const target = event.target as Element;
    const trigger = target.closest<HTMLElement>("[data-markas-modal-trigger]");
    if (trigger) {
      const dialog = document.getElementById(
        trigger.dataset.markasModalTrigger ?? "",
      );
      if (isModal(dialog)) {
        dialog.showModal();
        dialog.dataset.state = "open";
      }
      return;
    }
    // A click on the dialog itself (not its content) is a click on the backdrop.
    if (isModal(target)) target.close();
  });

  // The close event does not bubble, so listen in the capture phase.
  document.addEventListener(
    "close",
    (event) => {
      if (isModal(event.target)) event.target.dataset.state = "closed";
    },
    true,
  );
</script>
```

```astro
---
import Button from "@/components/markas/Button.astro";
import Modal from "@/components/markas/Modal.astro";
---

<Modal title="Delete project?">
  <Button slot="trigger" variant="danger">Delete</Button>

  The project and all of its data will be deleted permanently.

  <Fragment slot="footer">
    <Button variant="secondary" type="submit" value="cancel">Cancel</Button>
    <Button variant="danger" type="submit" value="delete">Delete</Button>
  </Fragment>
</Modal>
```

A small bundled script opens every modal on the page. It also works after view transitions.

### Angular

Save at `src/app/markas/modal.component.ts`. No extra dependencies.

```ts
import {
  afterNextRender,
  ChangeDetectionStrategy,
  Component,
  computed,
  type ElementRef,
  input,
  output,
  signal,
  viewChild,
} from "@angular/core";

const dialogClass =
  "m-auto w-full max-w-lg rounded-xl border border-line bg-surface p-0 text-ink shadow-overlay backdrop:bg-ink/40";
const panel = "grid gap-4 p-6";
const header = "flex items-start justify-between gap-4";
const titleClass = "text-lg font-semibold text-ink";
const body = "text-sm text-muted";
const footerClass = "flex flex-wrap justify-end gap-2";
const close =
  "inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted transition-colors duration-150 ease-out hover:bg-subtle hover:text-ink focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary motion-reduce:transition-none";

let nextId = 0;

/**
 * Slots: an element with the `trigger` attribute opens the modal, an element with the `footer`
 * attribute (an ng-container works) fills the action row, everything else is the body.
 * Host stays out of layout; id, title, and class move to the dialog.
 */
@Component({
  selector: "markas-modal",
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: { class: "contents", "[attr.id]": "null", "[attr.title]": "null" },
  template: `
    <div class="contents" (click)="show()">
      <ng-content select="[trigger]" />
    </div>
    <dialog
      #dialog
      [id]="dialogId()"
      [attr.aria-labelledby]="dialogId() + '-title'"
      [attr.data-state]="open() ? 'open' : 'closed'"
      [class]="dialogClasses()"
      (close)="handleClose()"
      (click)="handleClick($event)"
    >
      <div [class]="panel">
        <div [class]="header">
          <h2 [id]="dialogId() + '-title'" [class]="titleClass">
            {{ title() }}
          </h2>
          <form method="dialog">
            <button
              type="submit"
              [class]="close"
              [attr.aria-label]="closeLabel()"
            >
              <svg
                class="size-4"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                aria-hidden="true"
              >
                <path d="M18 6 6 18M6 6l12 12" />
              </svg>
            </button>
          </form>
        </div>
        <div [class]="body"><ng-content /></div>
        <form
          #footer
          method="dialog"
          [class]="footerClass"
          [hidden]="!hasFooter()"
        >
          <ng-content select="[footer]" />
        </form>
      </div>
    </dialog>
  `,
})
export class Modal {
  readonly title = input.required<string>();
  /** Accessible label of the close button. */
  readonly closeLabel = input("Close");
  readonly id = input<string>();
  readonly userClass = input("", { alias: "class" });
  readonly closed = output<void>();

  protected readonly panel = panel;
  protected readonly header = header;
  protected readonly titleClass = titleClass;
  protected readonly body = body;
  protected readonly footerClass = footerClass;
  protected readonly close = close;
  protected readonly open = signal(false);
  protected readonly hasFooter = signal(false);
  private readonly generatedId = `markas-modal-${nextId++}`;
  protected readonly dialogId = computed(() => this.id() ?? this.generatedId);
  protected readonly dialogClasses = computed(() =>
    [dialogClass, this.userClass()].filter(Boolean).join(" "),
  );
  private readonly dialog =
    viewChild.required<ElementRef<HTMLDialogElement>>("dialog");
  private readonly footer =
    viewChild.required<ElementRef<HTMLFormElement>>("footer");

  constructor() {
    // Projected content is only known after the first render.
    afterNextRender(() =>
      this.hasFooter.set(this.footer().nativeElement.childElementCount > 0),
    );
  }

  /** Opens the modal. Also callable from a template reference: modal.show(). */
  show() {
    this.dialog().nativeElement.showModal();
    this.open.set(true);
  }

  protected handleClose() {
    this.open.set(false);
    this.closed.emit();
  }

  protected handleClick(event: MouseEvent) {
    // A click on the dialog itself (not its content) is a click on the backdrop.
    if (event.target === event.currentTarget)
      this.dialog().nativeElement.close();
  }
}
```

```ts
import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Modal } from "./markas/modal.component";

@Component({
  selector: "app-danger-zone",
  imports: [Button, Modal],
  template: `
    <markas-modal title="Delete project?" (closed)="onClosed()">
      <button markas-button trigger variant="danger">Delete</button>

      The project and all of its data will be deleted permanently.

      <ng-container footer>
        <button markas-button variant="secondary" type="submit" value="cancel">
          Cancel
        </button>
        <button markas-button variant="danger" type="submit" value="delete">
          Delete
        </button>
      </ng-container>
    </markas-modal>
  `,
})
export class DangerZone {
  onClosed() {}
}
```

## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | - | Dialog title, also used for aria-labelledby. |
| `trigger` | `slot / ReactNode / snippet` | - | Element that opens the modal when clicked. Angular: an element with the trigger attribute. |
| `footer` | `slot / ReactNode / snippet` | - | Action area. Wrapped in form method=dialog, so a type=submit button closes the modal. Angular: an element with the footer attribute. |
| `id` | `string` | auto | Dialog id. Use it to open the modal from elsewhere with showModal(). |
| `closeLabel` | `string` | Close | Accessible label of the close button. |
| `closed` | `output<void>` | - | Angular only. Emits when the modal closes. |

## Accessibility

- Uses dialog with showModal(), so focus stays inside and the page behind is inert.
- Escape closes the modal and returns focus to the trigger.
- Clicking outside the panel (the backdrop) closes the modal.
- The close button is labelled by closeLabel.

## Notes

- The `value` of the button that closed the modal is available as `dialog.returnValue` in the `close` event.
- To open the modal from code, call `document.getElementById(id).showModal()`.
- The close button is labelled "Close". Translate it with `closeLabel` (Blade: `close-label`).
