concrete/server/no-inline-style
Server-rendered JSX carries no inline `style` prop.
Server-rendered JSX carries no inline style prop.
Graded by the lint stage of concrete check, in the lint venue. A violation reports this id and the file it failed at — see every rule and concrete check.
Reason
An inline style= prop sits outside the cascade: it beats every utility, takes no
responsive prefix, and cannot be themed, so a section carrying one stops answering to
the stylesheet that the rest of the template is designed in. It also
churns per-render identity the editor's diff cannot dedupe. All three are server-render
concerns — an island computing a transform from live pointer state is exactly what an
island is for, and is exempt.
Fix
Use Tailwind utilities, or a rule in a stylesheet the module imports. For a value that
only exists at runtime, move that markup into a "use client" island, where an inline style is
allowed.
Before and after
import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section style={{ paddingBlock: "6rem", textAlign: "center" }}>
<Slot.Text slot={slot.headline} as="h1" style={{ fontSize: "3rem" }} />
</Section>
),
);import { Section, section, Slot, text } from "@homepages/concrete";
export const Hero = section(
{ key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
({ slot }) => (
<Section className="py-24 text-center">
<Slot.Text slot={slot.headline} as="h1" className="text-5xl" />
</Section>
),
);