Docs

Main site

Installation Browser support Extend config MCP server
Validation Page speed testing Responsive design
Accordion Aspect Ratio Avatar Badge Banner Bento Grid Blockquote Breadcrumbs Button Callout Card Drawer Dropdown Link Modal Navbar Navblock Pagination Popover Progress Separator Tabs Timeline Toast Tooltip
Checkbox Datepicker File upload Form field Input Label OTP Radio Range Select Textarea Toggle
Header Footer
Accordion Auth Checkbox & Radio Content Drawers Features Modals Statistics & Metrics Teams
Address Contact number Currency symbol Date Emirates ID Name
Close
Home Documentation Blocks Modals

Modals

Modal blocks built on aegov-modal: focused dialogs that open over the page for a single task, keep keyboard focus inside while open, and return it to the trigger when they close.

Modal Example 01

A task opened in a modal over a team task list: quiet icon actions in the header, the task title, its key attributes with badges, then tabs for comments, progress and the description. Comments can be posted, reacted to and replied to, and the progress tab uses the timeline component.

Get code

Modal Example 01

HTML
<div class="min-h-[max(100dvh,58rem)] bg-aeblack-50 px-4 py-6 sm:px-8 lg:px-12 lg:py-10">
  <div class="mx-auto max-w-5xl">
    <div class="flex items-center justify-between gap-4">
      <div role="img" aria-label="Logo" class="relative flex h-10 w-32 shrink-0 items-center justify-center overflow-hidden rounded-lg border-2 border-dashed border-aeblack-200 bg-white">
        <svg aria-hidden="true" class="absolute inset-0 size-full text-aeblack-200" preserveAspectRatio="none" viewBox="0 0 100 100" fill="none"><line x1="0" y1="0" x2="100" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/><line x1="100" y1="0" x2="0" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/></svg>
        <span aria-hidden="true" class="relative rounded bg-white px-2 text-sm font-semibold text-aeblack-500">Logo</span>
      </div>
      <p class="text-sm text-aeblack-600">Digital Services team</p>
    </div>

    <div class="mt-10">
      <h2 class="text-h5 sm:text-h4 text-aeblack-800">Team tasks</h2>
      <p class="mt-1 text-base text-aeblack-600">Sprint 14 · 12 open tasks</p>
    </div>

    <ul class="mt-6 space-y-3">
      <li class="flex flex-wrap items-center justify-between gap-4 rounded-2xl bg-white p-4 ring-1 ring-aeblack-950/5 sm:p-5">
        <div class="min-w-0 space-y-1">
          <p class="text-xs font-medium text-aeblack-600">TSK-1042</p>
          <p class="text-base font-semibold text-aeblack-800">Review the Arabic content of the licensing portal before launch</p>
        </div>
        <div class="flex items-center gap-3">
          <aegov-badge variant="aegold" size="sm">In review</aegov-badge>
          <aegov-button data-task-open variant="neutral-max" appearance="outline" size="base">Open task</aegov-button>
        </div>
      </li>
      <li aria-hidden="true" class="flex items-center justify-between gap-4 rounded-2xl bg-white p-4 ring-1 ring-aeblack-950/5 sm:p-5">
        <div class="w-full max-w-md space-y-2"><div class="h-2.5 w-16 rounded-full bg-aeblack-100"></div><div class="h-3.5 w-4/5 rounded-full bg-aeblack-100"></div></div>
        <div class="h-6 w-20 shrink-0 rounded-full bg-aeblack-100"></div>
      </li>
      <li aria-hidden="true" class="flex items-center justify-between gap-4 rounded-2xl bg-white p-4 ring-1 ring-aeblack-950/5 sm:p-5">
        <div class="w-full max-w-md space-y-2"><div class="h-2.5 w-16 rounded-full bg-aeblack-100"></div><div class="h-3.5 w-3/5 rounded-full bg-aeblack-100"></div></div>
        <div class="h-6 w-20 shrink-0 rounded-full bg-aeblack-100"></div>
      </li>
    </ul>
  </div>
</div>

<aegov-modal id="task-modal" size="base" position="top" label="Task TSK-1042">
  <div data-task class="text-aeblack-800">
    <div class="sticky -top-5 z-10 -mx-5 -mt-5 flex items-center justify-between gap-2 bg-whitely-50 px-5 pt-4 pb-3">
      <div class="flex items-center sm:gap-1">
        <aegov-tooltip content="Open as a full page" class="hidden sm:block">
          <aegov-button appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Open as a full page">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7"/></svg>
          </aegov-button>
        </aegov-tooltip>
        <span aria-hidden="true" class="mx-1 hidden h-5 w-px bg-aeblack-100 sm:block"></span>
        <aegov-tooltip content="Previous task" class="hidden sm:block">
          <aegov-button appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Previous task">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>
          </aegov-button>
        </aegov-tooltip>
        <aegov-tooltip content="Next task" class="hidden sm:block">
          <aegov-button appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Next task">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>
          </aegov-button>
        </aegov-tooltip>
        <p class="ms-1 hidden text-xs text-aeblack-600 sm:block">3 of 12</p>
      </div>
      <div class="flex items-center sm:gap-1">
        <aegov-tooltip content="Copy task link" class="hidden sm:block">
          <aegov-button data-task-copy appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Copy task link">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
          </aegov-button>
        </aegov-tooltip>
        <aegov-dropdown align="end">
          <aegov-button appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="More task actions">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><circle cx="5" cy="12" r="1.75"/><circle cx="12" cy="12" r="1.75"/><circle cx="19" cy="12" r="1.75"/></svg>
          </aegov-button>
          <div slot="dropdown-content" class="w-52">
            <a href="#copy-link" data-task-copy class="sm:hidden">Copy task link</a>
            <a href="#duplicate">Duplicate task</a>
            <a href="#move">Move to another project</a>
            <a href="#archive">Archive task</a>
          </div>
        </aegov-dropdown>
        <span aria-hidden="true" class="mx-1 h-5 w-px bg-aeblack-100"></span>
        <aegov-tooltip content="Close">
          <aegov-button data-task-close appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Close task">
            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18M6 6l12 12"/></svg>
          </aegov-button>
        </aegov-tooltip>
      </div>
    </div>

    <p class="mt-2 text-xs font-semibold tracking-wide text-aeblack-600 uppercase sm:mt-6">TSK-1042 · Licensing portal</p>
    <h2 class="mt-2 text-lg font-bold sm:text-h4 text-aeblack-900">Review the Arabic content of the licensing portal before launch</h2>

    <dl class="mt-6 grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-4 sm:gap-x-6 sm:grid-cols-[9rem_minmax(0,1fr)]">
      <dt class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg aria-hidden="true" class="hidden size-4 shrink-0 sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M12 3a9 9 0 0 1 9 9"/></svg>
        Status
      </dt>
      <dd><aegov-badge variant="aegold" size="sm">In review</aegov-badge></dd>

      <dt class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg aria-hidden="true" class="hidden size-4 shrink-0 sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="8" r="4"/><path d="M4 21a8 8 0 0 1 16 0"/></svg>
        Assigned to
      </dt>
      <dd class="flex items-center gap-2">
        <aegov-avatar src="/storage/blocks/team/person-2.webp" alt="" size="xs" appearance="rounded"></aegov-avatar>
        <span class="text-sm text-aeblack-800 sm:text-base">Rashid Al Hakim</span>
      </dd>

      <dt class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg aria-hidden="true" class="hidden size-4 shrink-0 sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg>
        Due date
      </dt>
      <dd class="flex flex-wrap items-baseline gap-x-2">
        <time datetime="2026-11-19" class="text-sm text-aeblack-800 sm:text-base">19 November 2026</time>
        <span class="text-xs font-semibold text-aered-700">3 days left</span>
      </dd>

      <dt class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg aria-hidden="true" class="hidden size-4 shrink-0 sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 22V4c3-2 6 0 8 1s5 1 8-1v11c-3 2-6 0-8-1s-5-1-8 1"/></svg>
        Priority
      </dt>
      <dd class="flex items-center gap-2 text-sm text-aeblack-800 sm:text-base">
        <svg aria-hidden="true" class="size-4 shrink-0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><rect x="1" y="9" width="3" height="6" rx="1" class="fill-aered-600"/><rect x="6.5" y="5" width="3" height="10" rx="1" class="fill-aered-600"/><rect x="12" y="1" width="3" height="14" rx="1" class="fill-aered-600"/></svg>
        High
      </dd>

      <dt class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg aria-hidden="true" class="hidden size-4 shrink-0 sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.6 2.6A2 2 0 0 0 11.2 2H4a2 2 0 0 0-2 2v7.2a2 2 0 0 0 .6 1.4l8.7 8.7a2.4 2.4 0 0 0 3.4 0l6.6-6.6a2.4 2.4 0 0 0 0-3.4z"/><circle cx="7.5" cy="7.5" r="1" fill="currentColor"/></svg>
        Labels
      </dt>
      <dd class="flex flex-wrap gap-2">
        <aegov-badge variant="fuchsia" size="sm">Accessibility</aegov-badge>
        <aegov-badge variant="indigo" size="sm">Arabic content</aegov-badge>
        <aegov-badge variant="seablue" size="sm">Launch</aegov-badge>
      </dd>
    </dl>

    <aegov-tabs label-tablist="Task details" size="sm sm:base" is-scrollable="true" class="mt-8 block">
      <aegov-tab slot="tabs" tab-id="comments">Comments <span data-comment-count class="ms-1 rounded-md bg-aeblack-100 px-1.5 text-xs font-semibold text-aeblack-700">2</span></aegov-tab>
      <aegov-tab slot="tabs" tab-id="progress">Progress</aegov-tab>
      <aegov-tab slot="tabs" tab-id="description">Description</aegov-tab>

      <aegov-tab-panel tab-id="comments">
        <form data-comment-form novalidate class="rounded-2xl bg-aeblack-50 p-3 sm:p-4">
          <aegov-label for="task-comment" class="sr-only">Add a comment</aegov-label>
          <aegov-textarea field-id="task-comment" name="comment" placeholder="Add a comment. Type @ to mention someone." resize="none" size="sm sm:base" maxlength="500" is-required="true" data-required-message="Write a comment before you post it" class="block"></aegov-textarea>
          <div data-comment-files class="mt-2 flex flex-wrap gap-2 empty:hidden"></div>
          <div class="mt-3 flex items-center justify-between gap-3">
            <div class="flex items-center gap-1">
              <aegov-tooltip content="Mention someone">
                <aegov-button data-comment-mention appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Mention someone">
                  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/></svg>
                </aegov-button>
              </aegov-tooltip>
              <aegov-tooltip content="Attach a file">
                <aegov-button data-comment-attach appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Attach a file">
                  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>
                </aegov-button>
              </aegov-tooltip>
              <input data-comment-file type="file" hidden>
            </div>
            <aegov-button type="submit" variant="primary" size="sm lg:base xl:lg">Post comment</aegov-button>
          </div>
        </form>

        <ol data-comment-feed class="relative mt-6 space-y-6 before:absolute before:start-4 before:top-4 before:bottom-4 before:w-px before:bg-aeblack-100">
          <li class="relative flex items-center gap-3">
            <span aria-hidden="true" class="flex size-8 shrink-0 items-center justify-center rounded-full bg-white text-aeblack-600 ring-1 ring-aeblack-100">
              <svg class="size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14M12 5v14"/></svg>
            </span>
            <p class="text-xs text-aeblack-600 sm:text-sm"><span class="font-semibold text-aeblack-800">Mohammed Al Mansouri</span> created this task <span aria-hidden="true">·</span> <time datetime="2026-11-12T09:10" class="text-xs">4 days ago</time></p>
          </li>

          <li class="relative flex gap-3">
            <aegov-avatar src="/storage/blocks/team/person-2.webp" alt="" size="sm" appearance="rounded" class="shrink-0"></aegov-avatar>
            <div class="min-w-0 flex-1">
              <p class="flex flex-wrap items-baseline gap-x-2"><span class="text-sm font-semibold text-aeblack-800 sm:text-base">Rashid Al Hakim</span><time datetime="2026-11-14T11:32" class="text-xs text-aeblack-600">2 days ago</time></p>
              <p class="mt-1 text-sm text-aeblack-700 sm:text-base">I've gone through the licence application pages. The terms are consistent, but six error messages read as word-for-word translations. I'll rewrite them with the Arabic style guide before the committee sees them.</p>
              <div class="mt-2 flex items-center gap-2">
                <button type="button" data-reaction aria-pressed="false" class="inline-flex min-h-7 items-center gap-1 rounded-full border border-aeblack-100 bg-white px-2.5 text-xs font-semibold text-aeblack-700 hover:bg-aeblack-50 aria-pressed:border-primary-200 aria-pressed:bg-primary-50 aria-pressed:text-primary-800"><span aria-hidden="true">👍</span><span data-reaction-count>2</span><span class="sr-only"> thumbs up</span></button>
                <span aria-hidden="true" class="h-4 w-px bg-aeblack-100"></span>
                <button type="button" data-reply="Rashid" class="inline-flex min-h-7 items-center rounded px-1 text-sm font-semibold text-aeblack-800 hover:underline">Reply</button>
              </div>
            </div>
          </li>

          <li class="relative flex items-center gap-3">
            <span aria-hidden="true" class="flex size-8 shrink-0 items-center justify-center rounded-full bg-white text-aeblack-600 ring-1 ring-aeblack-100">
              <svg class="size-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14m-7-7 7 7-7 7"/></svg>
            </span>
            <p class="flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs text-aeblack-600 sm:text-sm"><span class="font-semibold text-aeblack-800">Kareem Al-Farsi</span> moved this from <aegov-badge variant="slate" size="sm">To do</aegov-badge> to <aegov-badge variant="aegold" size="sm">In review</aegov-badge> <span aria-hidden="true">·</span> <time datetime="2026-11-15T16:05" class="text-xs">Yesterday</time></p>
          </li>

          <li class="relative flex gap-3">
            <aegov-avatar src="/storage/blocks/team/person-3.webp" alt="" size="sm" appearance="rounded" class="shrink-0"></aegov-avatar>
            <div class="min-w-0 flex-1">
              <p class="flex flex-wrap items-baseline gap-x-2"><span class="text-sm font-semibold text-aeblack-800 sm:text-base">Youssef Ibrahim</span><time datetime="2026-11-16T10:20" class="text-xs text-aeblack-600">25 minutes ago</time></p>
              <p class="mt-1 text-sm text-aeblack-700 sm:text-base"><span class="font-semibold text-primary-700">@Rashid</span> thanks. Please also check the right-to-left layout of the payment summary on mobile. The totals column wraps on smaller phones.</p>
              <div class="mt-2 flex items-center gap-2">
                <button type="button" data-reaction aria-pressed="true" class="inline-flex min-h-7 items-center gap-1 rounded-full border border-aeblack-100 bg-white px-2.5 text-xs font-semibold text-aeblack-700 hover:bg-aeblack-50 aria-pressed:border-primary-200 aria-pressed:bg-primary-50 aria-pressed:text-primary-800"><span aria-hidden="true">🙏</span><span data-reaction-count>1</span><span class="sr-only"> thank you</span></button>
                <span aria-hidden="true" class="h-4 w-px bg-aeblack-100"></span>
                <button type="button" data-reply="Youssef" class="inline-flex min-h-7 items-center rounded px-1 text-sm font-semibold text-aeblack-800 hover:underline">Reply</button>
              </div>
            </div>
          </li>
        </ol>

        <template data-comment-template>
          <li class="relative flex gap-3">
            <aegov-avatar src="/storage/blocks/team/person-1.webp" alt="" size="sm" appearance="rounded" class="shrink-0"></aegov-avatar>
            <div class="min-w-0 flex-1">
              <p class="flex flex-wrap items-baseline gap-x-2"><span class="text-sm font-semibold text-aeblack-800 sm:text-base">Mohammed Al Mansouri</span><span class="text-xs text-aeblack-600">Just now</span></p>
              <p data-comment-body class="mt-1 text-sm whitespace-pre-line text-aeblack-700 sm:text-base"></p>
              <p data-comment-attachment class="mt-2 hidden text-sm text-aeblack-600"></p>
            </div>
          </li>
        </template>
      </aegov-tab-panel>

      <aegov-tab-panel tab-id="progress">
        <aegov-timeline orientation="vertical" aria-label="Task progress" class="block">
          <aegov-timeline-step status="completed" description="12 November">Brief agreed</aegov-timeline-step>
          <aegov-timeline-step status="completed" description="14 November">Content audit</aegov-timeline-step>
          <aegov-timeline-step status="active" description="In progress">Arabic review</aegov-timeline-step>
          <aegov-timeline-step status="pending" description="Due 19 November">Committee sign-off</aegov-timeline-step>
        </aegov-timeline>
      </aegov-tab-panel>

      <aegov-tab-panel tab-id="description">
        <div class="space-y-4">
          <p class="text-base text-aeblack-800 sm:text-lg">Check every Arabic page of the licensing portal before it opens to the public, so the content reads naturally and works right to left on every screen size.</p>
          <p class="text-sm text-aeblack-700 sm:text-base">Share the findings with the steering committee on 19 November with a list of what was fixed and what still needs legal review.</p>
          <div>
            <p class="flex items-baseline justify-between gap-4"><span class="text-sm font-semibold text-aeblack-800">Checklist</span><span class="text-xs text-aeblack-600">2 of 4 done</span></p>
            <ul class="mt-3 space-y-2">
              <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aegreen-600" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg><span><span class="sr-only">Done: </span>Check every page against the Arabic style guide</span></li>
              <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aegreen-600" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/></svg><span><span class="sr-only">Done: </span>List terms that need legal review</span></li>
              <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aeblack-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg><span><span class="sr-only">To do: </span>Confirm right-to-left layouts on mobile</span></li>
              <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aeblack-300" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/></svg><span><span class="sr-only">To do: </span>Present the findings to the steering committee</span></li>
            </ul>
          </div>
        </div>
      </aegov-tab-panel>
    </aegov-tabs>

    <p data-task-status role="status" class="sr-only"></p>
  </div>
</aegov-modal>

<script>
  // Task modal: "Open task" opens it, the close button and the backdrop close it,
  // and focus returns to "Open task". Inside, comments can be posted (with an
  // optional attachment), reacted to and replied to.
  document.querySelectorAll('[data-task-open]').forEach((trigger) => {
    const modal = document.getElementById('task-modal');
    const task = modal.querySelector('[data-task]');
    const status = task.querySelector('[data-task-status]');
    const announce = (message) => { status.textContent = ''; setTimeout(() => { status.textContent = message; }, 50); };

    trigger.addEventListener('click', () => modal.show());
    task.querySelector('[data-task-close]').addEventListener('click', () => modal.close());

    // Copy link: an icon button from sm up, a menu item below it.
    task.querySelectorAll('[data-task-copy]').forEach((copy) => copy.addEventListener('click', async (event) => {
      event.preventDefault();
      copy.closest('aegov-dropdown')?.closeDropdown();
      try {
        await navigator.clipboard.writeText(`${location.origin}${location.pathname}#TSK-1042`);
        announce('Task link copied');
      } catch {
        announce('The link could not be copied');
      }
    }));

    // Reactions: a toggle button whose count follows its pressed state.
    task.addEventListener('click', (event) => {
      const reaction = event.target.closest('[data-reaction]');
      if (!reaction) return;
      const pressed = reaction.getAttribute('aria-pressed') === 'true';
      const count = reaction.querySelector('[data-reaction-count]');
      reaction.setAttribute('aria-pressed', String(!pressed));
      count.textContent = Number(count.textContent) + (pressed ? -1 : 1);
    });

    // Composer: mention, reply and attach all lead back to the comment field.
    const form = task.querySelector('[data-comment-form]');
    const field = form.querySelector('aegov-textarea');
    const fileInput = form.querySelector('[data-comment-file]');
    const files = form.querySelector('[data-comment-files]');
    const feed = task.querySelector('[data-comment-feed]');
    const countBadge = task.querySelector('[data-comment-count]');

    const insert = (text) => {
      field.value = `${field.value}${field.value && !field.value.endsWith(' ') ? ' ' : ''}${text}`;
      field.focus();
    };

    form.querySelector('[data-comment-mention]').addEventListener('click', () => insert('@'));
    task.querySelectorAll('[data-reply]').forEach((reply) => {
      reply.addEventListener('click', () => insert(`@${reply.dataset.reply} `));
    });

    form.querySelector('[data-comment-attach]').addEventListener('click', () => fileInput.click());
    fileInput.addEventListener('change', () => {
      files.replaceChildren();
      const [file] = fileInput.files;
      if (!file) return;
      const badge = document.createElement('aegov-badge');
      badge.setAttribute('variant', 'aeblack');
      badge.setAttribute('size', 'sm');
      badge.setAttribute('is-dismissible', 'true');
      badge.textContent = file.name;
      badge.addEventListener('aegovBadgeDismiss', () => {
        fileInput.value = '';
        field.focus();
      });
      files.append(badge);
      announce(`${file.name} attached`);
    });

    // Show the error on blur or submit; while typing, only clear it.
    field.addEventListener('aegovValidate', (event) => {
      if (event.detail.trigger === 'input' && !field.isInvalid) return;
      const valid = event.detail.validity.valid && field.value.trim() !== '';
      field.isInvalid = !valid;
      field.errorMessage = valid ? '' : field.dataset.requiredMessage;
    });

    form.addEventListener('submit', async (event) => {
      event.preventDefault();
      const result = await field.validate('submit');
      if (!result.valid || field.value.trim() === '') {
        field.isInvalid = true;
        field.errorMessage = field.dataset.requiredMessage;
        field.focus();
        return;
      }

      // Example only: send new FormData(form) to your comments endpoint here.
      const item = task.querySelector('[data-comment-template]').content.firstElementChild.cloneNode(true);
      item.querySelector('[data-comment-body]').textContent = field.value.trim();
      const [file] = fileInput.files;
      if (file) {
        const attachment = item.querySelector('[data-comment-attachment]');
        attachment.textContent = `Attached: ${file.name}`;
        attachment.classList.remove('hidden');
      }
      feed.append(item);
      countBadge.textContent = feed.querySelectorAll('aegov-avatar').length;

      field.value = '';
      fileInput.value = '';
      files.replaceChildren();
      announce('Comment posted');
      field.focus({ preventScroll: true });
      item.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
    });
  });
</script>

Uses the UAE Design System web components. Load the theme, base CSS and component loader first. See installation.

Modal Example 02

A share modal: who can open the link and what they can do, the link itself ready to copy, the people who already have access with their roles, a search to add more, and an embed code on request.

Get code

Modal Example 02

HTML
<div class="min-h-[max(100dvh,52rem)] bg-aeblack-50 px-4 py-6 sm:px-8 lg:px-12 lg:py-10">
  <div class="mx-auto max-w-5xl">
    <div class="flex items-center justify-between gap-4">
      <div role="img" aria-label="Logo" class="relative flex h-10 w-32 shrink-0 items-center justify-center overflow-hidden rounded-lg border-2 border-dashed border-aeblack-200 bg-white">
        <svg aria-hidden="true" class="absolute inset-0 size-full text-aeblack-200" preserveAspectRatio="none" viewBox="0 0 100 100" fill="none"><line x1="0" y1="0" x2="100" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/><line x1="100" y1="0" x2="0" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/></svg>
        <span aria-hidden="true" class="relative rounded bg-white px-2 text-sm font-semibold text-aeblack-500">Logo</span>
      </div>
      <aegov-button data-share-open variant="neutral-max" appearance="outline" size="base">Share</aegov-button>
    </div>
    <div aria-hidden="true" class="mt-10 space-y-3">
      <div class="h-5 w-56 rounded-full bg-aeblack-200"></div>
      <div class="h-3 w-80 max-w-full rounded-full bg-aeblack-100"></div>
    </div>
    <div aria-hidden="true" class="mt-8 grid gap-4 sm:grid-cols-3">
      <div class="h-32 rounded-2xl bg-white ring-1 ring-aeblack-950/5"></div>
      <div class="h-32 rounded-2xl bg-white ring-1 ring-aeblack-950/5"></div>
      <div class="h-32 rounded-2xl bg-white ring-1 ring-aeblack-950/5"></div>
      <div class="h-56 rounded-2xl bg-white ring-1 ring-aeblack-950/5 sm:col-span-3"></div>
    </div>
  </div>
</div>

<aegov-modal id="share-modal" size="base" label="Share the Q3 customer service report">
  <div data-share class="relative text-aeblack-800">
    <aegov-button data-share-close appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Close" class="absolute -end-2 -top-2">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18M6 6l12 12"/></svg>
    </aegov-button>

    <div class="pt-2 text-center sm:px-6 sm:pt-4">
      <span aria-hidden="true" class="mx-auto flex size-12 items-center justify-center rounded-2xl bg-primary-600 text-white shadow-sm ring-4 ring-primary-50 sm:size-14">
        <svg class="size-6 sm:size-7" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>
      </span>
      <h2 class="mt-4 text-lg font-bold sm:mt-5 sm:text-h5 text-aeblack-900">Share the Q3 customer service report</h2>
      <p class="mt-1 text-sm text-aeblack-600 sm:text-base">Invite your team to review and comment on this report.</p>
    </div>

    <div class="mt-6 rounded-2xl p-3 ring-1 ring-aeblack-100 sm:p-4">
      <div class="flex flex-wrap items-center gap-3">
        <span aria-hidden="true" class="hidden size-10 shrink-0 items-center justify-center rounded-xl bg-primary-50 text-primary-700 sm:flex">
          <svg data-access-icon="anyone" class="size-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/></svg>
          <svg data-access-icon="entity" class="hidden size-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21h18M5 21V7l8-4v18M19 21V11l-6-4M9 9v.01M9 12v.01M9 15v.01M9 18v.01"/></svg>
          <svg data-access-icon="invited" class="hidden size-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
        </span>
        <aegov-select data-share-access variant="neutral-min" aria-label="Who can open the link" size="sm" value="anyone" class="block min-w-0 flex-1 basis-44">
          <aegov-select-option value="anyone">Anyone with the link</aegov-select-option>
          <aegov-select-option value="entity">Anyone in your entity</aegov-select-option>
          <aegov-select-option value="invited">Only people added</aegov-select-option>
        </aegov-select>
        <aegov-select data-share-permission variant="neutral-min" aria-label="What people with the link can do" size="sm" value="view" class="block w-full sm:w-36">
          <aegov-select-option value="view">Can view</aegov-select-option>
          <aegov-select-option value="comment">Can comment</aegov-select-option>
          <aegov-select-option value="edit">Can edit</aegov-select-option>
        </aegov-select>
      </div>
      <aegov-input data-share-url variant="neutral-max" aria-label="Share link" size="sm" value="https://reports.example.gov.ae/q3-customer-service" is-readonly="true" is-copyable="true" class="mt-3 block"></aegov-input>
      <p data-share-hint class="mt-2 text-xs text-aeblack-600">Anyone with the link can open it. They don't need an account.</p>
    </div>

    <h3 id="share-people-heading" class="mt-6 text-sm font-semibold text-aeblack-800 sm:text-base">People with access</h3>
    <aegov-select data-share-search variant="primary" aria-labelledby="share-people-heading" appearance="listbox" is-searchable="true" placeholder="Search team members to add" empty-message="No team member matches your search" size="sm sm:base" class="mt-2 block">
      <aegov-select-option value="khalid" data-name="Khalid Al Shamsi" data-email="khalid.alshamsi@example.gov.ae" data-avatar="/storage/blocks/team/person-5.webp">Khalid Al Shamsi</aegov-select-option>
      <aegov-select-option value="kareem" data-name="Kareem Al-Farsi" data-email="kareem.alfarsi@example.gov.ae" data-avatar="/storage/blocks/team/person-4.webp">Kareem Al-Farsi</aegov-select-option>
    </aegov-select>

    <ul data-share-people class="mt-2 divide-y divide-aeblack-100">
      <li class="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-2 py-3 sm:grid-cols-[auto_minmax(0,1fr)_9rem]">
        <aegov-avatar src="/storage/blocks/team/person-1.webp" alt="" size="sm" appearance="rounded" status="online"></aegov-avatar>
        <div class="min-w-0">
          <p class="text-sm font-semibold text-aeblack-800 sm:text-base">Mohammed Al Mansouri <span class="sr-only">(online, you)</span></p>
          <p class="truncate text-xs text-aeblack-600 sm:text-sm">mohammed.almansouri@example.gov.ae</p>
        </div>
        <p class="col-start-2 text-xs font-semibold text-aeblack-600 sm:col-start-auto sm:ps-3 sm:text-sm">Owner</p>
      </li>
      <li class="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-2 py-3 sm:grid-cols-[auto_minmax(0,1fr)_9rem]">
        <aegov-avatar src="/storage/blocks/team/person-2.webp" alt="" size="sm" appearance="rounded"></aegov-avatar>
        <div class="min-w-0">
          <p class="text-sm font-semibold text-aeblack-800 sm:text-base">Rashid Al Hakim</p>
          <p class="truncate text-xs text-aeblack-600 sm:text-sm">rashid.alhakim@example.gov.ae</p>
        </div>
        <aegov-select data-share-role variant="neutral-min" aria-label="Access for Rashid Al Hakim" size="sm" value="edit" class="col-start-2 block sm:col-start-auto">
          <aegov-select-option value="edit">Can edit</aegov-select-option>
          <aegov-select-option value="comment">Can comment</aegov-select-option>
          <aegov-select-option value="view">Can view</aegov-select-option>
          <aegov-select-option value="remove">Remove access</aegov-select-option>
        </aegov-select>
      </li>
      <li class="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-2 py-3 sm:grid-cols-[auto_minmax(0,1fr)_9rem]">
        <aegov-avatar src="/storage/blocks/team/person-3.webp" alt="" size="sm" appearance="rounded"></aegov-avatar>
        <div class="min-w-0">
          <p class="flex flex-wrap items-center gap-x-2 gap-y-1"><span class="text-sm font-semibold text-aeblack-800 sm:text-base">Youssef Ibrahim</span><aegov-badge variant="aegold" size="sm">Outside your entity</aegov-badge></p>
          <p class="truncate text-xs text-aeblack-600 sm:text-sm">youssef@partner.example.ae</p>
        </div>
        <aegov-select data-share-role variant="neutral-min" aria-label="Access for Youssef Ibrahim" size="sm" value="comment" class="col-start-2 block sm:col-start-auto">
          <aegov-select-option value="edit">Can edit</aegov-select-option>
          <aegov-select-option value="comment">Can comment</aegov-select-option>
          <aegov-select-option value="view">Can view</aegov-select-option>
          <aegov-select-option value="remove">Remove access</aegov-select-option>
        </aegov-select>
      </li>
    </ul>

    <template data-share-person>
      <li class="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-3 gap-y-2 py-3 sm:grid-cols-[auto_minmax(0,1fr)_9rem]">
        <aegov-avatar alt="" size="sm" appearance="rounded"></aegov-avatar>
        <div class="min-w-0">
          <p data-person-name class="text-sm font-semibold text-aeblack-800 sm:text-base"></p>
          <p data-person-email class="truncate text-xs text-aeblack-600 sm:text-sm"></p>
        </div>
        <aegov-select data-share-role variant="neutral-min" size="sm" value="view" class="col-start-2 block sm:col-start-auto">
          <aegov-select-option value="edit">Can edit</aegov-select-option>
          <aegov-select-option value="comment">Can comment</aegov-select-option>
          <aegov-select-option value="view">Can view</aegov-select-option>
          <aegov-select-option value="remove">Remove access</aegov-select-option>
        </aegov-select>
      </li>
    </template>

    <div id="share-embed" data-share-embed hidden class="mt-4">
      <aegov-label for="share-embed-code">Embed code</aegov-label>
      <aegov-textarea field-id="share-embed-code" variant="neutral-min" size="sm" resize="none" is-readonly="true" is-copyable="true" hint="Paste this into a page on your entity's website." value="<iframe src="https://reports.example.gov.ae/q3-customer-service/embed" title="Q3 customer service report" width="800" height="600"></iframe>" class="mt-2 block"></aegov-textarea>
    </div>

    <div class="-mx-5 -mb-5 mt-6 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-t border-aeblack-100 bg-aeblack-50 px-5 py-4 sm:flex">
      <aegov-button data-share-copy variant="neutral-max" appearance="outline" size="base" is-full="true">
        <svg class="hidden sm:block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
        <span data-share-copy-label>Copy link</span>
      </aegov-button>
      <aegov-button data-share-embed-toggle variant="neutral-max" appearance="link" size="base" aria-expanded="false">
        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 18 6-6-6-6M8 6l-6 6 6 6"/></svg>
        Embed
      </aegov-button>
      <aegov-button data-share-done variant="primary" size="sm lg:base xl:lg" is-full="true" class="col-span-2 sm:ms-auto">Done</aegov-button>
    </div>

    <p data-share-status role="status" class="sr-only"></p>
  </div>
</aegov-modal>

<script>
  // Share modal: "Share" opens it; Close and Done close it and return focus to "Share".
  document.querySelectorAll('[data-share-open]').forEach((trigger) => {
    const modal = document.getElementById('share-modal');
    const share = modal.querySelector('[data-share]');
    const status = share.querySelector('[data-share-status]');
    const url = share.querySelector('[data-share-url]');
    const announce = (message) => { status.textContent = ''; setTimeout(() => { status.textContent = message; }, 50); };

    trigger.addEventListener('click', () => modal.show());
    share.querySelector('[data-share-close]').addEventListener('click', () => modal.close());
    share.querySelector('[data-share-done]').addEventListener('click', () => modal.close());

    // General access: the icon and hint follow the choice. When only added people
    // can open it, the link's own permission no longer applies.
    const hints = {
      anyone: "Anyone with the link can open it. They don't need an account.",
      entity: 'Anyone signed in from your entity can open it with the link.',
      invited: 'Only the people below can open it, even if the link is shared.',
    };
    const permission = share.querySelector('[data-share-permission]');
    share.querySelector('[data-share-access]').addEventListener('aegovSelectChange', (event) => {
      const access = event.detail.value;
      share.querySelectorAll('[data-access-icon]').forEach((icon) => icon.classList.toggle('hidden', icon.dataset.accessIcon !== access));
      share.querySelector('[data-share-hint]').textContent = hints[access];
      permission.isDisabled = access === 'invited';
    });

    // Copy link: the label confirms the copy for a moment.
    const copyLabel = share.querySelector('[data-share-copy-label]');
    share.querySelector('[data-share-copy]').addEventListener('click', async () => {
      try {
        await navigator.clipboard.writeText(url.value);
        copyLabel.textContent = 'Link copied';
        announce('Link copied');
        setTimeout(() => { copyLabel.textContent = 'Copy link'; }, 2000);
      } catch {
        announce('The link could not be copied. Select it and copy it instead.');
      }
    });

    // Embed: show or hide the embed code under the people list.
    const embed = share.querySelector('[data-share-embed]');
    const embedToggle = share.querySelector('[data-share-embed-toggle]');
    embedToggle.addEventListener('click', () => {
      embed.hidden = !embed.hidden;
      embedToggle.setAttribute('aria-expanded', String(!embed.hidden));
      if (!embed.hidden) {
        embed.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
      }
    });

    // People: choosing someone in the search adds them with "Can view";
    // "Remove access" on a person's role takes them off the list.
    const people = share.querySelector('[data-share-people]');
    const search = share.querySelector('[data-share-search]');
    const template = share.querySelector('[data-share-person]');

    search.addEventListener('aegovSelectChange', (event) => {
      const option = search.querySelector(`aegov-select-option[value="${event.detail.value}"]`);
      if (!option) return;
      const person = template.content.firstElementChild.cloneNode(true);
      person.dataset.personId = option.value;
      person.querySelector('aegov-avatar').setAttribute('src', option.dataset.avatar);
      person.querySelector('[data-person-name]').textContent = option.dataset.name;
      person.querySelector('[data-person-email]').textContent = option.dataset.email;
      person.querySelector('aegov-select').setAttribute('aria-label', `Access for ${option.dataset.name}`);
      people.append(person);
      option.isDisabled = true;
      search.value = '';
      announce(`${option.dataset.name} can now view this report`);
    });

    people.addEventListener('aegovSelectChange', (event) => {
      const role = event.target.closest('[data-share-role]');
      if (!role || event.detail.value !== 'remove') return;
      const person = role.closest('li');
      const name = person.querySelector('[data-person-name], .font-semibold').textContent.trim();
      const option = search.querySelector(`aegov-select-option[value="${person.dataset.personId}"]`);
      if (option) option.isDisabled = false;
      person.remove();
      announce(`${name} no longer has access`);
      search.focus();
    });
  });
</script>

Uses the UAE Design System web components. Load the theme, base CSS and component loader first. See installation.

Modal Example 03

A payment confirmation: a clear success state, the amount paid, the details someone may need later such as the reference number, then one primary action to view the receipt and a quieter link to the invoice.

Get code

Modal Example 03

HTML
<div class="min-h-[max(100dvh,48rem)] bg-aeblack-50 px-4 py-6 sm:px-8 lg:px-12 lg:py-10">
  <div class="mx-auto max-w-3xl">
    <div role="img" aria-label="Logo" class="relative flex h-10 w-32 items-center justify-center overflow-hidden rounded-lg border-2 border-dashed border-aeblack-200 bg-white">
      <svg aria-hidden="true" class="absolute inset-0 size-full text-aeblack-200" preserveAspectRatio="none" viewBox="0 0 100 100" fill="none"><line x1="0" y1="0" x2="100" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/><line x1="100" y1="0" x2="0" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/></svg>
      <span aria-hidden="true" class="relative rounded bg-white px-2 text-sm font-semibold text-aeblack-500">Logo</span>
    </div>
    <div aria-hidden="true" class="mt-10 space-y-3">
      <div class="h-5 w-48 rounded-full bg-aeblack-200"></div>
      <div class="h-3 w-72 max-w-full rounded-full bg-aeblack-100"></div>
    </div>
    <div class="mt-8 rounded-2xl bg-white p-5 ring-1 ring-aeblack-950/5 sm:p-6">
      <div aria-hidden="true" class="space-y-4">
        <div class="flex justify-between gap-4"><div class="h-3 w-32 rounded-full bg-aeblack-100"></div><div class="h-3 w-16 rounded-full bg-aeblack-100"></div></div>
        <div class="flex justify-between gap-4"><div class="h-3 w-40 rounded-full bg-aeblack-100"></div><div class="h-3 w-12 rounded-full bg-aeblack-100"></div></div>
        <div class="flex justify-between gap-4 border-t border-aeblack-100 pt-4"><div class="h-3.5 w-20 rounded-full bg-aeblack-200"></div><div class="h-3.5 w-24 rounded-full bg-aeblack-200"></div></div>
      </div>
      <aegov-button data-payment-open variant="primary" size="sm lg:base xl:lg" is-full="true" class="mt-6 block">Pay AED 1,250.00</aegov-button>
    </div>
  </div>
</div>

<aegov-modal id="payment-modal" size="base" label="Payment successful">
  <div data-payment class="relative text-aeblack-800">
    <div class="pt-2 text-center sm:pt-4">
      <span aria-hidden="true" class="mx-auto flex size-16 items-center justify-center rounded-full bg-aegreen-50 ring-8 ring-aegreen-50/60 sm:size-18">
        <span class="flex size-11 items-center justify-center rounded-full bg-aegreen-600 text-white shadow-sm sm:size-12">
          <svg class="size-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>
        </span>
      </span>
      <h2 class="mt-5 text-lg font-bold sm:text-h5 text-aeblack-900">Payment successful</h2>
      <p class="mx-auto mt-1 max-w-sm text-sm text-aeblack-600 sm:text-base">Your trade licence renewal fee has been paid. We've emailed the receipt to you.</p>

      <p class="mt-6">
        <span class="block text-xs font-medium text-aeblack-600">Amount paid</span>
        <span class="mt-1 block text-h5 font-bold sm:text-h4 tabular-nums text-aeblack-900">AED 1,250.00</span>
      </p>
    </div>

    <dl class="mt-6 divide-y divide-aeblack-100 rounded-2xl bg-aeblack-50 px-3 sm:px-5">
      <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-3">
        <dt class="whitespace-nowrap text-xs text-aeblack-600 sm:text-sm">Reference number</dt>
        <dd dir="ltr" class="ms-auto whitespace-nowrap text-sm font-semibold tabular-nums text-aeblack-800">TL-2026-048213</dd>
      </div>
      <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-3">
        <dt class="whitespace-nowrap text-xs text-aeblack-600 sm:text-sm">Service</dt>
        <dd class="ms-auto text-end text-sm font-semibold text-aeblack-800">Trade licence renewal</dd>
      </div>
      <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-3">
        <dt class="whitespace-nowrap text-xs text-aeblack-600 sm:text-sm">Paid on</dt>
        <dd class="ms-auto whitespace-nowrap text-end text-sm font-semibold text-aeblack-800"><time datetime="2026-11-16T10:42">16 November 2026, 10:42</time></dd>
      </div>
      <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-3">
        <dt class="whitespace-nowrap text-xs text-aeblack-600 sm:text-sm">Payment method</dt>
        <dd class="ms-auto text-end text-sm font-semibold text-aeblack-800">Card ending 4821</dd>
      </div>
      <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-1 py-3">
        <dt class="whitespace-nowrap text-xs text-aeblack-600 sm:text-sm">Status</dt>
        <dd class="ms-auto"><aegov-badge variant="aegreen" size="sm">Paid</aegov-badge></dd>
      </div>
    </dl>

    <div class="mt-6 grid items-center gap-2 sm:grid-cols-2 sm:gap-3">
      <aegov-link href="#receipt" variant="primary" appearance="solid" size="sm lg:base xl:lg" is-full="true" class="block">
        <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 2v20l3-2 3 2 2-1.5L14 22l3-2 3 2V2l-3 2-3-2-2 1.5L10 2 7 4z"/><path d="M8 8h8M8 12h8M8 16h5"/></svg>
        View receipt
      </aegov-link>
      <aegov-link href="#invoice" variant="neutral-max" appearance="link" size="base" is-full="true" class="block">
        <svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M9 13h6M9 17h6"/></svg>
        View invoice
      </aegov-link>
    </div>

    <p class="mt-4 text-center text-xs text-aeblack-600">Keep your reference number in case you need to contact us about this payment.</p>

    <aegov-button data-payment-close appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Close" class="absolute -end-2 -top-2">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18M6 6l12 12"/></svg>
    </aegov-button>
  </div>
</aegov-modal>

<script>
  // Payment confirmation: shown once the payment goes through. "View receipt" comes
  // first in the markup so it takes focus when the modal opens; the close button
  // sits last in the tab order although it is drawn in the top corner.
  document.querySelectorAll('[data-payment-open]').forEach((trigger) => {
    const modal = document.getElementById('payment-modal');
    trigger.addEventListener('click', () => modal.show());
    modal.querySelector('[data-payment-close]').addEventListener('click', () => modal.close());
  });
</script>

Uses the UAE Design System web components. Load the theme, base CSS and component loader first. See installation.

Modal Example 04

A simple confirmation before deleting a draft application: what will be deleted, that it cannot be undone, and two choices. Cancel takes focus when the dialog opens, so the safe choice is the default.

Get code

Modal Example 04

HTML
<div class="min-h-[max(100dvh,36rem)] bg-aeblack-50 px-4 py-6 sm:px-8 lg:px-12 lg:py-10">
  <div class="mx-auto max-w-3xl">
    <div role="img" aria-label="Logo" class="relative flex h-10 w-32 items-center justify-center overflow-hidden rounded-lg border-2 border-dashed border-aeblack-200 bg-white">
      <svg aria-hidden="true" class="absolute inset-0 size-full text-aeblack-200" preserveAspectRatio="none" viewBox="0 0 100 100" fill="none"><line x1="0" y1="0" x2="100" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/><line x1="100" y1="0" x2="0" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/></svg>
      <span aria-hidden="true" class="relative rounded bg-white px-2 text-sm font-semibold text-aeblack-500">Logo</span>
    </div>
    <h2 class="mt-10 text-h5 sm:text-h4 text-aeblack-800">My applications</h2>
    <ul class="mt-6 space-y-3">
      <li class="flex items-center justify-between gap-4 rounded-2xl bg-white p-4 ring-1 ring-aeblack-950/5 sm:p-5">
        <div class="min-w-0 space-y-1">
          <p class="text-base font-semibold text-aeblack-800">Trade licence renewal</p>
          <p class="flex flex-wrap items-center gap-2 text-xs text-aeblack-600"><aegov-badge variant="slate" size="sm">Draft</aegov-badge>Saved 14 November 2026</p>
        </div>
        <aegov-button data-delete-open appearance="outline" variant="danger" size="sm" is-icon="true" aria-label="Delete draft: Trade licence renewal">
          <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/></svg>
        </aegov-button>
      </li>
      <li aria-hidden="true" class="flex items-center justify-between gap-4 rounded-2xl bg-white p-4 ring-1 ring-aeblack-950/5 sm:p-5">
        <div class="w-full max-w-sm space-y-2"><div class="h-3.5 w-3/5 rounded-full bg-aeblack-100"></div><div class="h-2.5 w-2/5 rounded-full bg-aeblack-100"></div></div>
        <div class="size-8 shrink-0 rounded-lg bg-aeblack-100"></div>
      </li>
    </ul>
  </div>
</div>

<aegov-modal id="delete-modal" size="base" label="Delete this draft application?">
  <div class="sm:flex sm:items-start sm:gap-5">
    <span aria-hidden="true" class="mx-auto flex size-12 shrink-0 items-center justify-center rounded-full bg-aered-50 text-aered-600 ring-8 ring-aered-50/50 sm:mx-0">
      <svg class="size-6" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/></svg>
    </span>
    <div class="mt-4 text-center sm:mt-0 sm:text-start">
      <h2 class="text-lg font-bold text-aeblack-900">Delete this draft application?</h2>
      <p class="mt-2 text-sm text-aeblack-600 sm:text-base">Your draft <span class="font-semibold text-aeblack-800">Trade licence renewal</span> and everything you've entered so far will be deleted. You can't undo this.</p>
    </div>
  </div>
  <div class="mt-6 grid grid-cols-2 gap-3 sm:flex sm:justify-end">
    <aegov-button data-delete-cancel variant="neutral-max" appearance="outline" size="base" is-full="true">Cancel</aegov-button>
    <aegov-button data-delete-confirm variant="danger" size="base" is-full="true">Delete</aegov-button>
  </div>
</aegov-modal>

<script>
  // Delete a draft application. Cancel comes first in the markup, so it takes
  // focus when the dialog opens and a stray Enter never deletes anything.
  document.querySelectorAll('[data-delete-open]').forEach((trigger) => {
    const modal = document.getElementById('delete-modal');
    trigger.addEventListener('click', () => modal.show());
    modal.querySelector('[data-delete-cancel]').addEventListener('click', () => modal.close());
    modal.querySelector('[data-delete-confirm]').addEventListener('click', () => {
      // Example only: delete the draft here, then confirm it on the page.
      modal.close();
    });
  });
</script>

Uses the UAE Design System web components. Load the theme, base CSS and component loader first. See installation.

Modal Example 05

Terms in a modal: the terms sit in their own scrollable area with a reading progress bar and a short summary first, and "Accept and continue" stays disabled until the person ticks that they agree.

Get code

Modal Example 05

HTML
<div class="min-h-[max(100dvh,46rem)] bg-aeblack-50 px-4 py-6 sm:px-8 lg:px-12 lg:py-10">
  <div class="mx-auto max-w-3xl">
    <div role="img" aria-label="Logo" class="relative flex h-10 w-32 items-center justify-center overflow-hidden rounded-lg border-2 border-dashed border-aeblack-200 bg-white">
      <svg aria-hidden="true" class="absolute inset-0 size-full text-aeblack-200" preserveAspectRatio="none" viewBox="0 0 100 100" fill="none"><line x1="0" y1="0" x2="100" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/><line x1="100" y1="0" x2="0" y2="100" stroke="currentColor" stroke-width="1" vector-effect="non-scaling-stroke"/></svg>
      <span aria-hidden="true" class="relative rounded bg-white px-2 text-sm font-semibold text-aeblack-500">Logo</span>
    </div>
    <h2 class="mt-10 text-h5 sm:text-h4 text-aeblack-800">Apply for an event permit</h2>
    <div class="mt-6 rounded-2xl bg-white p-5 ring-1 ring-aeblack-950/5 sm:p-6">
      <div aria-hidden="true" class="space-y-4">
        <div class="h-3 w-24 rounded-full bg-aeblack-100"></div>
        <div class="h-10 rounded-lg bg-aeblack-50 ring-1 ring-aeblack-100"></div>
        <div class="h-3 w-32 rounded-full bg-aeblack-100"></div>
        <div class="h-10 rounded-lg bg-aeblack-50 ring-1 ring-aeblack-100"></div>
      </div>
      <aegov-button data-terms-open variant="neutral-max" appearance="outline" size="base" class="mt-6">Read the terms of use</aegov-button>
    </div>
  </div>
</div>

<aegov-modal id="terms-modal" size="base" label="Terms of use">
  <div data-terms class="relative text-aeblack-800">
    <div class="flex items-start gap-4 pe-10">
      <span aria-hidden="true" class="hidden size-11 shrink-0 items-center justify-center rounded-xl bg-aeblack-900 text-white shadow-sm sm:flex">
        <svg class="size-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6M9 15l2 2 4-4"/></svg>
      </span>
      <div class="min-w-0">
        <p class="text-xs font-semibold tracking-wide text-aeblack-600 uppercase">Event permit service</p>
        <h2 id="terms-heading" class="mt-1 text-lg font-bold sm:text-h5 text-aeblack-900">Terms of use</h2>
        <p class="mt-1 text-xs text-aeblack-600 sm:text-sm">Updated 1 November 2026<span class="hidden sm:inline"> <span aria-hidden="true">·</span> About 3 minutes to read</span></p>
      </div>
    </div>

    <aegov-progress data-terms-progress label="How much of the terms you have scrolled through" value="0" max="100" height="1" counter="trailing" counter-suffix="%" class="mt-5 block"></aegov-progress>

    <div class="relative mt-3">
      <div data-terms-scroll tabindex="0" role="region" aria-labelledby="terms-heading" class="max-h-52 overflow-y-auto rounded-2xl bg-aeblack-50 p-3 outline-offset-2 sm:max-h-80 sm:p-5">
        <div class="rounded-xl bg-white p-4 ring-1 ring-aeblack-950/5">
          <h3 class="text-sm font-semibold text-aeblack-800">In short</h3>
          <ul class="mt-3 space-y-2">
            <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aeblack-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>We use your details only to process this permit.</li>
            <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aeblack-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>You get a full refund if you cancel before we start.</li>
            <li class="flex gap-2 text-sm text-aeblack-700"><svg aria-hidden="true" class="mt-0.5 size-4 shrink-0 text-aeblack-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>Most permits are issued within 5 working days.</li>
          </ul>
        </div>

        <ol class="mt-6 space-y-5">
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">01</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">Who can apply</h3><p class="mt-1 text-sm text-aeblack-600">Event organisers, or people they authorise, with a valid Emirates ID or trade licence. You must be 21 or older.</p></div>
          </li>
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">02</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">How we use your data</h3><p class="mt-1 text-sm text-aeblack-600">Only to process this application. We share it only with the entities needed to approve it, such as civil defence, police and the municipality, and we keep it for 3 years.</p></div>
          </li>
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">03</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">Fees and refunds</h3><p class="mt-1 text-sm text-aeblack-600">The fee is shown before you pay. If you cancel before we start processing, you get a full refund within 7 working days. After that, the fee can't be refunded.</p></div>
          </li>
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">04</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">Processing times</h3><p class="mt-1 text-sm text-aeblack-600">Most permits are issued within 5 working days. Large or outdoor events can take up to 15. We'll update you by email and SMS at every step.</p></div>
          </li>
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">05</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">Your responsibilities</h3><p class="mt-1 text-sm text-aeblack-600">The information you give must be accurate and complete. Incorrect information may delay your permit, or lead us to cancel it.</p></div>
          </li>
          <li class="grid grid-cols-[auto_minmax(0,1fr)] gap-3">
            <span aria-hidden="true" class="flex size-7 items-center justify-center rounded-full bg-white text-xs font-semibold text-aeblack-700 ring-1 ring-aeblack-100">06</span>
            <div><h3 class="text-sm font-semibold text-aeblack-800 sm:text-base">Changes to these terms</h3><p class="mt-1 text-sm text-aeblack-600">If we change these terms, we'll show you the new version before your next application. Applications already submitted follow the terms you accepted.</p></div>
          </li>
        </ol>

        <p class="mt-6 flex items-center gap-3 text-xs text-aeblack-600"><span aria-hidden="true" class="h-px flex-1 bg-aeblack-200"></span>End of terms<span aria-hidden="true" class="h-px flex-1 bg-aeblack-200"></span></p>
      </div>
      <div data-terms-fade aria-hidden="true" class="pointer-events-none absolute inset-x-0 bottom-0 h-14 rounded-b-2xl bg-linear-to-t from-aeblack-50 to-transparent transition-opacity duration-200"></div>
    </div>

    <div class="mt-5 rounded-2xl p-4 ring-1 ring-aeblack-100">
      <aegov-checkbox data-terms-agree name="terms" value="accepted" variant="neutral-max" label="I have read and agree to the terms of use" hint="You can find a copy in your account at any time."></aegov-checkbox>
    </div>

    <div class="-mx-5 -mb-5 mt-6 flex flex-col gap-3 border-t border-aeblack-100 bg-aeblack-50 px-5 py-4 sm:flex-row sm:items-center sm:justify-between">
      <p data-terms-status role="status" class="flex items-center gap-2 text-xs text-aeblack-600 sm:text-sm">
        <svg data-terms-icon="locked" aria-hidden="true" class="size-4 shrink-0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
        <svg data-terms-icon="ready" aria-hidden="true" class="hidden size-4 shrink-0 text-aegreen-600" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>
        <span data-terms-status-text>Agree to the terms to continue</span>
      </p>
      <div class="grid gap-2 sm:flex sm:gap-3">
        <aegov-button data-terms-decline variant="neutral-max" appearance="outline" size="base" is-full="true">Decline</aegov-button>
        <aegov-button data-terms-accept variant="primary" size="base" is-full="true" is-disabled="true">Accept and continue</aegov-button>
      </div>
    </div>

    <aegov-button data-terms-close appearance="link" variant="neutral-max" size="sm" is-icon="true" aria-label="Close" class="absolute -end-2 -top-2">
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18M6 6l12 12"/></svg>
    </aegov-button>
  </div>
</aegov-modal>

<script>
  // Terms modal. The terms scroll on their own, with a progress bar and a fade that
  // shows there is more to read. "Accept and continue" stays disabled until the
  // checkbox is ticked; the status line beside it says why, and what changed.
  document.querySelectorAll('[data-terms-open]').forEach((trigger) => {
    const modal = document.getElementById('terms-modal');
    const terms = modal.querySelector('[data-terms]');
    const scroller = terms.querySelector('[data-terms-scroll]');
    const progress = terms.querySelector('[data-terms-progress]');
    const fade = terms.querySelector('[data-terms-fade]');
    const agree = terms.querySelector('[data-terms-agree]');
    const accept = terms.querySelector('[data-terms-accept]');
    const statusText = terms.querySelector('[data-terms-status-text]');

    trigger.addEventListener('click', () => modal.show());
    terms.querySelector('[data-terms-close]').addEventListener('click', () => modal.close());
    terms.querySelector('[data-terms-decline]').addEventListener('click', () => modal.close());
    accept.addEventListener('click', () => {
      // Example only: record the acceptance, then continue the application.
      modal.close();
    });

    const updateProgress = () => {
      const scrollable = scroller.scrollHeight - scroller.clientHeight;
      const read = scrollable > 0 ? Math.round((scroller.scrollTop / scrollable) * 100) : 100;
      progress.value = read;
      fade.classList.toggle('opacity-0', read >= 98);
    };
    scroller.addEventListener('scroll', updateProgress, { passive: true });
    modal.addEventListener('aegovModalOpen', () => requestAnimationFrame(updateProgress));

    agree.addEventListener('aegovCheckboxChange', () => {
      const agreed = agree.isChecked;
      accept.isDisabled = !agreed;
      terms.querySelector('[data-terms-icon="locked"]').classList.toggle('hidden', agreed);
      terms.querySelector('[data-terms-icon="ready"]').classList.toggle('hidden', !agreed);
      statusText.textContent = agreed ? 'You can continue now' : 'Agree to the terms to continue';
    });
  });
</script>

Uses the UAE Design System web components. Load the theme, base CSS and component loader first. See installation.