systomic

Component overrides

A component says which props, classes and styles a call site may pass. Everything else stays the component's business, so a Button looks like a Button everywhere.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • ErrorOxlint exits with a failure, so CI fails.

See the difference

Before
<Button className="h-[52px] bg-red-500 rounded-none">
After
<Button tone="danger" className="mt-4">

What doesn't work

8 findings

What works

No findings

Details

A component declares what call sites may pass in a block comment directly above its declaration:

One line per prop: @systomic-allow <prop> <values...> lists what it may take, @systomic-disallow <prop> <values...> what it may not. Props without a line are not checked.

@systomic-disallow <prop> * forbids the prop entirely, like @systomic-allow <prop> none.

Value Meaning
* Everything.
none Nothing (only with allow: the prop can’t be passed).
placement, sizing, layout A group, see below. Only for className, style and xstyle.
w-*, margin*, h-8 A glob or exact class / CSS property.
neutral danger Literal values, for any other prop.

{...stylex.props()} counts as style.

Groups

Group Tailwind classes (className) CSS properties (style, xstyle, CSS modules)
placement Margin: m-*, mx-*, my-*, mt-*, mr-*, mb-*, ml-*, ms-*, me-*
Position: static, fixed, absolute, relative, sticky
Inset: inset-*, inset-x-*, inset-y-*, inset-s-*, inset-e-*, top-*, right-*, bottom-*, left-*, start-*, end-*
Stacking: z-*
Self-alignment: self-*, justify-self-*, place-self-*
Grid/flex child: order-*, col-span-*, col-start-*, col-end-*, row-span-*, row-start-*, row-end-*, col-auto, row-auto, col-span-full, row-span-full, grow, shrink, basis-*, flex-1, flex-auto, flex-initial, flex-none
Display toggles: hidden, block, inline-block, inline, contents
margin*, position, inset*, top*, right*, bottom*, left*, zIndex, order, display, alignSelf, justifySelf, placeSelf, gridArea*, gridColumn*, gridRow*, flex, flexGrow, flexShrink, flexBasis
sizing w-*, h-*, size-*, min-w-*, min-h-*, max-w-*, max-h-*, aspect-* width, height, minWidth, minHeight, maxWidth, maxHeight, inlineSize, blockSize, minInlineSize, minBlockSize, maxInlineSize, maxBlockSize, aspectRatio
layout placement + sizing placement + sizing

Not in any group, so only reachable through * or a glob: padding, gap, colors, typography, borders, radius, shadows, opacity, transforms, transitions. These are what a component decides itself.

Classes are matched without variants, ! and a leading - (md:-mt-2 counts as mt-2). CSS properties are matched in camelCase (margin-top counts as marginTop). CSS-module classes are checked by the declarations behind them (.big { height: 4rem } is sizing).

The rule follows relative and aliased imports, package imports, barrel files (export *, export { X } from) and default exports. Class strings behind variables, cva and imports are checked (see “Class strings behind references”), and CSS-module classes must only set CSS properties from the allowed groups (.big { height } breaks placement). Values only known at runtime are not checked.

Design system as a package

Package imports (import { Button } from "@acme/ui") are resolved through node_modules and the package’s exports (including ./* patterns), or source / types / module / main without exports. Conditions are tried in this order: source, types, import, module, default, require. A condition whose file doesn’t exist is skipped.

  • Workspace packages: add a source condition pointing to the sources, and the annotations are read straight from the .tsx files.
  • Published packages: annotations are read from the .d.ts files. tsc keeps JSDoc comments there unless removeComments is on. For ./button.js imports, button.d.ts / button.tsx next to it are tried first.

Setting packages is recommended: otherwise any capitalised import from a large library (icon sets) has its declaration file parsed once per lint run, just to find no annotations.

Annotations are read from other files, so after changing one, the editor only updates call sites in other files when they are linted again. CI is not affected.

See Styling for how classes, inline styles, StyleX and stylesheets are read.

Esc