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.
12345{ "rules": { "systomic/component-overrides": "error" }}See the difference
<Button className="h-[52px] bg-red-500 rounded-none"><Button tone="danger" className="mt-4">What doesn't work
8 findings12345678910111213141516171819202122232425import { Banner } from "@/design-system/banner";import { Button } from "@/design-system/button";import { Card } from "@/design-system/card";
export function Toolbar() { return ( <> <Button className="h-[52px] bg-red-500">Save</Button> <Button style={{ height: 52 }}>Cancel</Button> </> );}
export function Settings() { return ( <> <Banner className="w-full h-20 bg-red-500" tone="danger"> Something went wrong. </Banner> <Card className="mt-6 w-96 bg-muted" style={{ maxWidth: 480 }}> Profile </Card> </> );}systomic/component-overrides <Button> doesn't accept h-[52px] (allowed classes: placement). It changes how the component looks; use a prop or variant instead.
systomic/component-overrides <Button> doesn't accept bg-red-500 (allowed classes: placement). It changes how the component looks; use a prop or variant instead.
systomic/component-overrides <Button> doesn't accept style from call sites (see examples/src/design-system/button.tsx).
systomic/component-overrides <Banner> doesn't accept h-20 (allowed classes: layout but not h-*, min-h-*, max-h-*). It changes how the component looks; use a prop or variant instead.
systomic/component-overrides <Banner> doesn't accept bg-red-500 (allowed classes: layout but not h-*, min-h-*, max-h-*). It changes how the component looks; use a prop or variant instead.
systomic/component-overrides <Banner> doesn't accept tone=danger. Allowed: anything but danger.
systomic/component-overrides <Card> doesn't accept w-96 (allowed classes: anything but sizing). It changes how the component looks; use a prop or variant instead.
systomic/component-overrides <Card> doesn't accept maxWidth in style. Allowed: anything but sizing.
What works
No findings12345678910111213141516171819202122232425import { Banner } from "@/design-system/banner";import { Button } from "@/design-system/button";import { Card } from "@/design-system/card";
export function Toolbar() { return ( <> <Button className="mt-4 self-end">Save</Button> <Button>Cancel</Button> </> );}
export function Settings() { return ( <> <Banner className="mb-4 w-full" tone="info"> Changes are saved automatically. </Banner> <Card className="mt-6 bg-muted p-8" style={{ marginTop: 24 }}> Profile </Card> </> );}Details
A component declares what call sites may pass in a block comment directly above its declaration:
123456/** * @systomic-allow className placement * @systomic-allow style none * @systomic-allow tone neutral danger */export function Button(props: ButtonProps) {}12<Button className="mt-4 h-[52px] bg-red-500" style={{ height: 52 }} tone="primary" />// ^^^^^^^^ ^^^^^^^^^^ ^^^^^ ^^^^^^^^^^^^^^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.
12345678910// Everything except sizing./** @systomic-disallow className sizing */export function Card(props: CardProps) {}
/** * Layout, but no heights. Both on one prop: allowed minus disallowed. * @systomic-allow className layout * @systomic-disallow className h-* min-h-* max-h-* */export function Strip(props: StripProps) {}@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, stickyInset: 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-noneDisplay 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
sourcecondition pointing to the sources, and the annotations are read straight from the.tsxfiles. - Published packages: annotations are read from the
.d.tsfiles.tsckeeps JSDoc comments there unlessremoveCommentsis on. For./button.jsimports,button.d.ts/button.tsxnext to it are tried first.
12345678"settings": { "systomic": { // Only follow these packages (globs). Default: every installed package. "packages": ["@acme/*"], // `exports` conditions, in order. "conditions": ["source", "types", "import", "module", "default", "require"] }}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.