Modal dialog built on the native dialog element, with focus trapping and a close button.
<x-markas.modal title="Delete project?">
<x-slot:trigger>
<x-markas.button variant="danger">Delete project</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>import { Button } from "@/components/markas/Button";
import { Modal } from "@/components/markas/Modal";
export default function ModalExample() {
return (
<Modal
title="Delete project?"
trigger={<Button variant="danger">Delete project</Button>}
footer={
<>
<Button variant="secondary" type="submit" value="cancel">
Cancel
</Button>
<Button variant="danger" type="submit" value="delete">
Delete
</Button>
</>
}
>
The project and all of its data will be deleted permanently.
</Modal>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Modal from "@/components/markas/Modal.vue";
</script>
<template>
<Modal title="Delete project?">
<template #trigger>
<Button variant="danger">Delete project</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><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Modal from "$lib/components/markas/Modal.svelte";
</script>
<Modal title="Delete project?">
{#snippet trigger()}
<Button variant="danger">Delete project</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>---
import Button from "@/components/markas/Button.astro";
import Modal from "@/components/markas/Modal.astro";
---
<Modal title="Delete project?">
<Button slot="trigger" variant="danger">Delete project</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>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Modal } from "./markas/modal.component";
@Component({
selector: "markas-example",
imports: [Button, Modal],
template: `
<markas-modal title="Delete project?">
<button markas-button trigger variant="danger">Delete project</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 default class ModalExample {}Examples
Delete confirmation
<div class="flex justify-center">
<x-markas.modal title="Delete 3 files?">
<x-slot:trigger>
<x-markas.button variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" /></svg>
Delete selected
</x-markas.button>
</x-slot:trigger>
These files will be removed from the shared folder for everyone. You cannot undo this action.
<x-slot:footer>
<x-markas.button variant="secondary" type="submit" value="cancel">Keep files</x-markas.button>
<x-markas.button variant="danger" type="submit" value="delete">Delete files</x-markas.button>
</x-slot:footer>
</x-markas.modal>
</div>import { Button } from "@/components/markas/Button";
import { Modal } from "@/components/markas/Modal";
export default function Example() {
return (
<div className="flex justify-center">
<Modal
title="Delete 3 files?"
trigger={
<Button variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" />
</svg>
Delete selected
</Button>
}
footer={
<>
<Button variant="secondary" type="submit" value="cancel">
Keep files
</Button>
<Button variant="danger" type="submit" value="delete">
Delete files
</Button>
</>
}
>
These files will be removed from the shared folder for everyone. You
cannot undo this action.
</Modal>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Modal from "@/components/markas/Modal.vue";
</script>
<template>
<div class="flex justify-center">
<Modal title="Delete 3 files?">
<template #trigger>
<Button variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"
/>
</svg>
Delete selected
</Button>
</template>
These files will be removed from the shared folder for everyone. You
cannot undo this action.
<template #footer>
<Button variant="secondary" type="submit" value="cancel"
>Keep files</Button
>
<Button variant="danger" type="submit" value="delete"
>Delete files</Button
>
</template>
</Modal>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Modal from "$lib/components/markas/Modal.svelte";
</script>
<div class="flex justify-center">
<Modal title="Delete 3 files?">
{#snippet trigger()}
<Button variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"
/>
</svg>
Delete selected
</Button>
{/snippet}
These files will be removed from the shared folder for everyone. You cannot
undo this action.
{#snippet footer()}
<Button variant="secondary" type="submit" value="cancel"
>Keep files</Button
>
<Button variant="danger" type="submit" value="delete">Delete files</Button
>
{/snippet}
</Modal>
</div>---
import Button from "@/components/markas/Button.astro";
import Modal from "@/components/markas/Modal.astro";
---
<div class="flex justify-center">
<Modal title="Delete 3 files?">
<Button slot="trigger" variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3" />
</svg>
Delete selected
</Button>
These files will be removed from the shared folder for everyone. You cannot undo this action.
<Fragment slot="footer">
<Button variant="secondary" type="submit" value="cancel">Keep files</Button>
<Button variant="danger" type="submit" value="delete">Delete files</Button>
</Fragment>
</Modal>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Modal } from "./markas/modal.component";
@Component({
selector: "markas-example",
imports: [Button, Modal],
template: `
<div class="flex justify-center">
<markas-modal title="Delete 3 files?">
<button markas-button trigger variant="danger">
<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="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"
/>
</svg>
Delete selected
</button>
These files will be removed from the shared folder for everyone. You
cannot undo this action.
<ng-container footer>
<button
markas-button
variant="secondary"
type="submit"
value="cancel"
>
Keep files
</button>
<button markas-button variant="danger" type="submit" value="delete">
Delete files
</button>
</ng-container>
</markas-modal>
</div>
`,
})
export default class ModalConfirmDeleteExample {}With form
<div class="flex justify-center">
<x-markas.modal title="Invite a team member">
<x-slot:trigger>
<x-markas.button>
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6" /></svg>
Invite member
</x-markas.button>
</x-slot:trigger>
<div class="grid gap-4">
<x-markas.input name="invite-name" label="Name" placeholder="Sari Wijaya" />
<x-markas.input name="invite-email" type="email" label="Email" placeholder="sari@company.com" hint="We will send a link to join the workspace." />
</div>
<x-slot:footer>
<x-markas.button variant="secondary" type="submit" value="cancel">Cancel</x-markas.button>
<x-markas.button type="submit" value="invite">Send invite</x-markas.button>
</x-slot:footer>
</x-markas.modal>
</div>import { Button } from "@/components/markas/Button";
import { Input } from "@/components/markas/Input";
import { Modal } from "@/components/markas/Modal";
export default function Example() {
return (
<div className="flex justify-center">
<Modal
title="Invite a team member"
trigger={
<Button>
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6" />
</svg>
Invite member
</Button>
}
footer={
<>
<Button variant="secondary" type="submit" value="cancel">
Cancel
</Button>
<Button type="submit" value="invite">
Send invite
</Button>
</>
}
>
<div className="grid gap-4">
<Input name="invite-name" label="Name" placeholder="Sari Wijaya" />
<Input
name="invite-email"
type="email"
label="Email"
placeholder="sari@company.com"
hint="We will send a link to join the workspace."
/>
</div>
</Modal>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Input from "@/components/markas/Input.vue";
import Modal from "@/components/markas/Modal.vue";
</script>
<template>
<div class="flex justify-center">
<Modal title="Invite a team member">
<template #trigger>
<Button>
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6"
/>
</svg>
Invite member
</Button>
</template>
<div class="grid gap-4">
<Input name="invite-name" label="Name" placeholder="Sari Wijaya" />
<Input
name="invite-email"
type="email"
label="Email"
placeholder="sari@company.com"
hint="We will send a link to join the workspace."
/>
</div>
<template #footer>
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="invite">Send invite</Button>
</template>
</Modal>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Input from "$lib/components/markas/Input.svelte";
import Modal from "$lib/components/markas/Modal.svelte";
</script>
<div class="flex justify-center">
<Modal title="Invite a team member">
{#snippet trigger()}
<Button>
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6"
/>
</svg>
Invite member
</Button>
{/snippet}
<div class="grid gap-4">
<Input name="invite-name" label="Name" placeholder="Sari Wijaya" />
<Input
name="invite-email"
type="email"
label="Email"
placeholder="sari@company.com"
hint="We will send a link to join the workspace."
/>
</div>
{#snippet footer()}
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="invite">Send invite</Button>
{/snippet}
</Modal>
</div>---
import Button from "@/components/markas/Button.astro";
import Input from "@/components/markas/Input.astro";
import Modal from "@/components/markas/Modal.astro";
---
<div class="flex justify-center">
<Modal title="Invite a team member">
<Button slot="trigger">
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6" />
</svg>
Invite member
</Button>
<div class="grid gap-4">
<Input name="invite-name" label="Name" placeholder="Sari Wijaya" />
<Input
name="invite-email"
type="email"
label="Email"
placeholder="sari@company.com"
hint="We will send a link to join the workspace."
/>
</div>
<Fragment slot="footer">
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="invite">Send invite</Button>
</Fragment>
</Modal>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Input } from "./markas/input.component";
import { Modal } from "./markas/modal.component";
@Component({
selector: "markas-example",
imports: [Button, Input, Modal],
template: `
<div class="flex justify-center">
<markas-modal title="Invite a team member">
<button markas-button trigger>
<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="M15 19a6 6 0 0 0-12 0M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6"
/>
</svg>
Invite member
</button>
<div class="grid gap-4">
<markas-input
name="invite-name"
label="Name"
placeholder="Sari Wijaya"
/>
<markas-input
name="invite-email"
type="email"
label="Email"
placeholder="sari@company.com"
hint="We will send a link to join the workspace."
/>
</div>
<ng-container footer>
<button
markas-button
variant="secondary"
type="submit"
value="cancel"
>
Cancel
</button>
<button markas-button type="submit" value="invite">
Send invite
</button>
</ng-container>
</markas-modal>
</div>
`,
})
export default class ModalFormExample {}Single action
<div class="flex justify-center">
<x-markas.modal title="What's new in version 2.4">
<x-slot:trigger>
<x-markas.button variant="secondary">View release notes</x-markas.button>
</x-slot:trigger>
<ul class="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
<x-slot:footer>
<x-markas.button type="submit" value="close">Got it</x-markas.button>
</x-slot:footer>
</x-markas.modal>
</div>import { Button } from "@/components/markas/Button";
import { Modal } from "@/components/markas/Modal";
export default function Example() {
return (
<div className="flex justify-center">
<Modal
title="What's new in version 2.4"
trigger={<Button variant="secondary">View release notes</Button>}
footer={
<Button type="submit" value="close">
Got it
</Button>
}
>
<ul className="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
</Modal>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Modal from "@/components/markas/Modal.vue";
</script>
<template>
<div class="flex justify-center">
<Modal title="What's new in version 2.4">
<template #trigger>
<Button variant="secondary">View release notes</Button>
</template>
<ul class="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
<template #footer>
<Button type="submit" value="close">Got it</Button>
</template>
</Modal>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Modal from "$lib/components/markas/Modal.svelte";
</script>
<div class="flex justify-center">
<Modal title="What's new in version 2.4">
{#snippet trigger()}
<Button variant="secondary">View release notes</Button>
{/snippet}
<ul class="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
{#snippet footer()}
<Button type="submit" value="close">Got it</Button>
{/snippet}
</Modal>
</div>---
import Button from "@/components/markas/Button.astro";
import Modal from "@/components/markas/Modal.astro";
---
<div class="flex justify-center">
<Modal title="What's new in version 2.4">
<Button slot="trigger" variant="secondary">View release notes</Button>
<ul class="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
<Fragment slot="footer">
<Button type="submit" value="close">Got it</Button>
</Fragment>
</Modal>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Modal } from "./markas/modal.component";
@Component({
selector: "markas-example",
imports: [Button, Modal],
template: `
<div class="flex justify-center">
<markas-modal title="What's new in version 2.4">
<button markas-button trigger variant="secondary">
View release notes
</button>
<ul class="grid list-disc gap-2 pl-5">
<li>Dark mode now follows your system setting.</li>
<li>Export reports to CSV from any table.</li>
<li>Search results load twice as fast.</li>
</ul>
<ng-container footer>
<button markas-button type="submit" value="close">Got it</button>
</ng-container>
</markas-modal>
</div>
`,
})
export default class ModalAcknowledgeExample {}Icon trigger
<div class="flex justify-center">
<x-markas.modal title="Share project">
<x-slot:trigger>
<x-markas.button variant="secondary" aria-label="Share" class="size-10 px-0">
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13" /></svg>
</x-markas.button>
</x-slot:trigger>
Anyone with the link can view this project. Only members can edit it.
<x-slot:footer>
<x-markas.button variant="secondary" type="submit" value="cancel">Cancel</x-markas.button>
<x-markas.button type="submit" value="copy">Copy link</x-markas.button>
</x-slot:footer>
</x-markas.modal>
</div>import { Button } from "@/components/markas/Button";
import { Modal } from "@/components/markas/Modal";
export default function Example() {
return (
<div className="flex justify-center">
<Modal
title="Share project"
trigger={
<Button
variant="secondary"
aria-label="Share"
className="size-10 px-0"
>
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13" />
</svg>
</Button>
}
footer={
<>
<Button variant="secondary" type="submit" value="cancel">
Cancel
</Button>
<Button type="submit" value="copy">
Copy link
</Button>
</>
}
>
Anyone with the link can view this project. Only members can edit it.
</Modal>
</div>
);
}<script setup lang="ts">
import Button from "@/components/markas/Button.vue";
import Modal from "@/components/markas/Modal.vue";
</script>
<template>
<div class="flex justify-center">
<Modal title="Share project">
<template #trigger>
<Button variant="secondary" aria-label="Share" class="size-10 px-0">
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13"
/>
</svg>
</Button>
</template>
Anyone with the link can view this project. Only members can edit it.
<template #footer>
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="copy">Copy link</Button>
</template>
</Modal>
</div>
</template><script lang="ts">
import Button from "$lib/components/markas/Button.svelte";
import Modal from "$lib/components/markas/Modal.svelte";
</script>
<div class="flex justify-center">
<Modal title="Share project">
{#snippet trigger()}
<Button variant="secondary" aria-label="Share" class="size-10 px-0">
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13"
/>
</svg>
</Button>
{/snippet}
Anyone with the link can view this project. Only members can edit it.
{#snippet footer()}
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="copy">Copy link</Button>
{/snippet}
</Modal>
</div>---
import Button from "@/components/markas/Button.astro";
import Modal from "@/components/markas/Modal.astro";
---
<div class="flex justify-center">
<Modal title="Share project">
<Button slot="trigger" variant="secondary" aria-label="Share" class="size-10 px-0">
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13" />
</svg>
</Button>
Anyone with the link can view this project. Only members can edit it.
<Fragment slot="footer">
<Button variant="secondary" type="submit" value="cancel">Cancel</Button>
<Button type="submit" value="copy">Copy link</Button>
</Fragment>
</Modal>
</div>import { Component } from "@angular/core";
import { Button } from "./markas/button.component";
import { Modal } from "./markas/modal.component";
@Component({
selector: "markas-example",
imports: [Button, Modal],
template: `
<div class="flex justify-center">
<markas-modal title="Share project">
<button
markas-button
trigger
variant="secondary"
aria-label="Share"
class="size-10 px-0"
>
<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="M4 12v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7M16 6l-4-4-4 4M12 2v13"
/>
</svg>
</button>
Anyone with the link can view this project. Only members can edit it.
<ng-container footer>
<button
markas-button
variant="secondary"
type="submit"
value="cancel"
>
Cancel
</button>
<button markas-button type="submit" value="copy">Copy link</button>
</ng-container>
</markas-modal>
</div>
`,
})
export default class ModalIconTriggerExample {}Installation
npx markasui@latest add modalpnpm dlx markasui@latest add modalyarn dlx markasui@latest add modalbunx --bun markasui@latest add modal- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Install the dependency:
npm install alpinejs - Copy the component source below to
resources/views/components/markas/modal.blade.php.
resources/views/components/markas/modal.blade.php
@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>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Modal.tsx.
src/components/markas/Modal.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>
);
}- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Modal.vue.
src/components/markas/Modal.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>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/lib/components/markas/Modal.svelte.
src/lib/components/markas/Modal.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>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/components/markas/Modal.astro.
src/components/markas/Modal.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>- Make sure Tailwind CSS v4 and markas.css are installed. See Installation.
- Copy the component source below to
src/app/markas/modal.component.ts.
src/app/markas/modal.component.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();
}
}Usage
<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
<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.
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>;<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><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>---
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.
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() {}
}- The
valueof the button that closed the modal is available asdialog.returnValuein thecloseevent. - To open the modal from code, call
document..getElementById(id) .showModal() - The close button is labelled “Close”. Translate it with
closeLabel(Blade:close-label).
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.
Related components
More overlay components with the same classes in every framework.
- Alert DialogModal confirmation built on the native dialog element. It needs an explicit cancel or action choice and never closes on a backdrop click.
- Command PaletteSearchable list of commands in a modal dialog, filtered as you type, with arrow key navigation and an optional Ctrl+K or Cmd+K shortcut.
- Context MenuMenu opened by right-clicking an area or pressing Shift+F10, shown at the pointer through the Popover API with WAI-ARIA Menu keyboard support.
- DrawerFull-height side panel built on the native dialog element, sliding in from the right or left.
- Dropdown MenuAction menu built on the Popover API, with keyboard navigation following the WAI-ARIA Menu Button pattern.
- Hover CardPreview card built on the Popover API, shown when a link is hovered or focused, for profiles, repositories, and other previews.