Kerning pair editor

Edits supplied glyph-pair offsets in font units, with baseline and edited previews, bounded keyboard nudging, and one-step undo.

Pair spacing
Pair

Georgia, serif · 1000 units per em

Baseline: -60 units
Edited: -80 units

Left and right arrows adjust one unit. Hold Shift for ten units.

Refine the space between letters

Pair review · Georgia

Pair spacing
Pair

Georgia, serif · 1000 units per em

Baseline: -60 units
Edited: -80 units

Left and right arrows adjust one unit. Hold Shift for ten units.

Use it for

  • Supplied glyph strings, a caller-selected font family, and explicit units per em.
  • value/defaultValue/onValueChange as a map from pair id to offset; null or an absent entry means not supplied.
  • baselineOffsets to compare and reset a pair; missing baselines never imply zero.
  • Optional min/max bounds default to negative and positive units per em; typed values retain native validation.
  • activePairId/defaultActivePairId/onActivePairChange for caller-owned pair navigation.

Not for

  • Treating the preview as a font shaping engine, font-file editor, or source of baseline kerning.
  • Assuming a requested font is installed; the browser uses its normal font fallback.
  • Undoing external host changes; undo is available only while the latest requested edit remains current.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { KerningPairEditor } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/kerning-pair-editor.

2. Vendor the source

npx @noorddev/vlak-cli add kerning-pair-editor

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/kerning-pair-editor.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { KerningPairEditor } from "@noorddev/vlak-react";

<KerningPairEditor label="Pair spacing" name="kerning" fontFamily="Georgia, serif" unitsPerEm={1000}
  pairs={[{ id: "av", left: "A", right: "V" }, { id: "to", left: "T", right: "o" }]}
  baselineOffsets={{ av: -60, to: -40 }} defaultValue={{ av: -80, to: -50 }} />

KerningPairEditor

Explicit pair offsets with browser font previews, without font-file editing or shaping.

PropTypeDefaultDescription
labelrequiredReactNode
pairsrequiredKerningPair[]
fontFamilyrequiredstring
unitsPerEmrequirednumber
baselineOffsetsKerningOffsets{}
valueKerningOffsets
defaultValueKerningOffsets{}
onValueChange(offsets: KerningOffsets) => void
activePairIdstring | null
defaultActivePairIdstring | null
onActivePairChange(id: string | null) => void
minnumber-unitsPerEm
maxnumberunitsPerEm
readOnlyboolean

Also accepts Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, "defaultValue" | "onChange">.

KeysDoes
TabMoves through the pair selector, navigation, offset editor, reset, and undo actions.
Arrow left, Arrow rightNudges the focused offset by one font unit within the supplied bounds.
Shift + Arrow left, Shift + Arrow rightNudges the focused offset by ten font units.
Enter, SpaceActivates the focused previous, next, reset, or undo button.
<fieldset class="rs-kerning-pair-editor"><legend class="rs-kerning-pair-editor-legend">Pair spacing</legend><div class="rs-kerning-pair-editor-previews"><figure class="rs-kerning-pair-editor-preview"><figcaption class="rs-kerning-pair-editor-note">Edited: -80 units</figcaption><div class="rs-kerning-pair-editor-glyphs" style="font-family:Georgia,serif" role="img" aria-label="A followed by V, edited offset -80 units"><span class="rs-kerning-pair-editor-glyph" aria-hidden="true">A</span><span class="rs-kerning-pair-editor-glyph" aria-hidden="true" style="margin-inline-start:-0.08em">V</span></div></figure></div><label class="rs-kerning-pair-editor-field">Offset (font units)<input class="rs-input rs-input-full rs-kerning-pair-editor-input" type="number" value="-80" min="-1000" max="1000" step="any" /></label></fieldset>
.rs-kerning-pair-editor.rs-kerning-pair-editor-legend.rs-kerning-pair-editor-toolbar.rs-kerning-pair-editor-field.rs-kerning-pair-editor-input.rs-kerning-pair-editor-button.rs-kerning-pair-editor-previews.rs-kerning-pair-editor-preview.rs-kerning-pair-editor-glyphs.rs-kerning-pair-editor-glyph.rs-kerning-pair-editor-note