Font size
Description
fontSize() sets a paragraph's size in five steps — extra small, small, default, large, extra large.
- Pressing the button opens a secondary toolbar showing the five steps in your language, each drawn at its own size — the name is its own preview.
- Default is a cancel, not a value. Picking it drops the attribute; nothing is stored. Picking the current step again also returns to default.
- Only four values are ever stored —
data-nabi-size="xs|sm|lg|xl". Unknown values are dropped by the filter. - It applies to paragraphs only. Headings have their own sizes, and the filter never keeps block attributes inside table cells or list items — enforced by the filter, not by CSS convention.
- Sizes are relative to the body (
emtokens). Change--nabi-font-sizeon the host and all five steps scale with it. The step values themselves are tokens (--nabi-size-xs…) you can swap.
| Step | Stored value | Default size |
|---|---|---|
| Extra small | xs | 0.75em |
| Small | sm | 0.875em |
| Default | — (no attribute) | 1em |
| Large | lg | 1.25em |
| Extra large | xl | 1.5em |
Demo
Wings
HTMLLoading the editor…
PreviewThe value above, drawn the way a reader sees it (nabiViewer). Click a table header to sort.
Install
npm install nabi-noteCode
import { nabi } from 'nabi-note'
import 'nabi-note/style.css'
nabi.create('#editor', {
wings: [],
locale: 'en',
onChange: (html) => save(html),
})