The language
Syntax
Code is written in JSX: tags for widgets, attributes for props, nesting for children. This page covers the rules that make it Shesha's JSX.
One root element
The code for a layer describes one widget. Two side-by-side tags at the top level is an error:
<Text>Winter sale</Text>
<Text>Up to 40% off</Text>ErrorAdjacent JSX elements must be wrapped in an enclosing tag
Wrap them in the layout that says how they should sit together:
<Column className="gap-2">
<Text>Winter sale</Text>
<Text>Up to 40% off</Text>
</Column>Props
Props are written like JSX attributes. The value's form depends on its type:
<Container padding={{ top: 8, right: 16, bottom: 8, left: 16 }} className="rounded-2xl">
<Image src="https://images.example.com/hero.jpg" height={320} hoverZoom className="object-cover" />
</Container>| Form | Use it for | Example |
|---|---|---|
| Quoted string | Text, URLs, names | src="https://…" |
| Number in braces | Sizes in pixels, counts | height={320} |
| Name alone | A setting that's on | hoverZoom |
| Object in double braces | Grouped values: sides, styles, actions | padding={{ top: 8, … }} |
| Data in braces | Live store data | src={item.image} |
| Backticks in braces | Words mixed with data | href={`/product/${item.slug}`} |
A few JSX features aren't allowed, because every prop must map to one field the builder can show: spread props ({...props}), namespaced props (a:b), the same prop twice, and elements passed as prop values.
Unknown widgets and props are errors, with a suggestion when the name is close:
ErrorUnknown component <Colum> — did you mean <Column>?
Text
Words on the page always live inside a <Text>. Use semanticsTag to say what the text is (h1–h6, p, span). That's what search engines and screen readers see.
<Column className="gap-1">
<Text semanticsTag="h1">Running shoes</Text>
<Text>Free returns within 30 days</Text>
</Column>Text placed straight inside a layout won't parse:
<Column>
Free returns within 30 days
</Column>ErrorText must be inside <Text>…</Text>
A <Text> holds words and {data} only, not other widgets. You can set its content through children or through the data prop, but not both.
Slots
slot gives a widget a stable name. The builder uses slots to find parts of a section (its heading, its button, its grid) so the section's tools and the Layers panel can label and edit them, however much you rearrange the code. A slot must be a plain string.
<Container slot="section:hero" className="py-24 px-6">
<Column slot="content" className="items-center gap-4">
<Text slot="heading" semanticsTag="h2">Winter edit</Text>
<FilledButton slot="cta" label="Shop now" onPressed={{ type: "url", url: "/products" }} />
</Column>
</Container>You can add slots of your own as labels, but keep the ones the builder wrote. Removing slot="cta" from a hero's button means the hero's tools no longer treat it as the call to action. More in Sections.
Comments
Use JSX comments inside elements. They're saved with the layer and stay where you put them when the code is printed again.
<Column className="gap-4">
{/* Shown above every product grid on the home page */}
<Text semanticsTag="h2">New this week</Text>
</Column>Expressions
Braces inside an element hold one of three things. Anything else is an error that lists these forms:
{cond && <X/>}: show a widget only when something is true.{cond ? <X/> : <Y/>}: choose between two widgets.{list.map((item) => <X/>)}: repeat a widget for every item.
Inside <Text> and in props, braces hold data such as {product.name}. Both are covered in Store data and Lists & conditions. To mix words and data in one string, use backticks.
Placement
Some widgets only make sense inside others. A Positioned pins a child inside a Stack; an Expanded fills space in a Row or Column. Placing one elsewhere is an error that names where it can go, e.g. "Positioned can only be placed inside Stack".