Utility · Clipboard

Clipboard

Copy text to the clipboard with an auto-resetting copied state. Soma drives navigator.clipboard.writeText + the timeout reset; eidos forwards the Trigger to <Button> via the consumer pattern and animates the Indicator chip with the cascaded color accent.

parts{compiled.parts.order.length} events{events.length} sizes5 timeout {timeout}ms color {color} last event {lastEvent ?? '—'}
Inline value · Trigger sits next to the content to copy
{iconOnly ? '📋' : 'Copy'}
Block content · Trigger above a multi-line snippet
{iconOnly ? '📋' : 'Copy snippet'}
Last copied · what the consumer's onCopy recorded
{lastCopied ?? '— nothing copied yet —'}
log {#if log.length === 0} type a value above, click Copy — the Indicator chip pops for {timeout}ms; onCopy / onError entries land here. {:else} {#each log.slice(0, 3) as entry} {entry.kind} · {entry.msg} {fmtTime(entry.at)} {/each} {/if}
{#if tab === 'live'}

Controls

The Trigger renders via the Button consumer pattern — every Button visual prop (variant, iconOnly, rounded, size, color, intent) is forwarded. The Indicator is conditionally mounted while copied=true.

soma behaviour
eidos Clipboard cascade
eidos Trigger Button
eidos visual · Clipboard + Trigger (Button consumer) + Indicator svelte
{eidosSnippet}
{/if} {#if tab === 'api'}

API reference

3 parts: Provider · Trigger · Indicator. Trigger reuses the eidos <Button> via the consumer pattern; pass variant, iconOnly, icon, etc just like any Button.

Provider (Clipboard)
PropTypeDefaultDescription
valuestringrequiredString to copy on Trigger click.
timeoutnumber2000ms before copied resets to false.
onCopy(value) => void—Fires on successful copy.
onError(err) => void—Fires when the clipboard API throws (permission denied, document not focused, etc).
size eidos'xs' | 'sm' | 'md' | 'lg' | 'xl''md'Cascaded to the Trigger Button.
color eidosColorRole'affirm'Accent for the Indicator chip background + foreground.
Trigger (Button consumer)
PropTypeDefaultDescription
aria-labelstring'Copy to clipboard'Translated default.
variant · rounded · iconOnly · icon · intent · colorButton propsghost · md · falseForwarded to <Button> via the child snippet.
Indicator
PropTypeDefaultDescription
forceMountbooleanfalseKeep in DOM while not copied — useful for CSS exit transitions.
Snippet props (Provider children)
KeyTypeDescription
valuestringCurrent value that gets copied.
copiedbooleantrue for timeout ms after a successful copy.
copy() => Promise<void>Imperative copy — bypass the Trigger button (e.g. trigger from a keyboard shortcut).
{/if} {#if tab === 'morfo'}

morfo · declarative contract

Source: src/uix/morfo/components/clipboard.ts.

Parts
{#each partsList as part (part.kebab)} {/each}
PartMarkerElementRoleArchetypeStatesOptional
{part.kebab} [{part.marker}] <{part.defaultElement}> {part.role ?? '—'} {part.archetype ?? '—'} {part.states.length ? part.states.join(' | ') : '—'} {part.optional ? 'yes' : 'no'}
Events declaration
{#each events as action (action.name)} {@const sem = action.semantic} {@const intentDecl = 'intent' in sem ? sem.intent : undefined} {@const intentStr = typeof intentDecl === 'string' ? intentDecl : intentDecl ? `fromProp:${(intentDecl as { fromProp?: string }).fromProp ?? '?'}` : '—'} {/each}
namefamilyverbsequenceintenttarget
{action.name} {sem.family} {sem.verb ?? '—'} {sem.sequence ?? 'pre'} {intentStr} {action.target}
{/if} {#if tab === 'sema'}

sema · events

Clipboard raises commit-copy (intent affirm) on success, commit-copy-error (intent threat) on failure, and shift-reset when the auto-reset timer fires.

{#each events as action (action.name)} {@const intentDecl = 'intent' in action.semantic ? action.semantic.intent : undefined} {@const effectiveIntent = typeof intentDecl === 'string' ? intentDecl : undefined} {/each}
NameFamilyVerbSequenceIntentPlay
{action.name} {action.semantic.family} {action.semantic.verb ?? '—'} {action.semantic.sequence ?? 'pre'} {effectiveIntent ?? '—'}
{/if} {#if tab === 'recipe'}

Eidos recipe

Selectors at src/uix/eidos/components/clipboard/clipboard.css.

SelectorSourceWhat it paints
[data-clipboard]eidosdisplay: contents host — color cascade only.
[data-clipboard-trigger]morfoMarker on the underlying Button (Button consumer pattern).
[data-clipboard-indicator]eidosPill chip with accent fill + pop-in animation.
@keyframes clipboard-popeidosIndicator mount animation. Disabled under prefers-reduced-motion.
{/if} {#if tab === 'a11y'}

Accessibility

The Trigger is a native <button> with a translated aria-label ("Copy to clipboard" by default). The Indicator is decorative — the announcement that "the copy succeeded" should be delivered via Announce if the consumer wants screen-reader feedback.

Suggested compose with Announce
{`
  {#snippet children({ announce })}
     announce("Copied to clipboard")}
    >
      Copy
      
    
  {/snippet}
`}
Limitations
{/if}