Diagnostics

LUM3011: <style> as the root or in an expression

A <style> block is the root of a component's output, or is used as an expression.

Severity: error · Category: styles (3xxx)

Reported by: the scanner and the compiler.

#What it means

A block is not an element: it renders nothing and only attaches CSS to its scope. `return

`, `() => ` or `const css = ` therefore have no

element to attach to. (For tools, the block is masked to null so parsing continues.)

#Example

stsx
export function Theme() {
  return (
    <style>
      :root { --accent: tomato; }
    </style>
  );
}

#How to fix it

Put the block inside the element the component returns, at the file top level, or make it global in a layout:

stsx
<style global>
  :root { --accent: tomato; }
</style>