Text

Text layers hold a string, its typography and how it wraps. Shared typography lives in text styles.

Text layers

Add text with the Text tool (T). To edit text on the canvas, double-click it or select it and press ↵. The Inspector's Text section shows the content, text style, font family, size, weight, line height, letter spacing and alignment.

A text layer is a node with type: "text" and its words in content. Text has no color of its own: it is invisible without a fill, and so are emoji.

Properties

PropertyValue
contentThe text.
fillThe text color, a hex string or a $variable.
fontFamilyAny Google Fonts family or installed system font. The default is Inter.
fontSizeSize in pixels.
fontWeightA string or number, such as "600".
fontStyleFor example "italic".
lineHeightA ratio of the font size: 1.5 is 150%. Unset uses the font's own line height.
letterSpacingPixels. "-0.02em", "2%" and "1px" are accepted and stored as pixels at the layer's font size.
textAlignleft, center, right or justify.
underline, strikethroughtrue or false.
textGrowthHow the text wraps and sizes. See below.
textStyleThe name of a shared text style.

textAlign aligns the text inside its own box, not the box inside its parent. Use the parent frame's layout for that. Text has no padding either: wrap it in a frame when it needs some.

Wrapping and size

textGrowth decides how a text layer wraps:

  • auto (the default): one line, sized by its content. Use it for labels, buttons and tags, without a width.
  • fixed-width: wraps at width, a number or fill_container, and takes its height from the content. Use it for headings and paragraphs.
  • fixed-width-height: both sides fixed. Extra lines overflow.
javascript
header = Insert(document, {type: "frame", name: "Header", layout: "vertical", width: 480, gap: 12})
Insert(header, {type: "text", name: "Title", textGrowth: "fixed-width", width: "fill_container", content: "Dashboard", fontFamily: "Inter", fontSize: 28, fill: "#18181B"})

Text is measured by the same browser engine that renders it, so the size you see in the editor matches screenshots and exports. This needs Chrome or Chromium installed; without it, layout falls back to estimates.

Text styles

A text style names a set of typography: fontFamily, fontSize, fontWeight, fontStyle, lineHeight, letterSpacing, underline and strikethrough. Any of these values can be a $variable. Color, alignment and growth stay on the layer.

A text layer uses a style with textStyle: "Heading/H1". Values set on the layer itself win over the style, so leave them unset to follow it. A / in the name groups styles in the app.

In the app, select a text layer and use Create text style in the Inspector to make a style from it, or Detach style to keep its look but stop following the style. All styles are listed under Text styles in the Variables tab.

Agents manage styles in an execute snippet with SetTextStyles, GetTextStyles, DeleteTextStyles and RenameTextStyle. Deleting a style first writes its values onto the layers that used it, so nothing changes look.

javascript
SetTextStyles({"Heading/H1": {fontFamily: "Inter", fontSize: 40, fontWeight: "700", lineHeight: 1.2}})
Insert(header, {type: "text", name: "Headline", textStyle: "Heading/H1", content: "Plan your week", fill: "#18181B"})

Something unclear, missing or broken? Write to feedback@anaknegeri.dev.