systomic

Origin-aware scale

A menu that scales in should grow out of the button that opened it. Without a transform origin it grows from its own center, detached from where you clicked.

  • RuleIn recommended.json: breaking it breaks the design-system contract.
  • ErrorOxlint exits with a failure, so CI fails.
  • StylelintThe same check runs on .css and .scss files through the Stylelint plugin.
  • Quick-fixYour editor offers a one-click fix. oxlint --fix leaves it to you.

See the difference

Before
className="data-[state=open]:zoom-in-95"
After
className="origin-(--radix-…-transform-origin) data-[state=open]:zoom-in-95"

What doesn't work

Oxlint

1 finding

Stylelint

1 finding

What works

No findings

Oxlint

Stylelint

Details

A positioned overlay that scales in should grow out of its trigger, not out of its own center. The rule reports scale animations on overlays that don’t set transform-origin.

Only positioned overlays are checked, so scaling elsewhere doesn’t fire (icon swaps in an icon button, active:scale-95, hover scale on cards, scaling children inside a menu). An element is a positioned overlay when:

  • its name matches overlayPattern (DropdownMenu.Content, PopoverContent, Popover.Popup, Menu.Positioner, Select.Content, Tooltip.Content, HoverCard.Content, …) or is listed in overlays,
  • it has role="menu", "listbox" or "tooltip", or
  • it uses data-[side=…] variants (set by Floating UI based libraries).

Dialogs, sheets and drawers are not overlays here: they are centered or slide in, so the default origin is right.

<Content asChild><motion.div /></Content> and Base UI’s render={<motion.div />} are checked as one element, since their props end up on the same DOM node.

What counts as scaling:

  • Tailwind: zoom-in-* / zoom-out-*, or scale-* with a variant (data-[state=open]:, data-[starting-style]:, starting:) or next to a transition / animate-* class.
  • Motion: scale, scaleX, scaleY in initial, animate, exit, while* or variants.
  • Inline styles / StyleX: scale, or transform: scale(…) with conditional values or a transition, and StyleX keyframes with scale.

What counts as an origin: origin-* classes, transformOrigin (inline, StyleX, Motion style) and Motion’s originX / originY. With requireVariable: true, only a CSS variable counts (the trigger-aware origin of the library), so origin-top is reported too.

For Radix and Base UI imports, the message names the right variable and offers a quick-fix that adds the class.

Option Default
overlayPattern Radix / Base UI / shadcn overlay content names
overlays []: extra overlay component names
roles ["menu", "listbox", "tooltip"]
requireVariable false

Stylelint

For .css / .scss files (see Stylelint): A class with an overlay selector ([data-side], [role=menu|listbox|tooltip], popper wrappers) or @apply data-[side=…] that scales (state rule with transform: scale(), a transition, @keyframes with scale, zoom-*) without transform-origin. Option requireVariable as in Oxlint.

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

Esc