Skip to content
English
Magnifier comes with Pro. Its preview shows once you unlock it.

How it works

The round view through the lens always has the same size on screen: that is the apparent field. The patch of cloth it shows, the true field, is the apparent field divided by the magnification M, drawn on the swatch as the accent circle and joined to the view by two cone lines. Raise M and the circle shrinks, the 1 mm bar in the view grows, and fewer threads fit across. For a simple magnifier M ≈ 250 mm ÷ f, so a 4× loupe has a focal length of about 62 mm. Three weaves (twill, basket weave, pinstripe) have different thread spacings.

Use it for

  • Teach magnification and field of view for loupes, microscopes, telescopes or a zoomable image viewer.
  • Show why a higher-power lens needs to be moved around more to inspect the same area.

Look elsewhere when

  • It is a model with a fixed apparent field and drawn fabrics; it is not an image zoom for your own pictures or a measuring tool.

Usage

import { WeaveLoupe } from './WeaveLoupe.jsx'

export function MagnifierLesson() {
  const [m, setM] = React.useState(4)
  return <WeaveLoupe magnification={m} onMagnificationChange={setM} defaultFabric="twill" />
}

Props

PropTypeDefaultWhat it does
magnificationnumber—Controlled magnification, 2 to 10 in steps of 0.5.
defaultMagnificationnumber4Starting magnification when uncontrolled; Reset returns to it.
onMagnificationChange(m: number, info: { reason }) => void—Receives the new magnification and why it changed: 'drag', 'press', 'tap', 'key', 'reset' or 'cancel'.
position{ x: number, y: number }—Controlled loupe centre in percent of the swatch. It is kept so the whole field circle stays on the swatch.
defaultPosition{ x: number, y: number }{ x: 50, y: 50 }Starting loupe centre when uncontrolled.
onPositionChange(position, info: { reason }) => void—Receives the new centre in percent, rounded to tenths.
fabric'twill' | 'basket' | 'pinstripe'—Controlled weave.
defaultFabric'twill' | 'basket' | 'pinstripe''twill'Starting weave when uncontrolled.
onFabricChange(fabric: string) => void—Receives the newly chosen weave.
labelsobject—Replaces any visible or announced string: title, formula, loupe, movable, loupeText, help, view, scale, field, threads, magnification, magnificationText, fabric, fabrics (three names) and reset.
localestring'en'Locale for the numbers.

Accessibility

  • Tab reaches Reset, the loupe, the magnification slider and the three fabric buttons. On the loupe the arrows move it (Shift moves further) and plus and minus change the magnification; the slider takes arrows, Page Up and Page Down, Home and End.
  • The field of view and the number of threads across it are announced politely when they change; the slider's value includes the field in millimetres.

Motion

After a key, a tap or Reset the loupe, its circle and the view glide for --ds-duration-base (the magnification on a log scale, so each doubling takes the same time); while dragged they follow the pointer directly. With reduced motion every change lands at once.

Add it to your project

Pro members copy a prompt and their coding agent installs the source, the same way as the free components.

WeaveLoupe.jsxweave-loupe.csstokens.cssREADME.md

Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.

Form inputs
Availability grid comes with Pro. Its preview shows once you unlock it.
Boolean operations comes with Pro. Its preview shows once you unlock it.
Cascader comes with Pro. Its preview shows once you unlock it.