Skip to main content

Examples

Every card is a complete xsvg document, compiled live in your browser. Click any one to open it in the viewer (pan, zoom, inspect), or hit Edit in Playground to tweak it.

A brief intro to xsvg

Start here — one file, three x:artboard slides touring what the format is. names a slide frame; the preview pages them with nav (§5.2).

Artboards (slides)

Three x:artboard slides in one file — a title, a bar chart, and a closing card; the preview pages them with a nav, the viewer zooms to the first, and it stays plain SVG in any viewer

Showcases

Realistic composites that combine several features.

System architecture

Shrink-to-fit service boxes, data nodes, a glyph-x-scale banner, arrow markers

Sprint board

Cards that wrap and ellipsis-truncate, title/body splits, right-aligned counts

Compile pipeline

Stretched heading, five shrink-to-fit stages with wrapping captions, arrow markers

Request flow

Branching yes/no decision, shrink-to-fit nodes, terminal states, arrow markers

Shape binding & region flow

— bind to a shape or flow inside its outline.

Chat bubbles

Two reuse each box — message + a bottom-right timestamp

Text in a shape

Flowed inside a triangle, circle, diamond, and a concave hourglass; valign centers the block

Badges & text effects

A certified seal with text curved around the rim (textpath rainbow), a shield with a warp-arched title, and a glossy meshgradient medal with a drop-shadowed label

Box models & alignment

textArea

SVG Tiny 1.2 flow: text-align, display-align, line-increment, auto sizing

textArea alignment

text-align × display-align matrix (all nine)

textbox alignment

align × valign matrix (cap-height centering)

Wrapping, fitting & overflow

Wrap vs overflow

The core win: overflowing vs inline-size wrapping vs fit="shrink"

Shrink-to-fit cards

Equal-size cards whose variable-length text all shrinks to fit

Auto sizing & clipping

width=auto, wrapping, height clipping, line-increment auto/loose/tight

text-overflow

clip vs ellipsis, for both block and inline overflow

Paragraph & character typography

Justification

text-align="justify": full lines flush, last line ragged, resets per

letter-spacing

Tracking scale, kerning-preserved pairs, layout-aware wrapping

word-spacing

Inter-word tracking; wider gaps wrap the same box sooner

tbreak & glyph-x-scale

Forced breaks plus condensed / regular / extended glyph widths

Styled runs

runs: per-run fill / weight / style flowing and wrapping inline

Paragraphs

children flow a as stacked paragraphs — space-before/after (paragraph-spacing), per-paragraph align (justify), first-line indent, and per-paragraph font/fill — plus a vertically-centered pull-quote built from three styled paragraphs (§6.16)

Bullet & numbered lists

/ : hanging-indent items whose drawn bullet shapes (disc / ring / square, optically balanced) and decimal→alpha→roman numbers cycle by depth, with the outer counter resuming after each sublist; a third list flows inside a referenced card (§6.14)

Bordered text

x:border-width / x:border-color: an outline hugging each glyph that sits behind the fill (paint-order) so it never thins the letters; border-width is the width visible outside the glyph — shown scaling 1→3→6 over a gradient (§6.17)

Vector output — create outlines

outline="true" — lower glyphs to geometry (§6.12).

Create outlines

font-family="-x-google-Anton" provisions a Google font by name; outline="true" also bakes its glyphs into

Geometry transforms — text on a path

— outline text and warp it onto a curve (§6.13).

Text on a path (skew & rainbow)

skew shears upright glyphs onto a wave; rainbow rotates and bends them along an arc, with baseline-shift floating runs above and below the same path

Placement & stair-step

align start/middle/end and a start offset place the run along the path; effect="stair" steps live selectable glyphs (also skew's no-font fallback)

Ribbon & native follow

effect="ribbon" tilts verticals with the curve (skew's complement); effect="follow" lowers to SVG's own — live and selectable

Geometry transforms — warp

— bake an envelope-preset field into plain path geometry (§7.3).

Envelope presets

eight presets — arch/flag/rise/wave + fisheye/inflate/squeeze/twist — over a rect + outlined text; the quality profile grades the bake tolerance

Arc & shell families

arc (annular sector, both bends) + arc-lower/upper, bulge, fish, shell-lower/upper — Make-with-Warp parity complete, 15/15

Perspective & free distort

corners-solved homography (straight lines stay straight), bilinear free distort, and the distort-h/v sliders composing after a preset

Bend & roughen

field="bend" in="#spine" flows a whole group along a path (align/start place it); field="roughen" jitters outlines with deterministic seeded noise

Connectors — diagramming

— lines routed between two boxes' edges (§7.6).

Connectors

lines bound to two boxes, routed four ways — straight (edge-clipped), x-major and y-major orthogonal rails, and a smooth curve; arrowheads tint to the stroke, and the route re-derives when an endpoint moves

Endpoints — anchors & points

beyond a bare #id: force which connection point a connector meets with #id:anchor — an edge, a corner (left-top…), or center — so same-side pairs curve into a leaf; or aim at a raw coordinate with to-point="x,y", needing no target element

Tables — content-driven rows

/// — author-set columns, row heights that grow to fit wrapped content (the Slides/Canva model), baked to rects + text (§6.15).

Tables

a fixed label column plus two flexible columns (cols="150 * *"), bold header cells with a header-fill, and body cells that wrap to their column and grow the row to fit the tallest — content-driven row heights, not HTML auto-layout; per-cell bg/align/weight overrides, all baked to plain rects + text

Theming — design tokens

compile-time color tokens (var(name) in any paint) + font tokens (x:font, an overridable base) — §4.1.

Design tokens

a palette of tokens and an scale referenced by fill="var(name)" (accent bar, swatches, button, list markers) and x:font="name" (kicker/title/heading/body); font tokens are an overridable base, and everything resolves at compile time

Charts — plots & pie

a linear data frame (bars & lines) and an angular one — coordinate systems, not a charting library (§7.8–7.9).

Bar & line plots

maps a data domain to a pixel box (y inverted, sizes stay in px): a bar chart with y-ticks, gridlines, labels and bottom-aligned s, and a line chart whose y-domain "20 25" puts 22.5 mid-height, with dot markers and an area fill

Pie, donut & polar-area

value sets each slice's angle, with one slice grown and exploded for emphasis; a donut via inner-radius + a constant-width parallel gap; and a Nightingale polar-area rose — equal angles with per-slice radius encoding the datum — all from one primitive, baked to sector paths

Inset & outset — path offsetting

— grow/shrink a region by a Minkowski offset, baked to one (§7.7).

Inset & outset

concentric ripples from one blob, a self-intersecting pentagram outset (evenodd, overlaps cleaned by the boolean pass), a spiky star inset and outset, and stacked outsets behind outlined text as a sticker halo — round/miter/bevel joins, all baked references

Path algebra — booleans

— Pathfinder ops baked to one (§7.4).

Boolean operations

union merges a circle cloud under one stroke; subtract punches text from a plate; intersect/exclude; and a boolean warped by flag — composability both ways

Operands by reference

children: a venn lens derived from circles that keep rendering, motifs stamped by offset and by rotation, a union punching a plate, and live text whose glyphs punch by reference

Mesh gradients

— corner colors on a quad/tri mesh with cracks, fitted and lowered as texel-aligned tiny PNGs (§8.2).

Aqua buttons

the classic use case: gel pill buttons as two patches — an opaque body mesh under a FEATHERED capsule gloss (its mesh IS the inset lens shape; alpha dissolves the shine), grounded by a compiled drop-shadow()

Mesh gradients

a seamless two-quad sky, the bilinear twist, a hard crack, a barycentric fan, the grid-sugar glow, and an SVG2/Inkscape meshgradient fill — curved Coons patches no browser can draw, compiled to tiny PNGs

Pixel adjustments

filter="brightness(1.2) …" — CSS filter functions lowered to portable primitives (§8).

Filters & tone curves

brightness/contrast/saturate/sepia/invert/hue-rotate compiled to sRGB filter graphs, plus -x-curve() Photoshop-style tone curves sampled into lookup tables

Composition by reference

in="#id" on an x: element resolves its compiled output — features chain.

Reference the compiled output

a textbox flowed inside a boolean union; type riding a warp's arched spine; a path → warp → textpath chain with one edit point

Cross-file <use> links

pulls in another file at compile time — the whole lockup, or just logo.xsvg#icon (one element by id, sized to its own extent) — so the xsvg mark is authored once and baked into the logo and every icon (§4.2)

Layers — compile-time z-order

x:layer="background|foreground" on a restacks at compile; still plain SVG uncompiled (§5.1).

Compile-time layers

x:layer background/foreground buckets restack a watermark, card, grid, and badge; x:order refines within a band, x:hidden drops a debug overlay — all ignorable x: attributes on plain groups

Edge cases & invariants

Degenerate input

empty text, inline-size=0, font-size=0, shrink floors, oversized words, degenerate textpath targets, reference cycles

Baseline stability

Descenders (Gg) do not shift the baseline vs Bb