Foundations
Typography
Font families, the text scale, weights and numerals.
Deft sets text in two families, Manrope for the interface and Ioskeley Mono for code, on a fixed scale of eight text styles. The default is 14px on an 18px line, and most of the interface never leaves it.
Font families
| Utility | Family | Where it comes from |
|---|---|---|
font-sans | Manrope Variable | The @fontsource-variable/manrope package. |
font-mono | Ioskeley Mono | Font files inside Deft, declared in theme.css. |
The theme sets font-sans on body, so you write the utility only to leave a mono context. Kbd.Root does that to keep key names in the interface font.
Ioskeley Mono ships in three weights, 400, 500 and 600, each split into a Latin and a Cyrillic file that the browser loads on demand. Both stacks end in system fonts: -apple-system, BlinkMacSystemFont, Segoe UI and sans-serif for font-sans, and ui-monospace, SFMono-Regular, Menlo, Consolas, Liberation Mono and monospace for font-mono.
Usage shows how an app loads Manrope.
Text scale
A text utility sets the font size and the line height together. The heading utilities also set the weight to 600.
| Utility | Size / line | Weight | Where Deft uses it |
|---|---|---|---|
text-heading-xl | 24 / 30 | 600 | No component. |
text-heading-lg | 20 / 26 | 600 | Breadcrumb.Root, Dialog.Title, the characters of OtpInput.Root |
text-heading-md | 18 / 22 | 600 | Drawer.Title, the title of Standalone.Heading |
text-heading-sm | 16 / 20 | 600 | Initials in the xl size of Avatar.Root |
text-body-lg | 16 / 24 | inherited | The unit next to the value of Metric.Card |
text-body-md | 14 / 18 | inherited | The default: body and almost every component |
text-body-sm | 12 / 14 | inherited | Kbd.Root, List.Description, chart axes, the Waterfall ruler, a labeled Separator.Root, the sm size of Dot.Root |
text-code | 13 / 18 | inherited | Code.Root, mono Input.Root and Textarea.Root |
How components use the scale:
text-body-mdis the size of the interface. Components set it on their own root, so they look the same in any container.- A title inside a page gains weight, not size.
Section.Title,Block.Title,Popover.Title,Callout.Titleand the label ofMetric.Cardare alltext-body-mdwithfont-semibold. - Heading sizes are for the few places that name the whole view: the page heading in
Breadcrumb.Root, the title of a dialog, a drawer or a standalone page. text-body-smis for text that supports something else: key hints, axis labels, the description under a list label. In its stacked layout a table also drops meta cells to this size.- A weight utility wins over the weight of a heading utility.
Breadcrumb.Itemsits insidetext-heading-lgand usesfont-mediumfor parent links.
Two display numbers are larger than the scale and set their size directly: the value of Metric.Card at 36px and the code of Standalone.Heading at 44px.
Weights
| Weight | Utility | Use |
|---|---|---|
| 400 | font-normal | Body text and descriptions. As a utility it resets the weight inside a heavier parent: the count in Table.Group, the meta of Property.Root, Stat.Note. |
| 500 | font-medium | Labels and names: Button.Root, Chip.Root, Tabs.Tab, Sidebar.Item, Field.Label, List.Label, Dot.Root, Kbd.Root, Empty.Title, Stat.Value. |
| 600 | font-semibold | Titles and short emphasis: Section.Title, Block.Title, Popover.Title, Callout.Title, Badge.Root, Stat.Delta, and every heading utility. |
No component uses a weight above 600.
Mono
font-mono goes together with text-code, 13px on an 18px line. Code.Root uses the pair with a 20px line for code blocks. Input.Root and Textarea.Root switch to it with font="mono":
import { Input } from "@openperf/deft";
<Input.Root defaultValue="acme-web" font="mono" />;Use mono for values that people copy or type exactly. The dashboard sets it on slug fields, on read-only inputs with a copy button and on short commit hashes.
Numerals
Numbers that line up or change in place use tabular-nums, which gives every digit the same width. Deft does not turn it on globally. Each component sets it where numbers appear:
- numeric cells of Table and
Stat.Value; - the value of
Metric.Cardand the percent ofMeter.Root; - counters and meta:
ActionBar,Section.Meta,Block.Meta, the trailing slot ofSidebar.Itemand ofMenu.Item; - axis labels and legend values of Chart, the ruler of
Waterfall; - line numbers of
Code.Rootand the characters ofOtpInput.Root.
Add tabular-nums yourself when you render a count, a duration or a timestamp next to others.
Components that format numbers do it with Intl.NumberFormat and the active Lingui locale: Chart.Root shortens axis values with compact notation, and Meter.Root prints its value as a percent. Pass your own formatter, such as formatValue on Chart.Root, when the unit is not a plain number.