Styling
aa.css draws every block as Design system 1’s prose sheet draws the same Markdown read on a page: a line a square, a square between two blocks and two before a heading. Every measure and colour is a --ds-* token with its value as the fallback, so a page without Design system 1 still gets them, and a page with it gets its theme, scale and accent. One thing changes with an --aa-* property.
Drawn as prose
Every block on Design system 1’s squares: a line a square, a square between blocks, two before a heading.
What it stores
The editor brings the sheet itself, as a Design system 1 component does: the first editor in a document, or in a shadow root, puts it first in the head or that root before it draws, with Design system 1’s context.css (the toolbar), overlay.css (the sheet on touch) and its two fonts inside it. There is nothing to import. A page that wants the rules before any script runs, or whose Content Security Policy allows no inline style or data: fonts, imports the sheet itself, and the editor then brings no second copy:
import '@0001-labs/aa/aa.css'That sheet imports ds1/ and fonts/ from beside it; the package carries both, and so does a copy made with Sync 1. See Design system 1 for the measures it shares.
.notes .aa { --aa-typeface: "Söhne", system-ui; --aa-heading-gap: calc(3 * var(--ds-unit, 20px)); --aa-link: var(--ds-sharp-blue);}The editor’s own rule, on .aa and aa-editor, weighs nothing, so any rule of the page’s for them wins. Its rules for blocks are a class and an attribute each, which a product’s rule of the same weight outweighs, since the editor puts aa.css before the page’s own sheets.
| Property | Default | What it sets |
|---|---|---|
--aa-typeface | --ds-typeface-regular, --typeface-regular, system-ui | The text’s face. |
--aa-typeface-bold | --ds-typeface-medium, --typeface-medium, then the text’s face | Bold words. |
--aa-typeface-heading | --ds-typeface-medium, --typeface-medium, then the text’s face | Headings. |
--aa-typeface-mono | --typeface-mono, then Aa Mono | Code. |
--aa-size | --ds-type-size-default, 14px | The text’s size. |
--aa-line | One square | The line height. |
--aa-weight | --ds-type-weight-default, 400 | The text’s weight. |
--aa-weight-bold | --ds-type-weight-bold, 500 | Bold words. |
--aa-weight-heading | --ds-type-weight-bold, 500 | Headings. |
--aa-letterspacing | --ds-type-letterspacing-default, −0.3px | The text’s tracking. |
--aa-font-features | --ds-font-features, normal | font-feature-settings. |
--aa-h1 | --ds-type-size-display, 20px | A title, #. It stands on two squares. |
--aa-h2 | --ds-prose-h2-size, 17px | ##. |
--aa-h3 | --ds-prose-h3-size, 15px | ###. |
--aa-code-size | --ds-code-text-size, 13px | Code, in a line and in a block. |
Sizes in pixels are multiplied by the scale. Deeper headings take the text’s size.
| Property | Default | What it sets |
|---|---|---|
--aa-gap | One square | The room between two blocks. Bullets in a list stand with none. |
--aa-heading-gap | Two gaps | The room before a heading that follows another kind of block. |
--aa-indent | One square | A bullet’s room for its marker, and each level a list is nested by. |
--aa-picture-radius | --ds-radius, 4px | A picture’s corners. |
Colour
Section titled “Colour”| Property | Default | What it sets |
|---|---|---|
--aa-color | --ds-text-color, currentColor | The text. |
--aa-link | currentColor | A link, underlined. A link given a text colour wears that colour instead. |
--aa-marker | currentColor | A bullet’s dot and a list’s numbers. |
--aa-done | --ds-text-color-muted, the text at 55% | The words of a ticked box. |
--aa-placeholder | --ds-input-placeholder-color, #797979 (#ababab dark) | Placeholders and hints. |
--aa-rule | --ds-border-color, #d8d8d8 (#3d3d3d dark) | Hairlines: a code block’s frame, a divider, a callout’s line, a box’s edge, a table’s rows, the find bar. |
--aa-quote-rule | --ds-text-color-muted, #5f5f5f (#cacaca dark) | A quote’s hairline. |
--aa-table-rule | The hairline | A table’s row lines. |
--aa-table-header | The text | A table’s first row. |
--aa-code-fill | --ds-fill, #e6e6e6 (#3c3c3c dark) | Code in a line. |
--aa-code-paper | transparent | A code block’s ground. |
--aa-highlight | --ds-yellow, --yellow, Highlight | Highlighted words, ==…==, and find’s matches. |
--aa-highlight-ink | --ds-black, the text | The words on the highlight. |
--aa-text-selection | The text at 15% | Selected words, drawn as one rounded shape over their lines. |
--aa-selection | --aa-text-selection | A selected or lifted block. |
--aa-accent | --ds-sharp-blue, Highlight | Another person’s caret and its avatar. |
--aa-prompt | --ds-focus-ring, #594dff | A prompt to AI, its caret and what is asked in a comment. |
--aa-shimmer-color | --ds-accent-color, --accent-color, --apple-green, Highlight | The band that passes through corrected words, and through words waiting for AI. |
--aa-comment-fill | --ds-orange at 28% | Commented words. |
--aa-comment-fill-open | --ds-orange at 55% | The open thread’s words, and a new thread’s. |
Text colours
Section titled “Text colours”Words written in a colour, <span color="red">, are drawn in a dark ink of Design system 1’s palette on light paper and a light one on dark, so they stay readable. --aa-color-<name> changes one.
| Property | Light | Dark |
|---|---|---|
--aa-color-gray | --ds-darker-grey, #797979 | the same |
--aa-color-red | --ds-danger-color, #de0331 | #ff5f5f |
--aa-color-orange | --ds-warning-color, #4c3f1a | #fec20d |
--aa-color-green | #026d5b | #99ff73 |
--aa-color-blue | #0275fa | #69d8fb |
--aa-color-purple | #e63aaf | #f5aad1 |
The colours are TEXT_COLORS; see Formatting.
The toolbar and menus
Section titled “The toolbar and menus”The toolbar, the menus, the find bar and a prompt stand outside the editor, at the end of the page’s body, or in the dialog the editor is in. Properties for them are set on :root, or on .aa-controls itself.
| Property | Default | What it sets |
|---|---|---|
--aa-menu-fill | --ds-black, #2a2a2a (--ds-slate, #1e1e1e dark) | The block and slash menu’s rows, and the toolbar’s field for AI. Set on .aa-controls. |
--aa-menu-ink | --ds-white, #ffffff | Their words. Set on .aa-controls. |
--aa-menu-hover | The fill mixed 22% toward the ink | The row the pointer or the arrows are on. Set on .aa-controls. |
--aa-menu-radius | --ds-radius, 4px | The menu’s outer corners. |
--aa-controls-layer | 1000 | The z-index they stand on. |
The toolbar itself is Design system 1’s context bar, drawn by its context.css with its own --ds-context-* properties.
Set by Aa
Section titled “Set by Aa”Aa writes these itself. Read them in a product’s rules; do not set them.
| Property | What it is |
|---|---|
--aa-sf | The scale: --ds-sf, else --sf, else 1. |
--aa-unit, --aa-square | The square: --ds-unit, else --1, else 20px multiplied by --sf. |
--aa-rule-color | The hairline, from --aa-rule. |
--aa-depth | How deep a list item is nested. |
--aa-columns | How many columns a table row or a set of columns has. |
--aa-callout-icon | A callout’s icon. |
--aa-person | A person’s colour, in comments. |
--aa-muted | The muted ink, in comments. |
--aa-selection-mask, --aa-selection-box, --aa-selection-width, --aa-selection-height | The shape of selected words. |
--aa-glisten-delay | Where a block’s glisten starts. |
--aa-safe-bottom | The home indicator’s inset under a docked bar. |
Two fonts come with the editor’s styles, with their licence in fonts/LICENSE.md:
- Arrows are always Inter. “Inter Arrows” is Inter’s arrows alone, limited by
unicode-rangeto the arrow blocks. It stands first in every font Aa sets, code included, so → and ⇧ are Inter’s whatever the face. A product’s own font stack on Aa’s elements starts with it too. - Code is Aa Mono, Iosevka cut down to what code uses. It comes after
--aa-typeface-monoor--typeface-mono, then a system monospace, so code never falls back to a serif when the product’s font has not loaded.
.aa { --aa-typeface: "Inter Arrows", "Söhne", system-ui; }Dark mode
Section titled “Dark mode”The fallbacks are light-dark() pairs, so the editor follows the page’s color-scheme. Declare one, or load Design system 1’s theme, which declares it:
:root { color-scheme: light dark; }With no color-scheme, light-dark() takes its light colour on every page, a dark one too.
A build that lowers light-dark() for older browsers needs a color-scheme declared in that same build, or Design system 1’s theme script. Without one, the lowered colours, the toolbar’s black fill among them, draw nothing.
With forced colours, the selection, the shimmer and the comments’ tints give way to the system’s own colours. With reduced motion, nothing moves: the shimmer and the glisten only fade.
Every measure is multiplied by the page’s scale, Design system 1’s --ds-sf, or --sf. On a phone the page sets it with Design system 1’s scaling module, and the square, the type, the rows and the menus grow together:
import { startScaling } from '@0001-labs/design-system-1/ds1/1-root/scaling'startScaling()Set the scale on the page rather than --aa-sf on the editor: the toolbar and menus stand outside the editor and read it from the page. Hairlines stay one pixel. See Scaling and On a phone.
The editor’s element and its blocks carry what a product’s rules can reach:
| Selector | What it is |
|---|---|
.aa, aa-editor | The editor. |
.aa-block | A block, one a child. |
[data-kind] | Its kind: paragraph, heading, bullet, quote, code, divider, callout, table, equation or columns. |
[data-level], [data-checked], [data-number] | A heading’s level, a box’s state, a numbered item’s number. |
[data-callout], [data-folded] | A callout’s kind, and whether it is folded. |
[data-selected] | A selected block. |
.aa-b, .aa-i, .aa-u, .aa-s, .aa-c, .aa-highlight, a.aa-link, [data-color] | Bold, italic, underlined, struck, code, highlighted, linked and coloured words. |
.aa-atom[data-atom] | An atom, by its name. |
.aa-controls, .aa-toolbar, .aa-menu, .aa-find | The controls, the toolbar, a menu, the find bar. |