Announcement draft
Combine single-select alignment with multi-select text formatting.
Scheduled maintenance completes Sunday at 04:00 UTC with zero expected downtime for read replicas.
Alignment: left · Formatting: bold
Package: @ghostvue/themes. Status: experimental (stability policy).
Themed segmented GhostToggleGroup root with default elevation and layout styles.
Generated from the component manifest. Edit the manifest or Vue source, then rebuild the docs.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
size | 'sm' | 'md' | 'lg' | "md" | No | Track height, label size, and item padding from `control.size.<size>`, matching a GhostButton or GhostInput of the same size. Items take the root size. The default omits data-size so CSS can treat a missing hook as md. |
None declared.
None declared.
| Name | Description |
|---|---|
default | Toggle group items. |
None declared.
| Name | Type | Description |
|---|---|---|
element | HTMLElement | null | Headless group root element. |
focus | (options?: FocusOptions) => void | Focus the primary item tab stop. |
blur | () => void | Blur the focused item within the group. |
| Attribute | Value | Description |
|---|---|---|
data-part | root | Segmented group container. |
data-size | sm, lg | Control size on the toggle group track. Absent for the default md size. |
| Name | Description |
|---|---|
--ghost-elevation-1-bg | Group track background. |
--ghost-elevation-2-bg | Pressed item surface. |
Role: group. APG pattern: https://www.w3.org/WAI/ARIA/apg/patterns/button/.
Required ARIA attributes: none.
None declared.
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. |
Single-select alignment and multi-select formatting with GhostToggleGroup.
Combine single-select alignment with multi-select text formatting.
Scheduled maintenance completes Sunday at 04:00 UTC with zero expected downtime for read replicas.
Alignment: left · Formatting: bold
<script setup lang="ts">
import { computed, ref } from 'vue'
import {
GhostCard,
GhostToggleGroup,
GhostToggleGroupItem,
} from '@ghostvue/themes'
const alignment = ref<'left' | 'center' | 'right'>('left')
const formats = ref<string[]>(['bold'])
const previewStyle = computed(() => ({
textAlign: alignment.value,
fontWeight: formats.value.includes('bold') ? '700' : '400',
fontStyle: formats.value.includes('italic') ? 'italic' : 'normal',
textDecoration: formats.value.includes('underline') ? 'underline' : 'none',
}))
</script>
<template>
<section class="editor" aria-labelledby="editor-title">
<GhostCard>
<template #header>
<div class="editor__header">
<h2 id="editor-title" class="editor__title">Announcement draft</h2>
<p class="editor__lead">
Combine single-select alignment with multi-select text formatting.
</p>
</div>
</template>
<div class="editor__body">
<div class="editor__toolbar" role="toolbar" aria-label="Formatting">
<GhostToggleGroup
v-model="formats"
type="multiple"
aria-label="Text formatting"
>
<GhostToggleGroupItem value="bold" aria-label="Bold">
B
</GhostToggleGroupItem>
<GhostToggleGroupItem value="italic" aria-label="Italic">
I
</GhostToggleGroupItem>
<GhostToggleGroupItem value="underline" aria-label="Underline">
U
</GhostToggleGroupItem>
</GhostToggleGroup>
<GhostToggleGroup
v-model="alignment"
type="single"
aria-label="Text alignment"
>
<GhostToggleGroupItem value="left">Left</GhostToggleGroupItem>
<GhostToggleGroupItem value="center">Center</GhostToggleGroupItem>
<GhostToggleGroupItem value="right">Right</GhostToggleGroupItem>
</GhostToggleGroup>
</div>
<p class="editor__preview" :style="previewStyle">
Scheduled maintenance completes Sunday at 04:00 UTC with zero expected
downtime for read replicas.
</p>
</div>
<template #footer>
<p class="editor__status" role="status">
Alignment: {{ alignment }} · Formatting:
{{ formats.length > 0 ? formats.join(', ') : 'none' }}
</p>
</template>
</GhostCard>
</section>
</template>
<style scoped>
.editor {
max-inline-size: 36rem;
}
.editor__header {
display: grid;
gap: var(--ghost-space-gap-xs);
padding-block-end: var(--ghost-space-stack-sm);
}
.editor__title {
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;
}
.editor__lead,
.editor__status {
color: var(--ghost-text-muted);
font-size: var(--ghost-type-size-sm);
line-height: var(--ghost-type-line-snug);
margin: 0;
overflow-wrap: anywhere;
}
.editor__body {
display: grid;
gap: var(--ghost-space-stack-md);
}
.editor__toolbar {
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm) var(--ghost-space-gap-md);
}
.editor__preview {
border: var(--ghost-border-hairline-width) solid var(--ghost-border-muted);
border-radius: var(--ghost-radius-md);
color: var(--ghost-text-default);
font-size: var(--ghost-type-size-md);
line-height: var(--ghost-type-line-normal);
margin: 0;
padding: var(--ghost-space-inset-md);
}
</style>
Segmented layout switcher with default styles.
<script setup lang="ts">
import { GhostToggleGroup, GhostToggleGroupItem } from '@ghostvue/themes'
</script>
<template>
<GhostToggleGroup default-value="list" aria-label="Asset layout">
<GhostToggleGroupItem value="list">List</GhostToggleGroupItem>
<GhostToggleGroupItem value="grid">Grid</GhostToggleGroupItem>
<GhostToggleGroupItem value="board">Board</GhostToggleGroupItem>
</GhostToggleGroup>
</template>
Small toggle group in a reply bar beside a small input and button.
<script setup lang="ts">
import { ref } from 'vue'
import {
GhostButton,
GhostInput,
GhostToggleGroup,
GhostToggleGroupItem,
} from '@ghostvue/themes'
const formats = ref<string[]>(['bold'])
const reply = ref('')
</script>
<template>
<!--
A compact reply bar: the toggle group, input and button all take
size="sm", so the row keeps one height.
-->
<div class="reply-bar">
<GhostToggleGroup
v-model="formats"
type="multiple"
size="sm"
aria-label="Reply formatting"
>
<GhostToggleGroupItem value="bold">Bold</GhostToggleGroupItem>
<GhostToggleGroupItem value="italic">Italic</GhostToggleGroupItem>
<GhostToggleGroupItem value="code">Code</GhostToggleGroupItem>
</GhostToggleGroup>
<GhostInput
v-model="reply"
size="sm"
aria-label="Reply"
placeholder="Write a reply"
/>
<GhostButton size="sm">Send</GhostButton>
</div>
</template>
<style scoped>
.reply-bar {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: var(--ghost-space-gap-sm);
}
</style>