@@ -18,6 +18,31 @@ like what is already there, and extends it rather than standing beside it.
1818 maintainers decide whether it moves.
1919- Wording lives in the interface's config.
2020
21+ ## Styles
22+
23+ - A component's styles live in a CSS module beside it (` pane-bar.tsx ` ,
24+ ` pane-bar.module.css ` ), imported as ` styles ` , with camelCase class names.
25+ ` styles.css ` holds only what is global: fonts, tokens, element defaults,
26+ overrides of the library that apply everywhere, and shared keyframes.
27+ - Each module has exact types, generated by ` bun run css-types ` (the ` dev `
28+ script keeps them current and ` typecheck ` regenerates them), so
29+ ` styles.pane ` is a ` string ` and a misspelt class is a type error. Join
30+ classes with ` clsx ` only when one is conditional.
31+ - A look used in more than one place is a component, such as ` InlineNote ` ,
32+ ` Field ` , ` Fault ` or ` Banner ` , not a class two components share. Shared
33+ components live in ` components.tsx ` , or in a file of their own when they
34+ belong to one area.
35+ - A shared component owns its whole look and takes no ` className ` . Variants
36+ are props, rendered as ` data-* ` attributes (` data-tone="error" ` , or an
37+ empty ` data-pill="" ` for a flag); the element it renders is an ` as ` prop.
38+ - Every shared component's root carries a ` data-slot ` naming it. A parent
39+ positions it from its own module through that attribute, such as
40+ ` .notes > [data-slot="inline-note"] ` for margin, size or placement, never
41+ through another module's class, and never by restyling its inside.
42+ - The library's own classes, such as ` .dark ` , go in ` :global(...) ` , and a
43+ global keyframe in ` global(...) ` : ` animation: global(fade-in) 200ms ` .
44+ - Code and tests find elements by ` data-* ` attributes, never by a class name.
45+
2146## Every artifact kind is a first-class document
2247
2348A new kind (a sheet, a deck, a diagram) is integrated everywhere a document
0 commit comments