Ada Lovelace
- Work email
- ada@analytical-engines.example
- Bio
- Writes the notes that turn the Analytical Engine from a calculator into a general-purpose machine. Currently documenting loops and conditional branching for the next release.
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed wrappers around headless GhostDialog, GhostDialogTrigger, GhostDialogOverlay, GhostDialogContent, GhostDialogTitle, GhostDialogDescription, and GhostDialogClose. Importing from @ghostvue/themes loads the default elevation-4 dialog and scrim stylesheet.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
open | boolean | — | No | Controlled open state forwarded to headless GhostDialog. |
defaultOpen | boolean | false | No | Initial open state when open is omitted. |
modal | boolean | true | No | Enables modal behavior (trapped focus, scroll lock, inert background, overlay). |
None declared.
| Prop | Event | Type | Description |
|---|---|---|---|
open | update:open | boolean | v-model:open binding for controlled state. |
| Name | Description |
|---|---|
default | Dialog trigger, overlay, content, title, description, and close parts. |
| Name | Type | Description |
|---|---|---|
open | boolean | Current open state. |
close | () => void | Closes the dialog. |
None declared.
| Attribute | Value | Description |
|---|---|---|
data-part | trigger | Trigger control rendered by GhostDialogTrigger. |
data-part | overlay | Full-viewport backdrop rendered by GhostDialogOverlay with data-themed. |
data-part | content | Centered elevation-4 dialog surface rendered by GhostDialogContent with data-themed. |
data-part | title | Accessible heading rendered by GhostDialogTitle. |
data-part | description | Muted supporting description rendered by GhostDialogDescription. |
data-part | close | Close control rendered by GhostDialogClose. |
data-state | open | Applied to trigger, overlay, and content while open. |
data-state | closed | Applied to trigger while closed. |
| Name | Description |
|---|---|
--ghost-scrim | Shared semantic backdrop color of GhostDialogOverlay, supplied by the theme. |
--ghost-elevation-4-bg | Surface background color of GhostDialogContent. |
--ghost-elevation-4-border | Border color of GhostDialogContent. |
--ghost-elevation-4-shadow | Drop shadow of GhostDialogContent. |
--ghost-elevation-4-highlight | Inner highlight shadow of GhostDialogContent. |
--ghost-border-hairline-width | Border thickness. |
--ghost-radius-lg | Corner radius of GhostDialogContent. |
--ghost-surface-fg | Foreground text color. |
--ghost-text-muted | Muted text color applied to GhostDialogDescription. |
--ghost-space-inset-lg | Internal padding and viewport margin of GhostDialogContent. |
--ghost-space-gap-md | Vertical spacing between sections inside GhostDialogContent. |
--ghost-focus-ring-color | Outer focus-visible outline color when content receives focus. |
--ghost-focus-ring-contrast | Inner focus-visible halo color. |
--ghost-focus-ring-offset | Focus-visible outline offset. |
--ghost-focus-ring-width | Focus-visible outline width. |
Role: dialog. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/.
Required ARIA attributes: aria-expanded, aria-controls, aria-haspopup, aria-labelledby.
| Key | Action | Automated browser test |
|---|---|---|
Enter | Opens or toggles the dialog when focused on the trigger, or closes when focused on GhostDialogClose. | Not reviewed |
Space | Opens or toggles the dialog when focused on the trigger, or closes when focused on GhostDialogClose. | Not reviewed |
Tab | Cycles forward within modal dialogs. | Not reviewed |
Shift+Tab | Cycles backward within modal dialogs. | Not reviewed |
Escape | Dismisses the topmost open dialog when closeOnEscape is true and restores focus. | Not reviewed |
Each category is reviewed separately. Automated keyboard and axe results do not attest manual or assistive-technology review.
| Category | Status | Evidence |
|---|---|---|
| Automated keyboard | Not reviewed | No declared key is mapped to a browser test yet. |
| Manual interaction | Not reviewed | No review recorded. |
| Assistive technology | Not reviewed | No review recorded. |
Profile card with an edit dialog: validated fields, a scrolling form on short screens, and real save and cancel outcomes.
Research engineer
<script setup lang="ts">
import { computed, nextTick, reactive, ref } from 'vue'
import {
GhostAvatar,
GhostButton,
GhostCard,
GhostDialog,
GhostDialogClose,
GhostDialogContent,
GhostDialogDescription,
GhostDialogOverlay,
GhostDialogTitle,
GhostDialogTrigger,
GhostField,
GhostFieldControl,
GhostFieldDescription,
GhostFieldError,
GhostFieldLabel,
GhostInput,
GhostTextarea,
} from '@ghostvue/themes'
interface Profile {
name: string
title: string
email: string
bio: string
}
/*
* Deterministic seed data. The saved profile only changes on a valid Save;
* the dialog edits a draft copy so Cancel, Escape, and a backdrop click all
* leave the card exactly as it was.
*/
const profile = reactive<Profile>({
name: 'Ada Lovelace',
title: 'Research engineer',
email: 'ada@analytical-engines.example',
bio: 'Writes the notes that turn the Analytical Engine from a calculator into a general-purpose machine. Currently documenting loops and conditional branching for the next release.',
})
const draft = reactive<Profile>({ ...profile })
const bioLimit = 280
const open = ref(false)
const status = ref('')
const submitted = ref(false)
const nameInvalid = computed(() => draft.name.trim() === '')
// A deliberately small check: the browser still runs native email validation.
const emailInvalid = computed(
() => !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(draft.email.trim()),
)
// Errors appear after the first Save attempt, then update as the user types.
const showNameError = computed(() => submitted.value && nameInvalid.value)
const showEmailError = computed(() => submitted.value && emailInvalid.value)
const dirty = computed(() =>
(Object.keys(profile) as (keyof Profile)[]).some(
(key) => profile[key] !== draft[key].trim(),
),
)
function setOpen(next: boolean): void {
if (next) {
// Every session starts from the saved profile, never a stale draft.
Object.assign(draft, profile)
submitted.value = false
status.value = ''
} else if (dirty.value) {
status.value = 'Edits discarded.'
}
open.value = next
}
async function save(event: SubmitEvent): Promise<void> {
submitted.value = true
if (nameInvalid.value || emailInvalid.value) {
// Keep the dialog open and move focus to the first field that needs work,
// once the errors have rendered and set aria-invalid.
const form = event.currentTarget
if (!(form instanceof HTMLFormElement)) return
await nextTick()
form.querySelector<HTMLElement>('[aria-invalid="true"]')?.focus()
return
}
const changed = dirty.value
Object.assign(profile, {
name: draft.name.trim(),
title: draft.title.trim(),
email: draft.email.trim(),
bio: draft.bio.trim(),
})
status.value = changed ? 'Profile saved.' : 'No changes to save.'
// Closing through state returns focus to the Edit profile trigger.
open.value = false
}
</script>
<template>
<GhostCard class="profile">
<template #header>
<div class="profile__header">
<GhostAvatar :name="profile.name" size="lg" />
<div class="profile__identity">
<h2 class="profile__name">{{ profile.name }}</h2>
<p class="profile__meta">{{ profile.title }}</p>
</div>
</div>
</template>
<dl class="profile__details">
<div class="profile__detail">
<dt>Work email</dt>
<dd>{{ profile.email }}</dd>
</div>
<div class="profile__detail">
<dt>Bio</dt>
<dd>{{ profile.bio }}</dd>
</div>
</dl>
<template #footer>
<div class="profile__actions">
<p class="profile__status" role="status">{{ status }}</p>
<GhostDialog :open="open" @update:open="setOpen">
<GhostDialogTrigger :as="GhostButton" variant="outline">
Edit profile
</GhostDialogTrigger>
<GhostDialogOverlay />
<GhostDialogContent>
<div class="profile-dialog__header">
<GhostDialogTitle>Edit profile</GhostDialogTitle>
<GhostDialogDescription>
Your name, title, and bio appear on shared reports and workspace
invitations.
</GhostDialogDescription>
</div>
<form
class="profile-dialog__form"
novalidate
@submit.prevent="save"
>
<div class="profile-dialog__row">
<GhostField required :invalid="showNameError">
<GhostFieldLabel required>Full name</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostInput
v-bind="field"
v-model="draft.name"
name="name"
autocomplete="name"
block
/>
</GhostFieldControl>
<GhostFieldError v-if="showNameError">
Enter your name.
</GhostFieldError>
</GhostField>
<GhostField>
<GhostFieldLabel>Job title</GhostFieldLabel>
<GhostFieldControl v-slot="field">
<GhostInput
v-bind="field"
v-model="draft.title"
name="title"
autocomplete="organization-title"
block
/>
</GhostFieldControl>
</GhostField>
</div>
<GhostField required :invalid="showEmailError">
<GhostFieldLabel required>Work email</GhostFieldLabel>
<GhostFieldDescription>
Sign-in links and report digests go here.
</GhostFieldDescription>
<GhostFieldControl v-slot="field">
<GhostInput
v-bind="field"
v-model="draft.email"
type="email"
name="email"
autocomplete="email"
block
/>
</GhostFieldControl>
<GhostFieldError v-if="showEmailError">
Enter an address like name@company.com.
</GhostFieldError>
</GhostField>
<GhostField>
<GhostFieldLabel>Bio</GhostFieldLabel>
<GhostFieldDescription>
{{ draft.bio.length }} of {{ bioLimit }} characters.
</GhostFieldDescription>
<GhostFieldControl v-slot="field">
<GhostTextarea
v-bind="field"
v-model="draft.bio"
name="bio"
:maxlength="bioLimit"
:rows="3"
:max-rows="6"
auto-resize
/>
</GhostFieldControl>
</GhostField>
<div class="profile-dialog__actions">
<GhostDialogClose
:as="GhostButton"
variant="soft"
tone="neutral"
>
Cancel
</GhostDialogClose>
<GhostButton type="submit">Save changes</GhostButton>
</div>
</form>
</GhostDialogContent>
</GhostDialog>
</div>
</template>
</GhostCard>
</template>
<style scoped>
/*
* The card owns its width: 32rem keeps the details at a readable measure and
* lets the card shrink with the preview on phones.
*/
.profile {
max-inline-size: 32rem;
}
.profile__header {
align-items: center;
display: flex;
gap: var(--ghost-space-gap-md);
min-inline-size: 0;
padding-block-end: var(--ghost-space-stack-sm);
}
.profile__identity {
display: grid;
gap: var(--ghost-space-gap-xs);
min-inline-size: 0;
}
/* Native text picks up docs prose styles, so each element resets its own. */
.profile__name {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-lg);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-tight);
margin: 0;
overflow-wrap: anywhere;
}
.profile__meta,
.profile__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.profile__details {
display: grid;
gap: var(--ghost-space-stack-sm);
margin: 0;
}
.profile__detail {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.profile__detail dt {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-xs);
font-weight: var(--ghost-type-weight-medium);
line-height: var(--ghost-type-line-snug);
}
.profile__detail dd {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
margin: 0;
overflow-wrap: anywhere;
}
/* Give labels their own column when the preview has room for the values. */
@container ghost-demo (min-width: 26rem) {
.profile__detail {
align-items: baseline;
grid-template-columns: 5rem minmax(0, 1fr);
}
}
.profile__actions {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
justify-content: flex-end;
}
.profile__status {
flex: 1 1 auto;
}
.profile-dialog__header {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.profile-dialog__form {
display: grid;
gap: var(--ghost-space-stack-lg);
margin: 0;
}
/* Two names share a row when each can keep about 11rem; otherwise they stack. */
.profile-dialog__row {
display: grid;
gap: var(--ghost-space-stack-lg) var(--ghost-space-gap-md);
grid-template-columns: repeat(auto-fit, minmax(min(11rem, 100%), 1fr));
}
.profile-dialog__form :deep([data-part='description']),
.profile-dialog__form :deep([data-part='error']) {
overflow-wrap: anywhere;
}
.profile-dialog__actions {
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
}
</style>
Release notes on the elevation-4 surface that scroll inside the dialog when taller than the viewport.
<script setup lang="ts">
import {
GhostButton,
GhostDialog,
GhostDialogClose,
GhostDialogContent,
GhostDialogDescription,
GhostDialogOverlay,
GhostDialogTitle,
GhostDialogTrigger,
} from '@ghostvue/themes'
// Deterministic release notes, long enough to overflow a phone viewport.
const changes = [
{
title: 'Shared reports',
body: 'Reports can be shared with a link that expires after 30 days. Owners can revoke a link at any time from the report menu.',
},
{
title: 'Faster search',
body: 'Workspace search now indexes comments and attachments, and returns the first results while the rest are still loading.',
},
{
title: 'Keyboard shortcuts',
body: 'Press ? anywhere to list every shortcut. Shortcuts follow your keyboard layout, including right-to-left layouts.',
},
{
title: 'Audit log export',
body: 'Admins can export up to 12 months of audit events as CSV. Large exports are prepared in the background and emailed when ready.',
},
{
title: 'Retired: legacy embeds',
body: 'Embeds created before version 3 stop rendering next month. Replace them with the new embed code from the share menu.',
},
] as const
</script>
<template>
<GhostDialog>
<GhostDialogTrigger :as="GhostButton" variant="outline">
What's new in 4.2
</GhostDialogTrigger>
<GhostDialogOverlay />
<GhostDialogContent class="notes-dialog">
<div class="notes-dialog__header">
<GhostDialogTitle>What's new in 4.2</GhostDialogTitle>
<GhostDialogDescription>
Five changes since the last release. The dialog scrolls when the notes
are taller than the viewport.
</GhostDialogDescription>
</div>
<ul class="notes-dialog__list">
<li v-for="change in changes" :key="change.title">
<h3 class="notes-dialog__item-title">{{ change.title }}</h3>
<p class="notes-dialog__item-body">{{ change.body }}</p>
</li>
</ul>
<div class="notes-dialog__actions">
<GhostDialogClose :as="GhostButton">Got it</GhostDialogClose>
</div>
</GhostDialogContent>
</GhostDialog>
</template>
<style scoped>
.notes-dialog__header {
display: grid;
gap: var(--ghost-space-gap-xs);
}
.notes-dialog__list {
display: grid;
gap: var(--ghost-space-stack-md);
list-style: none;
margin: 0;
padding: 0;
}
.notes-dialog__item-title {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
font-weight: var(--ghost-type-weight-semibold);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.notes-dialog__item-body {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-normal);
margin: 0;
}
.notes-dialog__actions {
display: flex;
justify-content: flex-end;
}
</style>
A confirmation stacked on a share dialog; Escape dismisses only the innermost layer and focus returns to the outer dialog.
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostDialog,
GhostDialogClose,
type GhostDialogCloseExposed,
GhostDialogContent,
GhostDialogDescription,
GhostDialogOverlay,
GhostDialogTitle,
GhostDialogTrigger,
} from '@ghostvue/themes'
// The share link is local state, so revoking it is a visible, repeatable result.
const linkActive = ref(true)
const confirmOpen = ref(false)
const done = ref<GhostDialogCloseExposed | null>(null)
/*
* Revoking disables the inner dialog's opener, so focus cannot go back to it.
* Send it to Done instead; returning null keeps the default (the opener).
*/
function revokeReturnFocus(): HTMLElement | null {
return linkActive.value ? null : (done.value?.element ?? null)
}
function revoke(): void {
linkActive.value = false
confirmOpen.value = false
}
</script>
<template>
<GhostDialog>
<GhostDialogTrigger :as="GhostButton" variant="outline">
Share report
</GhostDialogTrigger>
<GhostDialogOverlay />
<GhostDialogContent>
<GhostDialogTitle>Share Q3 revenue report</GhostDialogTitle>
<GhostDialogDescription>
Pressing Escape while the confirmation is open closes only the inner
dialog.
</GhostDialogDescription>
<p class="share-status" role="status">
{{ linkActive ? 'Anyone with the link can view.' : 'Link revoked.' }}
</p>
<div class="share-actions">
<GhostDialog v-model:open="confirmOpen">
<GhostDialogTrigger
:as="GhostButton"
variant="soft"
tone="danger"
:disabled="!linkActive"
>
Revoke link
</GhostDialogTrigger>
<GhostDialogOverlay />
<GhostDialogContent
role="alertdialog"
:return-focus="revokeReturnFocus"
>
<GhostDialogTitle>Revoke the share link?</GhostDialogTitle>
<GhostDialogDescription>
People who open the old link will see an access request page.
</GhostDialogDescription>
<div class="share-actions">
<GhostDialogClose :as="GhostButton" variant="soft" tone="neutral">
Keep link
</GhostDialogClose>
<GhostButton tone="danger" @click="revoke">Revoke</GhostButton>
</div>
</GhostDialogContent>
</GhostDialog>
<GhostDialogClose ref="done" :as="GhostButton">Done</GhostDialogClose>
</div>
</GhostDialogContent>
</GhostDialog>
</template>
<style scoped>
.share-status {
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.share-actions {
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
}
</style>
Destructive confirmation with role="alertdialog", outside-click dismissal disabled, and a status after confirming.
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostDialog,
GhostDialogClose,
GhostDialogContent,
GhostDialogDescription,
GhostDialogOverlay,
GhostDialogTitle,
GhostDialogTrigger,
} from '@ghostvue/themes'
const open = ref(false)
const deleted = ref(false)
function confirmDelete(): void {
deleted.value = true
open.value = false
}
</script>
<template>
<div class="alert-demo">
<GhostDialog v-model:open="open">
<GhostDialogTrigger :as="GhostButton" tone="danger" variant="outline">
Delete workspace
</GhostDialogTrigger>
<GhostDialogOverlay />
<GhostDialogContent role="alertdialog">
<GhostDialogTitle>Delete workspace permanently?</GhostDialogTitle>
<GhostDialogDescription>
This removes all projects and cannot be undone. Outside backdrop
clicks do not dismiss an alert dialog.
</GhostDialogDescription>
<div class="alert-demo__actions">
<GhostDialogClose :as="GhostButton" variant="soft" tone="neutral">
Cancel
</GhostDialogClose>
<GhostButton tone="danger" @click="confirmDelete">
Confirm delete
</GhostButton>
</div>
</GhostDialogContent>
</GhostDialog>
<p class="alert-demo__status" role="status">
{{ deleted ? 'Workspace deleted.' : '' }}
</p>
</div>
</template>
<style scoped>
.alert-demo {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
}
.alert-demo__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
}
.alert-demo__actions {
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
justify-content: flex-end;
}
</style>