Try “optimization”, “doctor” or “page body”.

    v1.2.2
    Docs menu
    Docs › Reference

    Styling

    How an ACES site gets its look: tokens, surfaces, the skin and data-slot hooks. Base skin or Unstyled.

    ACES components carry structure, not looks. Markup holds layout (flex, grid, spacing, widths, responsive visibility) and data-slot hooks. Colors, borders, radii, shadows and fonts come from tokens and an optional skin. A brand is restyled there, without rebuilding components.

    Base skin or Unstyled

    create-aces-app asks which look to start from:

    Unstyled (default) Base skin
    Components and layout Same Same
    Tokens Neutral: black and white, system fonts, square corners The ACES brand: blue and orange, Montserrat and Inter, rounded
    src/styles/skin/ Not present One CSS file per component
    Use it when You’re matching a real brand’s design You need something presentable fast, with no design to match

    Which one should I pick?

    The question is whether there’s a design to match. Both options use the same components, data and editor experience. Only the look differs, and you can switch later.

    Pick Unstyled when:

    • You’re matching an existing brand or website. That’s most client demos and real projects. Restyling an unbranded starter means adding the brand’s look. Restyling the Base skin means removing the ACES look first: its blue gradients, pill buttons, Montserrat headings and card shadows. Starting clean is faster and leaves no leftovers.
    • There’s a design file or a live site to copy. Put its colors, radii and fonts in src/styles/tokens.css and write only the component styles the design needs.
    • An agent is building the site from a brief or screenshots. With no skin in place, the agent writes the brand’s styles from scratch and doesn’t fight existing CSS or leave half-overridden ACES styles behind.
    • You want the smallest stylesheet, with only the CSS your design uses.

    Pick the Base skin when:

    • There’s no design to match yet, and the site needs to look finished: an internal prototype, a content-modeling or editor-workflow demo, a workshop, or an early pitch where the audience cares about Contentful, not the brand.
    • You’re learning ACES and want to see what every component looks like when it’s styled, with a complete, working example of skin files.
    • You want a starting point and plan to change only a few things, such as colors and fonts through tokens, and keep the rest of the look.
    • You’re building a reference or kitchen-sink page for components and want each option (themes, alignments, button styles) to be visible.

    Changing your mind later. Both directions take one command:

    • Started Unstyled but want the ACES styles for a few components as a starting point? Run pnpm aces skin add base, then pnpm aces skin eject <name> for each one you want (it moves the file to src/styles/custom/), then pnpm aces skin remove. The ejected files stay.
    • Started from the Base skin and the brand turned out to be very different? Run pnpm aces skin remove --tokens. You get neutral tokens back, and anything you ejected to src/styles/custom/ stays.

    Pass --skin none or --skin base to skip the question. The choice is stored as ui.skin in aces.config.ts. Switch later:

    pnpm aces skin add base            # add the Base skin (keeps your tokens)
    pnpm aces skin add base --tokens   # ...and the ACES colors and fonts
    pnpm aces skin remove              # back to Unstyled (keeps src/styles/custom/)
    pnpm aces skin remove --tokens     # ...and reset tokens and fonts to neutral
    pnpm aces doctor                   # the Skin check: ui.skin matches the files

    Layers

    src/app/styles.css imports the layers in order, lowest first:

    @layer theme, base, aces-skin, components, utilities;
    
    @import "tailwindcss";
    @import "../styles/tokens.css";      /* brand + semantic tokens          (always) */
    @import "../styles/base.css";        /* surfaces, reset, type scale      (always) */
    @import "../styles/prose-base.css";  /* readable rich text               (always) */
    @import "../styles/skin/index.css" layer(aces-skin); /* aces:skin       (Base only) */

    The skin sits below Tailwind’s utilities. A class you add (className="rounded-none") or CSS you write beats the skin without !important.

    Tokens: src/styles/tokens.css

    Components use the semantic tokens. The brand palette (--color-primary, --color-secondary, --color-grey-*) is the input they’re built from, and only the skin uses it directly.

    Token What it is Tailwind
    --color-page / --color-on-page The default background and its text bg-page
    --color-alt / --color-on-alt A tinted band (Neutral sections) bg-alt
    --color-inverse / --color-on-inverse A dark band bg-inverse
    --color-accent / --color-on-accent The brand band (Primary sections, hero box) bg-accent
    --color-accent-soft Light end of accent gradients; follows --color-accent
    --color-surface / --color-on-surface The current section’s background and text bg-surface, text-on-surface
    --color-action / --color-on-action / --color-action-hover Filled buttons and active states bg-action
    --color-link, --color-focus Links and focus rings text-link
    --color-muted, --color-border, --color-subtle Secondary text, lines, faint fills. Derived from the current surface. text-muted, border-border, bg-subtle
    --radius-control, --radius-card, --radius-base Buttons and inputs, cards and media, small details rounded-control
    --font-heading, --font-body, --font-weight-heading Fonts (loaded in src/libs/theme/lib/fonts.ts) font-heading
    --text-h1 … --text-caption2 Type scale (desktop; mobile headings are capped) typo-h1 … via <H1>, <Text>
    --container-page, --container-text Max widths of <Container> and readable text

    Surfaces: data-surface

    A section with its own background sets data-surface, and everything inside follows:

    <section data-surface="accent">…</section>   {/* brand band: text, buttons and links flip */}
    <article data-surface="page">…</article>     {/* a light panel inside a dark site */}
    Value Background Use
    page --color-page Default; also resets a panel inside another band
    alt --color-alt Tinted sections
    inverse --color-inverse Dark sections
    accent --color-accent Brand sections
    overlay none Text over an image

    Inside a surface, --color-surface, --color-on-surface, --color-muted, --color-border, --color-action and --color-link are remapped. Rich text, buttons and links need no color props. On inverse, accent and overlay, filled buttons use the surface’s own colors so they stay visible.

    The site’s header and footer take a surface prop (<HeaderServer surface="inverse" …>), which also picks the knockout logo on dark bands.

    Hooks: data-slot

    Every primitive, cf component and feature marks its parts:

    <section data-slot="hero" data-variant="default" data-size="slim">
      <div data-slot="hero-content" data-surface="accent">
        <h1 data-slot="hero-title">…</h1>
        <a data-slot="button" data-variant="primary" data-size="medium">…</a>

    Options are data-variant, data-size, data-align, data-theme and data-state (open, active, scrolled). Inspect the page in the browser to find a component’s hooks. The skin and your own CSS target them:

    [data-slot="button"][data-variant="primary"] { border-radius: 4px; }
    [data-slot="hero-title"] { letter-spacing: -0.02em; }

    Button variants are primary (filled), secondary (inverse of the section), outline, ghost and link.

    The skin: src/styles/skin/

    One file per component or feature: button.css, hero.css, banner.css, prose.css, site-header.css, navigation.css, articles.css, search.css and so on. Each uses tokens only, so a token change reaches it.

    • Edit any file. It’s your code.
    • Eject one: pnpm aces skin eject hero moves skin/hero.css to src/styles/custom/hero.css. skin add and skin remove never touch custom/.
    • Remove the folder for Unstyled: pnpm aces skin remove.

    Rules for markup

    ESLint enforces the first three as warnings:

    • No hex, rgb() or hsl() arbitrary colors in classes (bg-[#111]).
    • No brand palette classes in markup (bg-primary, text-white, border-grey-300). Use semantic utilities (bg-surface, text-muted, border-border) or the skin.
    • No inline colors (style={{ color: … }}). Inline style is for truly dynamic values only (a computed size, a background image URL).
    • Give new parts data-slot hooks, and use @aces/ui primitives rather than a parallel set of classes (.brand-button).
    • Responsive layout uses breakpoint classes (hidden lg:flex), not useMediaQuery.

    In JavaScript: @aces/theme

    @aces/theme exports only fontVariables (for <html>) and breakpoints (media queries for JS-only needs such as drawers and carousels). There is no JS palette: colors are CSS, so they follow the section.

    Something wrong or missing? Open an issue.