faststore-theming
Original:🇺🇸 English
Not Translated
Apply when deciding, designing, or implementing FastStore theme customizations in src/themes/ or working with design tokens and SCSS variables. Covers global tokens, local component tokens, Sass variables, CSS custom properties, and Brandless architecture. Use for any visual customization of FastStore storefronts that does not require component overrides.
3installs
Sourcevtex/skills
Added on
NPX Install
npx skill4agent add vtex/skills faststore-themingSKILL.md Content
FastStore Theming & Design Tokens
When this skill applies
Use this skill when:
- You need to change the visual appearance of a FastStore storefront — colors, typography, spacing, borders, or component-specific styles.
- You are working with files in or creating
src/themes/.custom-theme.scss - You need to customize individual component styles using local tokens and data attributes.
[data-fs-*] - You are setting up a brand identity on top of the Brandless default theme.
Do not use this skill for:
- Changes that require replacing a component, injecting logic, or modifying behavior — use the skill.
faststore-overrides - Client-side state management — use the skill.
faststore-state-management - Data fetching or API extensions — use the skill.
faststore-data-fetching
Decision rules
- Use theming as the first approach before considering overrides — it is lighter and more maintainable.
- Use global tokens (scope) when the change should propagate store-wide (e.g., brand colors, font families).
:root - Use local tokens (scope) when the change applies to a single component (e.g., button background color).
[data-fs-*] - Use data attributes to target components — never use
[data-fs-*]class names or generic tag selectors..fs-* - Place all theme files in with
src/themes/as the entry point — files elsewhere are not discovered.custom-theme.scss - Reference design tokens via instead of hardcoding hex colors, pixel sizes, or font values.
var(--fs-*) - Use CSS modules for custom (non-FastStore) components to avoid conflicting with FastStore's structural styles.
Hard constraints
Constraint: Use Design Tokens — Not Inline Styles
MUST use design tokens (global or local) to style FastStore components. MUST NOT use inline props on FastStore components for theming purposes.
style={}Why this matters
Inline styles bypass the design token hierarchy, cannot be overridden by themes, do not participate in responsive breakpoints, and create maintenance nightmares. They also defeat CSS caching since styles are embedded in HTML. Design tokens ensure consistency and allow store-wide changes from a single file.
Detection
If you see or on FastStore native components (components imported from or ) → warn that this bypasses the theming system. Suggest using design tokens or CSS modules instead. Exception: inline styles are acceptable on fully custom components that are not part of the FastStore UI library.
style={{style={@faststore/ui@faststore/coreCorrect
scss
// src/themes/custom-theme.scss
// Override the BuyButton's primary background color using design tokens
[data-fs-buy-button] {
--fs-button-primary-bkg-color: #e31c58;
--fs-button-primary-bkg-color-hover: #c4174d;
--fs-button-primary-text-color: var(--fs-color-text-inverse);
[data-fs-button-wrapper] {
border-radius: var(--fs-border-radius-pill);
}
}Wrong
typescript
// WRONG: Using inline styles on a FastStore component
import { BuyButton } from '@faststore/ui'
function ProductActions() {
return (
<BuyButton
style={{ backgroundColor: '#e31c58', color: 'white', borderRadius: '999px' }}
>
Add to Cart
</BuyButton>
)
// Inline styles bypass the design token hierarchy.
// They cannot be changed store-wide from the theme file.
// They do not respond to dark mode or other theme variants.
}Constraint: Place Theme Files in src/themes/
MUST place custom theme SCSS files in the directory. The primary theme file must be named .
src/themes/custom-theme.scssWhy this matters
FastStore's build system imports theme files from . Files placed elsewhere will not be picked up by the build and your token overrides will have no effect. There will be no error — the default Brandless theme will render instead.
src/themes/custom-theme.scssDetection
If you see token override declarations (variables starting with ) in SCSS files outside → warn that these may not be applied. If the file does not exist in the project → warn that no custom theme is active.
--fs-src/themes/src/themes/custom-theme.scssCorrect
scss
// src/themes/custom-theme.scss
// Global token overrides — applied store-wide
:root {
--fs-color-main-0: #003232;
--fs-color-main-1: #004c4c;
--fs-color-main-2: #006666;
--fs-color-main-3: #008080;
--fs-color-main-4: #00b3b3;
--fs-color-accent-0: #e31c58;
--fs-color-accent-1: #c4174d;
--fs-color-accent-2: #a51342;
--fs-text-face-body: 'Inter', -apple-system, system-ui, BlinkMacSystemFont, sans-serif;
--fs-text-face-title: 'Poppins', var(--fs-text-face-body);
--fs-text-size-title-huge: 3.5rem;
--fs-text-size-title-page: 2.25rem;
}
// Component-specific token overrides
[data-fs-price] {
--fs-price-listing-color: #cb4242;
}Wrong
scss
// src/styles/my-theme.scss
// WRONG: This file is in src/styles/, not src/themes/
// FastStore will NOT import this file. Token overrides will be ignored.
:root {
--fs-color-main-0: #003232;
--fs-color-accent-0: #e31c58;
}
// Also WRONG: Creating a theme in the project root
// ./theme.scss — this will not be discovered by the build systemConstraint: Use Data Attributes for Component Targeting
MUST use FastStore's data attributes to target components in theme SCSS files. MUST NOT use class names or tag selectors to target FastStore native components.
data-fs-*Why this matters
FastStore components use data attributes as their public styling API (e.g., , , ). Class names are implementation details that can change between versions. Using data attributes ensures your theme survives FastStore updates. Each component documents its available data attributes in the customization section of its docs.
data-fs-buttondata-fs-pricedata-fs-heroDetection
If you see CSS selectors targeting class names or generic tag selectors (, , ) to style FastStore components → warn about fragility. Suggest using selectors instead.
.fs-*buttonh1div[data-fs-*]Correct
scss
// src/themes/custom-theme.scss
// Target the Hero section using its data attribute
[data-fs-hero] {
--fs-hero-text-size: var(--fs-text-size-title-huge);
--fs-hero-heading-weight: var(--fs-text-weight-bold);
[data-fs-hero-heading] {
text-transform: uppercase;
letter-spacing: 0.05em;
}
[data-fs-hero-image] {
border-radius: var(--fs-border-radius);
filter: brightness(0.9);
}
}Wrong
scss
// src/themes/custom-theme.scss
// WRONG: Targeting by class names — these are internal and may change
.fs-hero {
font-size: 3.5rem;
}
.fs-hero h1 {
text-transform: uppercase;
}
// WRONG: Using generic tag selectors
section > div > h1 {
font-weight: bold;
}
// These are fragile selectors that break when FastStore restructures its HTML.Preferred pattern
Recommended file layout:
text
src/
└── themes/
└── custom-theme.scss ← main entry point (auto-imported by FastStore)Minimal custom theme:
scss
// src/themes/custom-theme.scss
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');
// Global Token Overrides
:root {
--fs-color-main-0: #003232;
--fs-color-main-1: #004c4c;
--fs-color-accent-0: #e31c58;
--fs-color-accent-1: #c4174d;
--fs-text-face-body: 'Inter', -apple-system, system-ui, sans-serif;
--fs-text-face-title: 'Poppins', var(--fs-text-face-body);
}
// Component-specific overrides
[data-fs-button] {
--fs-button-border-radius: var(--fs-border-radius-pill);
&[data-fs-button-variant="primary"] {
--fs-button-primary-bkg-color: var(--fs-color-accent-0);
--fs-button-primary-bkg-color-hover: var(--fs-color-accent-1);
--fs-button-primary-text-color: var(--fs-color-text-inverse);
}
}
[data-fs-price] {
--fs-price-listing-color: #cb4242;
--fs-price-listing-text-decoration: line-through;
}
[data-fs-navbar] {
--fs-navbar-bkg-color: var(--fs-color-main-0);
--fs-navbar-text-color: var(--fs-color-text-inverse);
}For custom (non-FastStore) components, use CSS modules to avoid conflicts:
scss
// src/components/CustomBanner.module.scss
.customBanner {
display: flex;
align-items: center;
gap: var(--fs-spacing-3); // Still reference FastStore tokens for consistency
padding: var(--fs-spacing-4);
background-color: var(--fs-color-main-0);
color: var(--fs-color-text-inverse);
border-radius: var(--fs-border-radius);
}Common failure modes
- Using declarations — creates specificity dead-ends and defeats the cascading nature of design tokens. Use the correct token at the correct selector specificity instead.
!important - Hardcoding hex colors, pixel sizes, and font values directly in component styles instead of referencing tokens. Changes cannot propagate store-wide.
var(--fs-*) - Creating a parallel CSS system (Tailwind, Bootstrap, custom global stylesheet) that conflicts with FastStore's structural styles and doubles the CSS payload.
- Placing theme files outside — they will not be discovered by the build system.
src/themes/ - Targeting FastStore components with class names or generic tag selectors instead of
.fs-*data attributes.[data-fs-*]
Review checklist
- Is the theme file located in ?
src/themes/custom-theme.scss - Are global token overrides placed in scope?
:root - Are component-level overrides using data attribute selectors?
[data-fs-*] - Are all values referencing design tokens via instead of hardcoded values?
var(--fs-*) - Is there no use of declarations?
!important - Could this change be achieved without overrides (is theming sufficient)?
- Are custom component styles scoped with CSS modules to avoid conflicts?
Reference
- Theming overview — Introduction to theming concepts, Brandless architecture, and token hierarchy
- Global tokens — Complete reference for all global design tokens (colors, typography, spacing, borders)
- Global tokens: Colors — Color token reference and palette structure
- Global tokens: Typography — Font family, size, and weight tokens
- Global tokens: Spacing — Spacing scale tokens
- Styling a component — Guide for customizing individual component styles with local tokens
- Available themes — Pre-built themes (Midnight, Soft Blue) available as starting points
- Importing FastStore UI component styles — How to import and use component styles in custom sections
- — Related skill for when theming alone is insufficient and behavioral changes are needed
faststore-overrides