Parsware
All articles

Graphic Designer

Text and rich text

Placing text, giving one word its own weight and colour, fonts and sizes, and choosing whether the box fits the words or the words fit the box. Trying it, we fixed two things: you can now type as soon as you place a text, and styling after typing reaches the whole line.

A headline reading "Sales are up 12% on last year" with 12% in bold green, a paragraph below and a line of Persian text, on the Graphic Designer canvas, next to the title "Text and rich text"

Every screen has words on it: headings, labels, notes, the caption on a button. In the designer, text is an object like any other. You place it, size it and style it, and you can style one part of a line differently from the rest.

We worked in a 760 by 420 frame on an empty part of the Starter app sample's canvas, without saving.

Placing text

Press T, or pick the Text tool from the rail, and click where the text should start. A box appears with its placeholder selected, so just type:

A new text box on the canvas with the word Text highlighted, ready to be typed over

Click anywhere else when you're done. To change the words later, double-click the text, or edit them in the Text box in Properties.

New: you can type straight away. A click used to place a box reading Text and leave it there: nothing selected, no cursor, and the Text tool still on. The letters you typed next were taken as tool keys. Typing Hello left you on the Ellipse tool. Now the new text is selected, the Select tool is back, and the first key replaces the placeholder.

The Text section

With a text selected, Properties has a Text section:

The Text section: the words, Size 32, the font Inter, alignment and direction buttons, top/middle/bottom buttons, B I U with B on, and Set size / Fit the text

From the top:

  • The words themselves.
  • Size.
  • Font. Inter, Arial, Georgia, Times New Roman and Courier New are always there. Use local fonts adds the ones installed on your computer, in Chrome and Edge. Only use one of those if everyone who opens the app has it too.
  • Alignment: left, centre, right or justified, then left to right or right to left.
  • Where the words sit when the box is taller than they are: top, middle or bottom.
  • B, I and U: bold, italic and underline.
  • Set size or Fit the text, below.

The colour is in the Color section underneath. It works like any other fill, which is the next article.

Styling part of a line

Double-click a text to edit it, select some of the words, and the buttons and fields in Properties apply to the selection only. We typed Sales are up 12% on last year, set the size to 32, selected 12%:

The headline being edited with 12% highlighted

then pressed B and gave it a green colour:

The headline with 12% in bold green and the rest in the normal weight and colour

With nothing selected inside the text, the same buttons change the whole text, and a whole-text change wins over any part styled earlier. Bold, italic, underline, colour, outline, size and font can all be set on part of a line. Alignment and direction belong to the whole text.

New: styling after typing. The designer remembers the part you last selected, so a click on Size or Bold can still reach it after you've left the text. It went on remembering after you typed over it. Select the placeholder, type a headline, set Size 32, and only the first four letters grew. Typing now forgets the old selection, so a change reaches the whole text.

The box: Set size or Fit the text

Set size is the default. The width is yours, and the words wrap inside it. We set a note's width to 320:

A paragraph wrapped onto three lines inside a 320-wide box

The height is yours too, but only as a minimum. Make the box taller and it stays taller. It can never be shorter than the words, because a box that hid what you typed would be a mistake you can't see.

Fit the text makes the box exactly the words, as wide as the longest line and as tall as the lines. Nothing wraps, and the resize handles go away until you press Set size again:

The same paragraph on one long line, the box exactly around it

Use Fit the text for short things like labels, captions and numbers. Use Set size for anything that should wrap.

Where the words sit

When the box is taller than the words, the top / middle / bottom buttons say where they go. On a screen, the middle is the default, because that's what a caption inside a button needs:

The paragraph in the middle of a box twice its height

Choose the top for anything whose words might grow, such as a note or a description. A box that turns out too small then grows downwards, into space you can see, instead of up over whatever is above it:

The same paragraph at the top of the box

Right-to-left text

Type Persian, Arabic or Hebrew and the text turns right-to-left by itself, aligned to the right edge of its box:

A line of Persian, right-aligned in its box

The direction buttons in the Text section switch it by hand, for a line that mixes scripts.

Text, as the drawing stores it

A text node keeps its words and their look in a text object, beside the usual position and size:

{
  "type": "text",
  "name": "Title",
  "x": 64, "y": 24, "width": 500, "height": 36,
  "fill": "token:color.text",
  "text": {
    "content": "Support overview",
    "fontSize": 26,
    "fontFamily": "Inter, system-ui, sans-serif",
    "fontWeight": "600",
    "fontStyle": "normal",
    "textAlign": "left",
    "lineHeight": 1.3,
    "underline": false
  }
}

That is the heading of the Support overview dashboard sample. Its colour is the fill, and it is a token, token:color.text, which is why the heading reads dark on a light screen and light on a dark one with no second drawing. Give text a token colour rather than a fixed one wherever it should follow the theme. Shared styles and design tokens shows how to make whole text styles shared the same way.

A type scale

Text looks orderly when its sizes come from a short list, used the same way on every screen. A scale that suits business screens:

Use Size Weight
Page heading 26–32 600
Section heading 18–20 600
Body, labels, table text 14–16 400
Captions, hints, second lines 12–13 400
Big numbers on a dashboard tile 32–40 600

Two or three sizes on one screen is usually plenty. More than that and the screen stops having a clear first thing to read.

Words that come from data

On a Studio screen, much of the text isn't typed at all: a record's name, a count, a date. A text's words can be bound to an expression, so the screen fills them in as it runs. The dashboard sample's tiles do exactly that, showing text(state.total) in a text drawn once:

  • Draw the text at a realistic length. Type a long customer name while designing, so the box is sized for the real thing.
  • Prefer Set size, with the words at the top, for bound text that can be long. It wraps down, into space you can see.
  • Use Fit the text for short bound values, such as a count, so the box grows with the number.

Make a screen react and Show records on a screen cover binding.

Text for every reader

  • Say what it is on the Screen tab. A heading and a paragraph can look identical; marking a heading as one is what lets a screen reader jump between them. Roles: what each part of a screen is explains.
  • Don't rely on colour alone. The green 12% above reads as good news because of the words around it as well; a red number on its own says nothing to somebody who can't tell red from green.
  • Keep contrast up. Token colours are chosen to be readable in both themes. A custom pale grey on white is the commonest unreadable text there is.
  • Leave room for other languages. German words are long, and a Persian or Arabic line runs right to left. Boxes with Set size and room to wrap survive both. Building for more than one language has more.

Questions that come up

Can I use a company font? Use local fonts offers the fonts installed on your computer, in Chrome and Edge. A font only displays for people who have it too, so a company font is safe on company computers and risky on a public portal.

Why did my text box grow taller than I set it? Set size treats the height as a minimum: a box is never shorter than its words, so nothing you typed is hidden.

Try it

Press T, click and type a headline. Double-click it, select one word, and make that word bold and a different colour. Then place a paragraph, give it a width of 320, and try Fit the text and Set size in turn.

Next: fills, gradients and icons.