Theme and CSS classes reference
Theme tokens, layout utilities, responsive patterns, safe HTML, and component authoring conventions.
Advanced reference for PageDesigner theme tokens, layout utilities, responsive patterns, safe HTML, and component authoring conventions.
This reference is for advanced editors, developers preparing custom components, and connected assistants. Normal page work can stay in the Properties inspector.
Theme color tokens
| Purpose | Preferred classes |
|---|---|
| Primary action | bg-primary, text-primary, border-primary, hover:bg-primary/90 |
| Secondary accent | bg-secondary, text-secondary, border-secondary |
| Main text | text-base |
| Muted text | text-base/70, text-base/60 |
| Text on solid brand color | text-inverted |
| Main surface | bg-background |
| Secondary surface | bg-background-secondary |
| Border/divider | border-neutral, border-neutral/30 |
| Status | text-success, text-warning, text-error, text-info and matching backgrounds |
Use slash opacity:
text-base/70
bg-primary/90
border-neutral/30Page and section structure
<section class="bg-background px-4 py-14 sm:py-20">
<div class="mx-auto max-w-6xl">
<h2 class="text-3xl font-semibold text-base">Section title</h2>
<p class="mt-3 max-w-xl text-base/70">Supporting copy.</p>
</div>
</section>Recommended widths:
max-w-md,max-w-xl— focused copy.max-w-3xl— long-form content.max-w-5xl,max-w-6xl,max-w-7xl— grids and wide page sections.mx-auto— center a constrained container.
Responsive prefixes
Use mobile-first classes, then enhance:
| Prefix | Applies from |
|---|---|
| none | Smallest viewport |
sm: | Small breakpoint and above |
md: | Medium breakpoint and above |
lg: | Large breakpoint and above |
xl: | Extra-large breakpoint and above |
Example:
text-3xl sm:text-4xl lg:text-5xl
grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3
px-4 py-12 sm:py-16 lg:py-20Flex and grid patterns
Stacked actions that become a row
flex flex-col items-stretch gap-3 sm:flex-row sm:items-centerTwo-column marketing section
flex flex-col gap-12 lg:flex-row lg:items-start lg:justify-betweenResponsive cards
grid gap-6 md:grid-cols-2 lg:grid-cols-3Wrapping row
flex flex-wrap items-center gap-4Spacing reference
Use a hierarchy, not every possible value:
| Relationship | Examples |
|---|---|
| Label to control | gap-2, mt-2 |
| Heading to paragraph | mt-3, gap-3 |
| Items in a card | space-y-4, gap-4 |
| Cards in a grid | gap-6 |
| Major groups | gap-8, mt-8, mt-10 |
| Section rhythm | py-12, py-16, sm:py-20 |
Typography reference
Hero: text-4xl font-bold leading-tight sm:text-5xl
Section: text-3xl font-semibold
Subheading: text-xl font-semibold
Body: text-base leading-relaxed
Small body: text-sm leading-relaxed
Eyebrow: text-xs font-semibold uppercase tracking-[0.3em] text-base/60Use max-width constraints for readable lines.
Buttons
Primary
<a class="inline-flex items-center justify-center rounded-md bg-primary px-6 py-3 font-medium text-inverted transition-colors hover:bg-primary/90" href="/store">
View plans
</a>Secondary
<a class="inline-flex items-center justify-center rounded-md border border-neutral px-6 py-3 font-medium text-base transition-colors hover:bg-background-secondary" href="/contact">
Contact us
</a>Use descriptive text, a real href, and sufficient padding.
Cards
<article class="rounded-xl border border-neutral/30 bg-background-secondary p-6">
<h3 class="text-xl font-semibold text-base">Managed backups</h3>
<p class="mt-2 text-sm leading-relaxed text-base/70">Explain the approved benefit.</p>
</article>Images
<img class="h-auto w-full rounded-xl object-cover" src="https://example.com/image.jpg" alt="Service dashboard showing backup status">Use stable HTTPS URLs. Alt text is required for informative images.
Class-editing rules
- Add or remove a small set for a small change.
- Replace the full class list only when you understand every removed layout and responsive class.
- Change color tokens as a coherent pair, such as
bg-primarywithtext-inverted. - Preserve
flex,grid, gap, width, and breakpoint classes unless layout is in scope. - Avoid enormous experimental class strings.
Safe custom component HTML
Allowed component markup should be semantic and declarative.
Do not include:
<script>;- inline
onclick,onload, or otheron*handlers; javascript:URLs;- secrets or server-only data;
- editor-internal
data-gjs-*attributes; - inline theme colors that bypass tokens.
Safe attributes include normal href, src, alt, title, target, rel, aria-*, and reviewed component data-* attributes.
Translation bindings
Advanced components can bind text with:
<h2 data-pd-i18n="features.title">Features</h2>Keys:
- must remain stable;
- should describe meaning, not the current wording;
- must use the safe PageDesigner key pattern;
- should not be casually reused for unrelated text.
Custom code boundary
Canvas HTML must not contain scripts. When a page genuinely needs JavaScript:
- Read the existing custom-code slots.
- Use Custom JavaScript after content by default.
- Use head placement only when the script must load in the document head.
- Append by default.
- Replace only with explicit intent.
- Review the code as executable public-page code.
Avoid
bg-blue-600,text-slate-900, and arbitrary palette classes for theme surfaces.- Pure black/white assumptions.
- Inline
style="color:..."for theme colors. - Fixed widths on essential content.
- Hover-only interactions.
- Rebuilding a suitable library model from scratch.
- Editing an official Hosted source in place; fork it instead.