Install
elements man style/installThe stylesheet ships inside @elements/ui, and every new app has it: there
is nothing to install. Import it once and every page in the app inherits the
design system.
A new app is already wired
elements create pins @elements/ui in config.jsoc:
config.jsocpackage: { dependencies: { "@elements/app": "…", "@elements/ui": "…", }, }
and writes the import into app/shared/styles/page.css. The package is its
own dependency, versioned apart from the Elements tooling, so an app that
wants none of it removes it with elements uninstall @elements/ui and
deletes the import.
Use
One import brings in the whole system with the default monochrome theme:
app/shared/styles/page.css@import "@elements/ui"; @import "./vars.css";
That single line loads, in order: the scale tokens, the default theme, the
reset, base element styling, typography, and every component and utility. It
also declares the @layer order, so importing the root entry handles both the
styles and the cascade architecture at once.
A theme and the email baseline are separate imports:
app/shared/styles/page.css@import "@elements/ui"; @import "@elements/ui/themes/elements"; /* one of the twelve looks */
app/shared/styles/email.css@import "@elements/ui/email"; /* mail-safe email baseline */
Write each import as a plain @import line. The package's own @media rules
live inside each file, so no import needs a condition. The twelve themes are
listed under elements man ui/themes.
How a scaffolded app is wired
elements create lays down three shared style files under
app/shared/styles/, so you have a place for app-wide overrides from day one:
page.css is the site-wide page baseline, imported by every page's style.css:
app/shared/styles/page.css@import "@elements/ui"; @import "./vars.css";
email.css is the site-wide email baseline, imported by every email's
style.css:
app/shared/styles/email.css@import "@elements/ui/email"; @import "./vars.css";
vars.css holds your app's token overrides. It's imported by both page.css
and email.css, so a value you set here applies everywhere. It ships with every
override commented out, so the app is monochrome until you uncomment --accent.
A page's own style.css imports the shared baseline and then adds page-scoped
rules:
app/pages/home/style.css@import "#app/shared/styles/page.css"; .home { color: var(--ink); background: var(--bg); }
A shared template's style.css imports nothing. It uses the tokens and classes
the page already loaded, and importing page.css from a template would apply
the whole base again.
The scaffold ships the monochrome default. It does not import a theme.
Branding is a change to vars.css (or a copied theme file); see
theming (opens in a new tab) and overriding (opens in a new tab).