Custom sections inherit the site theme. Color, type, radius, and spacing come from CSS variables on the page. The compiler rejects hex colors and arbitrary Tailwind values such as w-[37px] so a theme change still restyles the section.
Color variables
Set color with var(--site-*).
Variable | Use |
|---|---|
| Page background |
| Raised surface |
| Card surface |
| Headings |
| Body text |
| Secondary text |
| Links |
| Brand highlight |
| Text on the accent |
| Primary button fill |
| Primary button label |
| Hairline borders |
Status colors stay the same hue on any palette, so a warning still reads as a warning. -tint is a soft fill. -text is readable on that fill.
Variable | Use |
|---|---|
| Error and danger |
| Soft danger fill |
| Text on the danger fill |
| Warning |
| Soft warning fill |
| Text on the warning fill |
| Success |
| Soft success fill |
| Text on the success fill |
Palette slots, for fields.themeColor and component color props:
Key | Variable |
|---|---|
|
|
|
|
|
|
|
|
|
|
<section
className="sec-section"
style={{ background: "var(--site-foreground)" }}
>
<p style={{ color: "var(--site-paragraph)" }}>{body}</p>
</section>SiteHeading and SiteText take a palette key on color and apply the matching variable for you. SiteButton uses backgroundColor and textColor the same way.
Layout variables
Variable | Use |
|---|---|
| Body font |
| Display font |
| Corner radius |
| Gap between cards and items |
| Section padding |
| Content width |
| Card shadow |
<div
style={{
display: "grid",
gap: "var(--site-item-spacing)",
gridTemplateColumns: "repeat(auto-fill, minmax(240px, 1fr))",
}}
>A stylesheet on the section
css on defineSection is a stylesheet for every copy of that section. It is scoped to the section and checked the same way as the Custom CSS field in the sidebar.
Allowed: selectors, @media, @supports, @container, and var(--site-*) colors.
Not allowed: url(), and assigning a --site-* variable.
Custom CSS on one section on the page is added after css.
export default defineSection({
id: "custom.starter",
label: "Custom section",
category: "Custom",
css: `.note { color: var(--site-paragraph); }`,
fields: {},
defaults: {},
render: () => (
<section className="sec-section">
<p className="note">A note for customers.</p>
</section>
),
});Do not add a <style> tag. The compiler still rejects that.
Class names
Page sections use sec-section on the outer <section>. Nested blocks use sui- classes the SDK components already apply, such as sui-text and sui-container. Custom layout belongs in style with theme variables, or in css as above.
What the compiler accepts
A file may import react and @lockii/site-sdk. Source can be up to 30,000 characters. The default export is defineSection.
The compiler rejects:
Other packages and relative files outside the SDK
fetch,eval,Function,WebSocket, andXMLHttpRequestwindow,document,localStorage,sessionStorage,navigator,cookieStore, andindexedDBdangerouslySetInnerHTMLJSX tags
a,form,input,script,style,iframe,svg,video,canvas, andlinkEvent handler props on raw DOM nodes. Clicks go through
SiteButtonHex colors in strings
Arbitrary Tailwind values such as
bg-[red]orw-[37px]
SiteChecklist can remember ticks in the browser. The file itself still cannot read localStorage.
Links and buttons go through
SiteButtonand afields.actionvalue. Destinations stay on the site, and external, phone, and email links stay explicit.
