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

    v1.2.2
    Docs menu
    Docs › Guides

    Rebrand and restyle

    Match a brand by editing tokens, surfaces and the skin, in that order, instead of rebuilding components.

    ACES components hold structure and data-slot hooks. Their look comes from tokens and the skin, so a new brand is a few files, not new components. Work through these steps in order and stop at the first that does the job. The Styling reference lists every token and hook.

    1. Tokens: src/styles/tokens.css

    Set the brand’s surfaces, action color and shapes. Keep the names and change the values:

    @theme {
      --color-page: #121212;        /* default background */
      --color-on-page: #ffffff;     /* text on it */
      --color-alt: #f6f3f0;         /* tinted band, e.g. article panels */
      --color-on-alt: #111111;
      --color-accent: #1ed760;      /* brand band */
      --color-on-accent: #000000;
      --color-action: #1ed760;      /* filled buttons */
      --color-on-action: #000000;
      --color-action-hover: #3be477;
      --color-link: #1ed760;
    
      --radius-control: 999px;      /* pill buttons and inputs */
      --radius-card: 16px;
      --font-weight-heading: 800;
      --text-h1: 4rem;
      --text-h1--line-height: 1.1;
    }

    Muted text, borders and faint fills are derived from the surface, and accent gradients follow --color-accent, so they change with these values.

    2. Fonts: src/libs/theme/lib/fonts.ts

    Load the brand’s fonts with next/font and keep the two variable names:

    import { Figtree } from "next/font/google";
    
    const heading = Figtree({ subsets: ["latin"], weight: ["700", "800"], variable: "--font-heading-face", display: "swap" });
    const body = Figtree({ subsets: ["latin"], weight: ["400", "500", "700"], variable: "--font-body-face", display: "swap" });
    
    export const fontVariables = `${heading.variable} ${body.variable}`;

    For a font that isn’t on Google, use next/font/local with the same variable names. The Unstyled version of this file exports an empty fontVariables and uses system fonts.

    3. Surfaces: data-surface

    Give sections that need a different band their surface. Text, rich text, buttons and links inside follow, with no color props:

    // a light article panel on a dark site
    <Box data-slot="article-body" data-surface="alt" className="rounded-card p-8 md:p-12">
      <CfRichTextRender richTextDocument={entry.bodyCopy.json} preview={false} lang={lang} />
    </Box>

    4. The skin: src/styles/skin/

    For shapes and details the tokens don’t cover, edit the component’s skin file. It targets data-slot hooks (inspect the page to find them):

    /* src/styles/skin/button.css */
    [data-slot="button"] {
      font-weight: 800;
      &[data-size="medium"] { padding: 0.75rem 1.5rem; font-size: 1rem; }
    }
    [data-slot="button"][data-variant="primary"]:hover { transform: scale(1.03); }

    On an Unstyled project, add the Base skin first (pnpm aces skin add base) to edit it, or write your own files in src/styles/custom/ and import them from src/app/styles.css into layer(aces-skin). For a full rewrite of one component, pnpm aces skin eject <name> moves its file to src/styles/custom/, where skin add and skin remove never touch it.

    Tailwind classes in markup also win over the skin, without !important.

    5. Markup: render.tsx

    If the brand needs a different structure (another order, an extra wrapper, a different grid), edit the component’s render.tsx. It’s your code. Keep services.ts, index.tsx and client.tsx (data, Live Preview, Optimization) as they are, and give new parts data-slot hooks.

    The logo, navigation, socials and footer links are fields on the site’s Apps entry in Contentful. To change the chrome’s layout, pass render to HeaderServer or FooterServer in src/app/layout.tsx. It gets the Apps entry data, so you don’t query it again:

    <HeaderServer
      appId={appId}
      preview={isEnabled}
      lang={lang}
      surface="inverse"   // dark band; uses the knockout logo
      render={(shell) => <BrandHeader logos={shell.logos} nav={shell.navigations.main} />}
    />

    getAppShell(appId, preview, lang) from @aces/features returns the same data (logos, navigations, socials, copyrightText) for anywhere else. render works in server components only.

    7. Check it

    pnpm dev                 # a page built from components, an article, search, a phone-width window
    pnpm lint                # warns on hard-coded colors and palette classes in markup

    Something wrong or missing? Open an issue.