Design
Spacing and size
One spacing scale, control heights and the radii of each level.
Spacing is a single 4-pixel scale with half steps for tight places. A component uses it for its
inside; a parent Stack, Inline or Grid uses it for the gaps between its children.
#Spacing by level
Deeper is tighter. Each level has a named token, so a region does not invent its own inset.
| Where | Token | Desktop value |
|---|---|---|
| Between regions of a page | --faifo-layout-gap, --faifo-gap-section | 12px |
| Page side padding | --faifo-page-padding-x | 12px |
| Inside a working surface | --faifo-surface-inset | 16px |
| Heading to its content | --faifo-surface-head-gap | 8px |
| Between form rows | --faifo-gap-form-row | 16px |
| Between form columns | --faifo-gap-form-column | 24px |
| Between controls in a row | --faifo-gap-control | 8px |
On a phone --faifo-layout-gap drops to 8px and --faifo-surface-inset to 12px; pages keep the
same gutter on every side of their content.
#Controls
A default action is as high as an input, so a button lines up with the field beside it.
| Size | Token | Value |
|---|---|---|
| Default control | --faifo-control-height | 32px |
| Compact | --faifo-control-height-compact | 28px |
| Touch target | --faifo-touch-target | 44px |
| Table row | --faifo-table-row-height | 40px |
data-density="compact" or data-density="comfortable" on a data-faifo-design scope shifts
the density tokens for everything inside it.
#A control as wide as its value
A control fills its column by default, which suits a name, an address or a note. A
value of a few characters in a wide form reads lost in an empty box, so the field
states how long its value is with width; the control keeps to the start of its
column at that width and never grows past the column. Label, help and error keep
their own tracks, so a short control still lines up with the fields above it.
Field, TextField, NumberField, MoneyField, DatePicker and Combobox
accept it.
width | Control | For |
|---|---|---|
xs | 7rem | a rate, a percentage, a count of days or months |
sm | 11rem | an amount, a quantity, a date, a reference, a barcode, a phone number |
md | 18rem | a short choice: a unit, a group, a warehouse, a tax |
| none | the column | a name, a long choice (an account), an address, a description |
<MoneyField id="price" name="price" label="Sales price" currency="VND" width="sm" />
<Field id="shelf-life" name="shelfLife" label="Shelf life" type="number" width="xs" />Choose it from the value's length, not from the space left on the row. Specimen:
field-width.
In an Inline row (a toolbar's search, a quantity between a minus and a plus button) there is
no column to fill, so a sized field starts at its width and shrinks only when the row runs out of
room, never below 4rem. Without width a field in a row takes what its control measures. A row
whose fields all hide their label (labelHidden) is not a container for the label rule, so a row
sized by its content, such as a quantity stepper at the end of a card, keeps its width.
#Shape
Radii grow with the level: --faifo-radius-xs and -sm for small marks and controls inside
rows, --faifo-control-radius for controls, --faifo-radius-md and -lg for surfaces and
overlays, --faifo-radius-full for pills.
| Token | Value | Group | |
|---|---|---|---|
--faifo-radius-xs | 0.1875rem | Shape | |
--faifo-radius-sm | 0.3125rem | Shape | |
--faifo-radius-md | 0.4375rem | Shape | |
--faifo-radius-lg | 0.5625rem | Shape | |
--faifo-radius-xl | 0.75rem | Shape | |
--faifo-radius-full | 9999px | Shape | |
--faifo-radius-app-region | 0 | Shape |
#Spacing tokens
| Token | Value | Group | |
|---|---|---|---|
--faifo-space-0 | 0 | Spacing | |
--faifo-space-0-5 | 0.125rem | Spacing | |
--faifo-space-1 | 0.25rem | Spacing | |
--faifo-space-1-5 | 0.375rem | Spacing | |
--faifo-space-2 | 0.5rem | Spacing | |
--faifo-space-2-5 | 0.625rem | Spacing | |
--faifo-space-3 | 0.75rem | Spacing | |
--faifo-space-4 | 1rem | Spacing | |
--faifo-space-5 | 1.25rem | Spacing | |
--faifo-space-6 | 1.5rem | Spacing | |
--faifo-space-7 | 1.75rem | Spacing | |
--faifo-space-8 | 2rem | Spacing | |
--faifo-space-10 | 2.5rem | Spacing | |
--faifo-space-12 | 3rem | Spacing | |
--faifo-space-16 | 4rem | Spacing | |
--faifo-gap-control | var(--faifo-space-2) | Spacing | |
--faifo-gap-form-row | var(--faifo-space-4) | Spacing | |
--faifo-gap-field-group | var(--faifo-space-4) | Spacing | |
--faifo-gap-form-column | var(--faifo-space-6) | Spacing | |
--faifo-layout-gap | 0.75rem | Spacing | |
--faifo-gap-section | var(--faifo-layout-gap) | Spacing | |
--faifo-surface-inset | var(--faifo-space-4) | Spacing | |
--faifo-surface-head-gap | var(--faifo-space-2) | Spacing | |
--faifo-page-padding-x | var(--faifo-layout-gap) | Spacing | |
--faifo-page-padding-y | var(--faifo-space-5) | Spacing |
#Dimension tokens
| Token | Value | Group | |
|---|---|---|---|
--faifo-touch-target | 2.75rem | Dimensions | |
--faifo-app-topbar-height | 3rem | Dimensions | |
--faifo-help-width | 32rem | Dimensions | |
--faifo-control-height-xs | 1.5rem | Dimensions | |
--faifo-control-height-sm | 1.75rem | Dimensions | |
--faifo-control-height-md | 2rem | Dimensions | |
--faifo-control-height-lg | 2rem | Dimensions | |
--faifo-control-radius | 0.5rem | Dimensions | |
--faifo-control-padding-block | var(--faifo-space-1-5) | Dimensions | |
--faifo-control-padding-inline | var(--faifo-space-3) | Dimensions | |
--faifo-action-height | var(--faifo-control-height-md) | Dimensions | |
--faifo-control-height | var(--faifo-control-height-md) | Dimensions | |
--faifo-control-height-compact | var(--faifo-control-height-sm) | Dimensions | |
--faifo-control-height-prominent | var(--faifo-control-height-lg) | Dimensions | |
--faifo-density-control-height | var(--faifo-control-height-md) | Dimensions | |
--faifo-density-row-height | 2.5rem | Dimensions | |
--faifo-density-content-gap | var(--faifo-space-4) | Dimensions | |
--faifo-app-switcher-width | 3rem | Dimensions | |
--faifo-sidebar-width | 14.25rem | Dimensions | |
--faifo-right-rail-width | 21.25rem | Dimensions | |
--faifo-reading-width | 75rem | Dimensions | |
--faifo-sidebar-item-height | 1.875rem | Dimensions | |
--faifo-sidebar-child-height | 1.75rem | Dimensions | |
--faifo-sidebar-icon-size | var(--faifo-space-5) | Dimensions | |
--faifo-sidebar-indent | var(--faifo-space-5) | Dimensions | |
--faifo-table-row-height | 2.5rem | Dimensions | |
--faifo-table-header-height | 2.625rem | Dimensions | |
--faifo-table-text-max-width | 28rem | Dimensions | |
--faifo-table-text-min-width | 12rem | Dimensions | |
--faifo-table-text-wide-min-width | 18rem | Dimensions | |
--faifo-row-height | var(--faifo-table-row-height) | Dimensions | |
--faifo-container-field-narrow | 42rem | Dimensions | |
--faifo-container-rail-collapse | 64rem | Dimensions | |
--faifo-container-page-wide | 80rem | Dimensions |