Concrete
Rulesslots

concrete/slots/no-raw-values

Slot values are read through bindings, never off a raw `slots` object.

Slot values are read through bindings, never off a raw slots object.

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

The editor finds a slot's value by its marker, and the marker is emitted by the primitive that renders the value. Interpolating the value straight into your JSX produces the right pixels and no marker, so the slot is invisible to the editor: nobody can click it, the fill has nowhere to write, and the page looks finished.

Fix

Render the binding through its primitive. The binding is what the render function was handed; as picks the element, and the marker comes with it.

Before and after

// This half is the violation, so it is not expected to compile.
// @noErrors
<h1>{slot.headline}</h1>
import { Section, section, Slot, text } from "@homepages/concrete";

export const Hero = section(
  { key: "hero", label: "Hero", slots: { headline: text.medium({ label: "Headline" }) } },
  ({ slot }) => (
    <Section>
      <Slot.Text slot={slot.headline} as="h1" />
    </Section>
  ),
);

On this page