You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
507 lines
22 KiB
507 lines
22 KiB
<script lang="ts">
|
|
import {
|
|
ButtonGroup,
|
|
type ButtonGroupVariant,
|
|
type ButtonGroupSize,
|
|
type ButtonGroupColor,
|
|
type ButtonGroupOrientation
|
|
} from '$uix/eidos/components/button-group';
|
|
import { Button } from '$uix/eidos/components/button';
|
|
import { compileMorfo } from '$uix/morfo';
|
|
import { buttonGroupMorfo } from '@/uix/morfo/components/button-group';
|
|
import TokensPanel from '../../lib/TokensPanel.svelte';
|
|
import TokensTabCount from '../../lib/TokensTabCount.svelte';
|
|
|
|
type Tab = 'live' | 'api' | 'morfo' | 'sema' | 'recipe' | 'tokens'
|
|
| 'a11y';
|
|
type TraceEntry = { event: string; family: string; intent?: string; at: number };
|
|
let tab = $state<Tab>('live');
|
|
let trace = $state<TraceEntry[]>([]);
|
|
let stageRef = $state<HTMLElement | null>(null);
|
|
|
|
// ── Live state — every public prop is a control ────────────────────────
|
|
let variant = $state<ButtonGroupVariant>('surface');
|
|
let size = $state<ButtonGroupSize>('md');
|
|
let color = $state<ButtonGroupColor>('primary');
|
|
let orientation = $state<ButtonGroupOrientation>('horizontal');
|
|
let attached = $state(true);
|
|
let block = $state(false);
|
|
let equal = $state<'auto' | 'on' | 'off'>('auto');
|
|
let disabled = $state(false);
|
|
let ariaLabel = $state('Text alignment');
|
|
let overrideMiddle = $state(false);
|
|
|
|
// `equal` prop: 'auto' (undefined → follows attached) · 'on' · 'off'.
|
|
const equalProp = $derived(equal === 'auto' ? undefined : equal === 'on');
|
|
|
|
const variants = ['solid', 'soft', 'surface', 'outline', 'ghost', 'plain'] as const;
|
|
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
const colors = ['primary', 'secondary', 'neutral'] as const;
|
|
const orientationOptions = ['horizontal', 'vertical'] as const;
|
|
|
|
// ── Compiled morfo ─────────────────────────────────────────────────────
|
|
const compiled = compileMorfo(buttonGroupMorfo);
|
|
const partsList = $derived([...compiled.parts.byKebab.values()]);
|
|
const events = $derived([...compiled.actions.byName.values()]);
|
|
|
|
function fmtTime(at: number): string {
|
|
const d = new Date(at);
|
|
return `${String(d.getSeconds()).padStart(2, '0')}.${String(d.getMilliseconds()).padStart(3, '0')}`;
|
|
}
|
|
|
|
$effect(() => {
|
|
const el = stageRef;
|
|
if (!el) return;
|
|
const obs = new MutationObserver((mutations) => {
|
|
for (const m of mutations) {
|
|
if (m.attributeName !== 'data-event') continue;
|
|
const target = m.target as Element;
|
|
const ev = target.getAttribute('data-event');
|
|
if (!ev) continue;
|
|
trace = [
|
|
{
|
|
event: ev,
|
|
family: target.getAttribute('data-event-family') ?? '—',
|
|
intent: target.getAttribute('data-event-intent') ?? undefined,
|
|
at: Date.now()
|
|
},
|
|
...trace
|
|
].slice(0, 6);
|
|
}
|
|
});
|
|
obs.observe(el, { attributes: true, subtree: true, attributeFilter: ['data-event'] });
|
|
return () => obs.disconnect();
|
|
});
|
|
|
|
// ── Code snippet (eidos-native — ButtonGroup has no soma layer) ────────
|
|
const eidosSnippet = $derived(
|
|
[
|
|
"<script lang='ts'>",
|
|
" import { ButtonGroup } from '$uix/eidos/components/button-group';",
|
|
" import { Button } from '$uix/eidos/components/button';",
|
|
'</' + 'script>',
|
|
'',
|
|
'<ButtonGroup',
|
|
` aria-label="${ariaLabel || 'Actions'}"`,
|
|
variant !== 'solid' && ` variant="${variant}"`,
|
|
size !== 'md' && ` size="${size}"`,
|
|
color !== 'primary' && ` color="${color}"`,
|
|
orientation !== 'horizontal' && ` orientation="${orientation}"`,
|
|
!attached && ' attached={false}',
|
|
block && ' block',
|
|
equal === 'on' && ' equal',
|
|
equal === 'off' && ' equal={false}',
|
|
disabled && ' disabled',
|
|
'>',
|
|
' <Button>Left</Button>',
|
|
overrideMiddle ? ' <Button variant="solid">Center</Button>' : ' <Button>Center</Button>',
|
|
' <Button>Right</Button>',
|
|
'</ButtonGroup>'
|
|
]
|
|
.filter(Boolean)
|
|
.join('\n')
|
|
);
|
|
</script>
|
|
|
|
<div data-uix-canvas-inner>
|
|
<header>
|
|
<div data-uix-eyebrow>Controls · ButtonGroup</div>
|
|
<h1 data-uix-page-title>ButtonGroup</h1>
|
|
<p data-uix-page-lede>
|
|
Presentational cluster of independent action buttons — <code>role="group"</code> plus shared
|
|
visual defaults (<code>variant</code> / <code>size</code> / <code>color</code> /
|
|
<code>disabled</code>) that propagate to the child <a href="/uix/components/button"
|
|
><Button></a
|
|
>s via context. Composes <a href="/uix/components/group"><Group></a> for the
|
|
segmented (<code>attached</code>) layout. Passive — 0 semantic events; each button fires its
|
|
own <code>contact-activate</code>.
|
|
</p>
|
|
<div data-uix-page-meta>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>parts</span>{compiled.parts.order.length}
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>events</span>0
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>composes</span>Group · Button
|
|
</span>
|
|
<span data-uix-meta-pill>
|
|
<span data-uix-meta-key>scope</span>eidos
|
|
</span>
|
|
</div>
|
|
</header>
|
|
|
|
<!-- Live preview always rendered -->
|
|
<div data-uix-stage>
|
|
<div data-uix-stage-area bind:this={stageRef}>
|
|
<ButtonGroup
|
|
{variant}
|
|
{size}
|
|
{color}
|
|
{orientation}
|
|
{attached}
|
|
{block}
|
|
equal={equalProp}
|
|
{disabled}
|
|
aria-label={ariaLabel || undefined}
|
|
>
|
|
<Button>Left</Button>
|
|
<Button variant={overrideMiddle ? 'solid' : undefined}>Center</Button>
|
|
<Button>Right</Button>
|
|
</ButtonGroup>
|
|
</div>
|
|
<div data-uix-stage-trace>
|
|
<span data-uix-stage-trace-key>trace</span>
|
|
{#if trace.length === 0}
|
|
<span>click a button to see its contact-activate</span>
|
|
{:else}
|
|
{#each trace.slice(0, 3) as entry}
|
|
<span
|
|
><span data-uix-stage-trace-event>{entry.event}</span> · {entry.family}{entry.intent
|
|
? ' · ' + entry.intent
|
|
: ''}</span
|
|
>
|
|
<span style="color: var(--uix-text-faint)">{fmtTime(entry.at)}</span>
|
|
{/each}
|
|
{/if}
|
|
<span style="margin-inline-start: auto;">
|
|
<span data-uix-stage-trace-key>attached</span>
|
|
{String(attached)}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-uix-tabs role="tablist">
|
|
<button data-uix-tab data-active={tab === 'live'} onclick={() => (tab = 'live')}>Live</button>
|
|
<button data-uix-tab data-active={tab === 'api'} onclick={() => (tab = 'api')}>
|
|
API <span data-uix-tab-count>10</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'morfo'} onclick={() => (tab = 'morfo')}>
|
|
<span data-uix-layer-badge="morfo">morfo</span>
|
|
<span data-uix-tab-count>{partsList.length}p · 0e</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'sema'} onclick={() => (tab = 'sema')}>
|
|
<span data-uix-layer-badge="sema">sema</span>
|
|
<span data-uix-tab-count>{events.length}</span>
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'recipe'} onclick={() => (tab = 'recipe')}>Recipe</button
|
|
>
|
|
<button data-uix-tab data-active={tab === 'tokens'} onclick={() => (tab = 'tokens')}>
|
|
Tokens <TokensTabCount component="button-group" />
|
|
</button>
|
|
<button data-uix-tab data-active={tab === 'a11y'} onclick={() => (tab = 'a11y')}>A11y</button>
|
|
</div>
|
|
|
|
{#if tab === 'live'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Controls</h2>
|
|
<p data-uix-section-desc>
|
|
ButtonGroup is eidos-only — no <span data-uix-layer-badge="soma">soma</span> split. The
|
|
visual props propagate as defaults to the child Buttons; an explicit prop on a child
|
|
always wins (toggle <code>override middle</code> to see it).
|
|
</p>
|
|
|
|
<div data-uix-subsection-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span> props · visual treatment + layout
|
|
</div>
|
|
<div data-uix-controls>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>variant <span data-uix-control-hint>propagated</span></span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each variants as v}
|
|
<button
|
|
data-uix-chip
|
|
data-active={variant === v}
|
|
onclick={() => (variant = v)}>{v}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>size <span data-uix-control-hint>propagated</span></span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each sizes as s}
|
|
<button data-uix-chip data-active={size === s} onclick={() => (size = s)}>{s}</button>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>color <span data-uix-control-hint>hierarchy, propagated</span></span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each colors as c}
|
|
<button data-uix-chip data-active={color === c} onclick={() => (color = c)}>{c}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>orientation</span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each orientationOptions as o}
|
|
<button
|
|
data-uix-chip
|
|
data-active={orientation === o}
|
|
onclick={() => (orientation = o)}>{o}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>attached <span data-uix-control-hint>segmented</span></span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={attached} />
|
|
<span data-uix-switch-label>{attached ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>block <span data-uix-control-hint>full width</span></span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={block} />
|
|
<span data-uix-switch-label>{block ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>equal <span data-uix-control-hint>same width · auto when attached</span></span>
|
|
<span data-uix-chips role="radiogroup">
|
|
{#each ['auto', 'on', 'off'] as e}
|
|
<button
|
|
data-uix-chip
|
|
data-active={equal === e}
|
|
onclick={() => (equal = e as 'auto' | 'on' | 'off')}>{e}</button
|
|
>
|
|
{/each}
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>disabled <span data-uix-control-hint>propagated</span></span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={disabled} />
|
|
<span data-uix-switch-label>{disabled ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>override middle <span data-uix-control-hint>child variant="solid" wins</span></span>
|
|
<span data-uix-switch>
|
|
<input type="checkbox" bind:checked={overrideMiddle} />
|
|
<span data-uix-switch-label>{overrideMiddle ? 'on' : 'off'}</span>
|
|
</span>
|
|
</label>
|
|
<label data-uix-control>
|
|
<span data-uix-control-label>aria-label</span>
|
|
<input type="text" bind:value={ariaLabel} placeholder="(role=group needs a name)" />
|
|
</label>
|
|
</div>
|
|
|
|
<div data-uix-code>
|
|
<div data-uix-code-head>
|
|
<span data-uix-layer-badge="eidos">eidos</span>
|
|
<span>visual · composes Group + Button, propagates defaults</span>
|
|
<span data-uix-code-lang>svelte</span>
|
|
</div>
|
|
<pre><code>{eidosSnippet}</code></pre>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'api'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>API reference</h2>
|
|
<p data-uix-section-desc>
|
|
Single-root component — <code><ButtonGroup></code> takes real
|
|
<code><Button></code> children (no <code>ButtonGroup.Item</code>). The visual props
|
|
propagate as defaults to those children via an eidos context.
|
|
</p>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Prop</th><th>Type</th><th>Default</th><th>Description</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">variant</td><td class="type">'solid' | 'soft' | 'surface' | 'outline' | 'ghost' | 'plain'</td><td class="default">'solid'</td><td>Propagated to child Buttons as their default variant.</td></tr>
|
|
<tr><td class="name">size</td><td class="type">ResponsiveProp<'xs' | 'sm' | 'md' | 'lg' | 'xl'></td><td class="default">'md'</td><td>Propagated to child Buttons.</td></tr>
|
|
<tr><td class="name">color</td><td class="type">'primary' | 'secondary' | 'neutral'</td><td class="default">'primary'</td><td>Hierarchical color propagated to child Buttons. Per-button intent is set on the Button itself.</td></tr>
|
|
<tr><td class="name">disabled</td><td class="type">boolean</td><td class="default">false</td><td>Disables every child Button at once.</td></tr>
|
|
<tr><td class="name">orientation</td><td class="type">'horizontal' | 'vertical'</td><td class="default">'horizontal'</td><td>Layout axis → <code>aria-orientation</code> + <code>data-orientation</code>.</td></tr>
|
|
<tr><td class="name">attached</td><td class="type">boolean</td><td class="default">true</td><td>Segmented: children share edges, inner corners squared, doubled borders collapsed.</td></tr>
|
|
<tr><td class="name">block</td><td class="type">boolean</td><td class="default">false</td><td>Stretch the group to fill the container inline-size; children fill it equally.</td></tr>
|
|
<tr><td class="name">equal</td><td class="type">boolean</td><td class="default">attached</td><td>Same button width. Vertical: each = the widest (content-sized). Horizontal: fills the container, split equally. Defaults ON when attached.</td></tr>
|
|
<tr><td class="name">aria-label</td><td class="type">string</td><td class="default empty">—</td><td>Accessible name. Recommended — <code>role="group"</code> needs a name.</td></tr>
|
|
<tr><td class="name">aria-labelledby</td><td class="type">string</td><td class="default empty">—</td><td>Accessible name by reference (id of a visible label).</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Reference comparison</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Library</th><th>Closest equivalent</th><th>Difference vs UIX</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">chakra-ui</td><td><code><ButtonGroup></code></td><td>Same shape — propagates size/variant/colorScheme + isAttached. Chakra doesn't set <code>role="group"</code>; UIX does (declared in morfo).</td></tr>
|
|
<tr><td class="name">mui</td><td><code><ButtonGroup></code></td><td>MUI sets <code>role="group"</code> + propagates via context, attached by default — same model. UIX adds <code>orientation</code> → <code>aria-orientation</code>.</td></tr>
|
|
<tr><td class="name">radix-themes</td><td>none (use <code><Flex></code>)</td><td>Radix has no ButtonGroup; <code>SegmentedControl</code> is a selection control. UIX keeps actions independent + groups them semantically.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'morfo'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>
|
|
<span data-uix-layer-badge="morfo">morfo</span> · declarative contract
|
|
</h2>
|
|
<p data-uix-section-desc>
|
|
ButtonGroup is scope-eidos — there is no soma runtime. The morfo locks the ARIA grouping
|
|
contract (<code>role="group"</code> + <code>aria-orientation</code> + accessible name) and
|
|
the <code>data-orientation</code> / <code>data-disabled</code> attrs. The wrapper
|
|
materialises exactly what the morfo declares — nothing more. Source:
|
|
<code>src/uix/morfo/components/button-group.ts</code>.
|
|
</p>
|
|
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Field</th><th>Value</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">name</td><td class="type">"{buttonGroupMorfo.name}"</td></tr>
|
|
<tr><td class="name">kebab</td><td class="type">"{buttonGroupMorfo.kebab}"</td></tr>
|
|
<tr><td class="name">scope</td><td class="type">[{buttonGroupMorfo.scope.map((s) => `"${s}"`).join(', ')}]</td></tr>
|
|
<tr><td class="name">parts.length</td><td class="default">{buttonGroupMorfo.parts.length}</td></tr>
|
|
<tr><td class="name">events.length</td><td class="default">0</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div data-uix-subsection-head>Parts</div>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Part</th><th>Marker</th><th>Element</th><th>Role</th><th>Archetype</th><th>States</th><th>Optional</th></tr></thead>
|
|
<tbody>
|
|
{#each partsList as part}
|
|
<tr>
|
|
<td class="name">{part.kebab}</td>
|
|
<td><code data-uix-part-marker>[{part.marker}]</code></td>
|
|
<td class="type"><{part.defaultElement}></td>
|
|
<td class="type">{part.role ?? '—'}</td>
|
|
<td class="default">{part.archetype ?? '—'}</td>
|
|
<td class="default">{part.states.length ? part.states.join(' | ') : '—'}</td>
|
|
<td class="default">{part.optional ? 'yes' : 'no'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{#each buttonGroupMorfo.parts as rawPart}
|
|
{@const partAny = rawPart as unknown as {
|
|
kebab: string;
|
|
aria?: ReadonlyArray<{
|
|
attr: string;
|
|
value: { kind: string };
|
|
condition?: { when: string; prop?: string };
|
|
severity?: string;
|
|
}>;
|
|
}}
|
|
{@const dataAttrs = compiled.contracts.dataAttrsByPart.get(partAny.kebab) ?? []}
|
|
{@const ariaAttrs = partAny.aria ?? []}
|
|
{#if dataAttrs.length || ariaAttrs.length}
|
|
<div data-uix-subsection-head>{partAny.kebab}</div>
|
|
{#if dataAttrs.length}
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>data-attr</th><th>Values</th><th>Source</th></tr></thead>
|
|
<tbody>
|
|
{#each dataAttrs as attr}
|
|
<tr>
|
|
<td class="name">{attr.attr}</td>
|
|
<td class="type">{attr.values ? attr.values.join(' | ') : '—'}</td>
|
|
<td class="default">{'value' in attr && attr.value ? (attr as { value: { kind: string } }).value.kind : '—'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|
|
{#if ariaAttrs.length}
|
|
<div data-uix-table-wrap style="margin-top: var(--uix-space-2);">
|
|
<table data-uix-table>
|
|
<thead><tr><th>aria-attr</th><th>Source</th><th>Condition</th><th>Severity</th></tr></thead>
|
|
<tbody>
|
|
{#each ariaAttrs as a}
|
|
<tr>
|
|
<td class="name">{a.attr}</td>
|
|
<td class="type">{a.value?.kind ?? '—'}</td>
|
|
<td class="default">{a.condition ? `when ${a.condition.when}${a.condition.prop ? ` (${a.condition.prop})` : ''}` : 'always'}</td>
|
|
<td class="default">{a.severity ?? 'required'}</td>
|
|
</tr>
|
|
{/each}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{/if}
|
|
{/if}
|
|
{/each}
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'sema'}
|
|
<section data-uix-section id="sema">
|
|
<h2 data-uix-section-title>
|
|
<span data-uix-layer-badge="sema">sema</span> · events
|
|
</h2>
|
|
<p data-uix-section-desc>
|
|
ButtonGroup declares no semantic events. As a structural frame it carries no perceptual
|
|
signal — per CANON §5 the signal belongs to the act, not the container. Each composed
|
|
<a href="/uix/components/button"><Button></a> fires its own
|
|
<code>contact-activate</code> (family <code>contact</code>); click a button in the stage
|
|
and watch the trace strip.
|
|
</p>
|
|
<div data-uix-empty-state>No Sema events declared.</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'tokens'}
|
|
<TokensPanel component="button-group" stage={stageRef ?? undefined} />
|
|
{/if}
|
|
|
|
{#if tab === 'recipe'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Eidos recipe</h2>
|
|
<p data-uix-section-desc>
|
|
Layout (flex, gap, attached corners + border overlap, grow) is owned by the composed
|
|
<a href="/uix/components/group"><Group></a> (<code>[data-group]</code>). ButtonGroup's
|
|
own CSS at <code>src/uix/eidos/components/button-group/button-group.css</code> adds only the
|
|
button-specific concerns.
|
|
</p>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Selector</th><th>Source</th><th>Purpose</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name"><code>[data-button-group]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Provider marker. Tunes Group's <code>--group-attached-overlap</code> to the Button border.</td></tr>
|
|
<tr><td class="name"><code>[data-button-group][data-orientation]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Layout axis (also drives Group's <code>data-direction</code>).</td></tr>
|
|
<tr><td class="name"><code>[data-button-group][data-disabled]</code></td><td><span data-uix-tag data-kind="morfo">morfo</span></td><td>Group-level disabled (propagated to each Button).</td></tr>
|
|
<tr><td class="name"><code>[data-button-group][data-attached] [data-button]:focus-visible</code></td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Float the focused/active button above neighbours so the ring isn't clipped.</td></tr>
|
|
<tr><td class="name"><code>[data-button-group][data-block]</code></td><td><span data-uix-tag data-kind="eidos">eidos</span></td><td>Full-width stretch.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
|
|
{#if tab === 'a11y'}
|
|
<section data-uix-section>
|
|
<h2 data-uix-section-title>Accessibility</h2>
|
|
<div data-uix-table-wrap>
|
|
<table data-uix-table>
|
|
<thead><tr><th>Concern</th><th>Contract</th></tr></thead>
|
|
<tbody>
|
|
<tr><td class="name">Role</td><td><code>role="group"</code> — declared in the morfo, fixed. A cluster of independent actions. For toolbar semantics (roving focus, single tab stop) use <a href="/uix/components/toolbar"><Toolbar></a> instead.</td></tr>
|
|
<tr><td class="name">Label</td><td>Provide <code>aria-label</code> or <code>aria-labelledby</code> — a <code>role="group"</code> without a name is announced as an unnamed group.</td></tr>
|
|
<tr><td class="name">Orientation</td><td><code>aria-orientation</code> mirrors the <code>orientation</code> prop (horizontal / vertical).</td></tr>
|
|
<tr><td class="name">Keyboard</td><td>Each button stays independently <span data-uix-kbd>Tab</span>-focusable — no roving. The group itself is not focusable; activation is the native button keyboard (<span data-uix-kbd>Enter</span> / <span data-uix-kbd>Space</span>) on each child.</td></tr>
|
|
<tr><td class="name">Disabled</td><td>The <code>disabled</code> prop propagates to every child Button (each gets <code>aria-disabled</code>) and the group sets <code>data-disabled</code>.</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
{/if}
|
|
</div>
|