How it works
A textbook figure of a periodic pattern. The tinted cell with the ink outline is the source; the figure shows eight copies of it. Draw anywhere and the stroke is folded back into the source, so every copy repeats it. With Translate each copy is the source moved by whole cells (wallpaper group p1); with Mirror every other column is reflected across the vertical seam (pm); with Mirror both the copies are reflected across every seam (pmm). Mirror seams are dashed. Where a line meets a seam, a dot shows whether the neighbouring copy carries it on: an ink dot if it does, a red ring if it breaks. A mirror seam always continues a line; a translation seam only does when the line leaves one edge at the same height it enters the opposite edge. The readout counts the seam ends that continue.
Use it for
- Teach translation and reflection symmetry: why a wave repeats under any symmetry while a slanted line only joins up into a zigzag with mirrors.
- Let learners design a repeating motif and check that it tiles without breaks before using it as a border, fabric or wallpaper.
Look elsewhere when
- For rotations, glide reflections or non-square cells, use a full wallpaper-group tool: this one covers p1, pm and pmm on a square cell.
Usage
import React, { useState } from 'react'
import { WovenSeamStudio } from './WovenSeamStudio.jsx'
export function TilingLesson() {
const [strokes, setStrokes] = useState([])
const [seams, setSeams] = useState(null)
return (
<WovenSeamStudio
value={strokes}
onChange={(next, details) => {
setStrokes(next)
setSeams(details.seams)
}}
defaultSymmetry="mirror"
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
value | Array<Array<Array<[x, y]>>> | — | Controlled drawing: a list of strokes, each a list of pieces, each a list of points in source-cell units (0–100 on both axes). A stroke that crosses seams is stored as one piece per cell it passed through. |
defaultValue | Array<Array<Array<[x, y]>>> | one wave from the left edge to the right edge | Starting drawing when uncontrolled. Pass [] to start empty. |
onChange | (strokes, { reason, seams: { matched, total } }) => void | — | Called after a stroke is drawn, undone or cleared. reason is 'draw', 'keyboard', 'undo' or 'clear'; seams counts the seam ends and how many of them continue under the current symmetry. |
symmetry | 'translate' | 'mirror' | 'mirror2' | — | Controlled symmetry: translation only (p1), mirrors across the vertical seams (pm), or mirrors across every seam (pmm). |
defaultSymmetry | 'translate' | 'mirror' | 'mirror2' | 'translate' | Starting symmetry when uncontrolled. |
onSymmetryChange | (symmetry) => void | — | Called when the symmetry is changed. |
labels | object | — | Replaces any built-in text: title, formulas ({ translate, mirror, mirror2 }), legendSource, legendMatch, legendOpen, source, canvas, help, keys, symmetry, translate, mirror, mirror2, undo, clear, readout, noSeams, pointAdded ('{n}'), drawn ('{n}', '{matched}', '{total}'), undone, cleared and matchText ('{matched}', '{total}'). |
locale | string | 'en' | Language tag for the numbers. |
className | string | — | Extra class on the card, for example to set its width (30rem by default, never wider than its container). |
Accessibility
- The tiling is an application region with its instructions as its description. Arrows move a cross-hair (Shift moves half a cell), Space adds a point, Enter draws the stroke through the points, Backspace removes the last point and Escape drops them. A hint with these keys shows while the tiling has keyboard focus. Control or Command with Z undoes the last stroke.
- A polite status announces each stroke with how many seam ends continue, and the new count when the symmetry changes.
- The symmetry is a radio group: arrows move between Translate, Mirror and Mirror both. Undo and Clear are buttons, marked unavailable when there is nothing to remove.
- Drawing uses pointer capture and touch-action none on the tiling only; a cancelled gesture draws nothing.
Motion
When the symmetry changes, the mirrored copies flip over for --ds-duration-base; while drawing, every copy follows the pointer at once. With reduced motion there is no animation.
Add it to your project
Pro members copy a prompt and their coding agent installs the source, the same way as the free components.
WovenSeamStudio.jsxwoven-seam-studio.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.







