frame

Frame

The dashed character frame every graph sits inside: a caption on the top edge, corner glyphs, and optional marching-ant, pulse, scan, or hover-draw motion.

Install

pnpm add @fractaldesign/machines-ui
import '@fractaldesign/machines-ui/style.css';
import { Frame } from '@fractaldesign/machines-ui';

Preview

[ USAGE ]

Content goes inside the frame.

<Frame title="USAGE">
  <FrameBody>
    <p>Content goes inside the frame.</p>
  </FrameBody>
</Frame>
[ MARCH ]

Content goes inside the frame.

<Frame title="MARCH" motion="march" dash="long" pad="md">
  <FrameBody>…</FrameBody>
</Frame>
[ SCAN ]

Content goes inside the frame.

<Frame title="SCAN" motion="scan" dash="dot" corner="◆" cornerBlink pad="md">
  <FrameBody>…</FrameBody>
</Frame>
[ DRAW ]

Content goes inside the frame.

<Frame title="DRAW" motion="draw" dash="solid" pad="lg">
  <FrameBody>Hover to draw the frame.</FrameBody>
</Frame>

Props

PropTypeDefaultDescription
title string —Caption drawn on the top edge as `[ TITLE ]`. Uppercase, 1–2 words.
titleAlign 'center' | 'start' 'center'Where the caption sits on the top edge: `center`, or `start` to leave the middle of the edge free (a node's input port sits there). Default 'center'.
corner string '+'Character at each corner of the frame. Default "+".
dash FrameDash 'token'Dash rhythm. Default 'token' (follows `--graph-framer`).
motion FrameMotion 'none'Frame motion. Every loop is off under `prefers-reduced-motion`. Default 'none'.
speed number —Seconds per motion cycle — for `draw`, the hover duration. Defaults per motion (draw 0.3, march 0.7, pulse 2, scan 3).
easing Easing —Curve the motion runs on — an `EASINGS` name or a raw timing function.
pauseOnHover boolean falsePause the loop while hovered. Default false.
cornerBlink boolean falseBlink the corner glyphs. Default false.
pad FramePad 'none'Inner padding. Default 'none'.
ink string —Frame colour override. Defaults to `--text-primary`.
accent string —Corner + title colour override. Defaults to `--graph-accent`.
class string ''

API

  • snippet children Content rendered inside the component.
  • class forwarded to the outer element
  • a11y honours prefers-reduced-motion

Types

NameKindDescription
FrameDashtypeDash rhythm of the frame. `token` follows the theme's `--graph-framer`.
Dash
FrameMotiontypeFrame motion. - `march` marching ants, clockwise - `reverse` marching ants, counter-clockwise - `pulse` dashes drift out and back - `scan` a sweep of light travels around the frame - `draw` frame draws itself in on hover (no loop)
Motion
FramePadtypeInner padding.
Pad

Theming

CSS custom properties this component reads.

  • --bg
  • --bg-surface
  • --fg-dash
  • --fg-ink
  • --fg-on
  • --fg-period
  • --fg-speed
  • --fg-timing
  • --font-mono
  • --graph-accent
  • --graph-framer
  • --text-primary

Related

Used by

src/lib/components/frame/Frame.svelte

machines-ui