styling

Enforces SCSS conventions with CSS variables, Layer__ BEM naming, and stylelint property ordering.

10|3|Updated Oct 23, 2023
One-click install
npx skills add https://github.com/Layer-Fi/layer-react --skill styling-layer-fi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: styling
Source: https://github.com/Layer-Fi/layer-react/tree/main/src/styles
Command: npx skills add https://github.com/Layer-Fi/layer-react --skill styling-layer-fi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Keeping styles consistent across a large React component library is hard: inline styles creep in, class names become ungreppable, and raw hex values bypass the theming system. This Skill codifies the SCSS conventions of the Layer component library so every stylesheet follows the same naming, token, and formatting rules. ## Core Features & Use Cases - Hard styling rules: No inline styles, no utility class strings, no class-name concatenation, and no re-stating styles already set by ancestor components. - Design token enforcement: All colors, spacing, radii, and typography must come from variables.scss custom properties, keeping consumer theming via --color-dark-*/--color-light-* HSL overrides intact. - Naming and nesting conventions: Flat, greppable Layer__Block__Element--Modifier selectors with nesting reserved only for modifiers, pseudo-classes, and media queries. - Use Case: When adding a new component stylesheet, follow the colocation rule (ComponentName.tsx imports componentName.scss as the last import) and write declarations in the stylelint-enforced property order so npm run lint:stylelint passes on commit. ## Quick Start Write the SCSS for my new component following the styling conventions in this skill, using only design tokens and flat Layer__ BEM selectors.

Frequently Asked Questions about styling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I name CSS classes in the Layer component library?▼

Use the Layer__Block__Element--Modifier pattern with PascalCase for each part, such as Layer__FileThumb__Actions--Floating. Primitives use a Layer__UI__ prefix, and every block and element gets its own flat top-level selector so the full name is greppable.

How do I add styles for a new React component in this library?▼

Create a camelCase stylesheet next to the component and import it as a side effect with import './componentName.scss' as the last import in the file. Use only variables from variables.scss for colors, spacing, and typography.

Can I use inline styles or utility classes in Layer components?▼

No. Inline style props, utility class strings, and class names built by concatenation are all prohibited. Prefer Stack or Span props for simple layout and typography, and use data-* attribute selectors for variants.

Why are my CSS variables not resolving in a portal or story?▼

Design tokens are declared on root classes like .Layer__component, .Layer__Portal, and .Layer__view. Anything rendered outside that tree, such as a portal or bare primitive, needs one of those classes on an ancestor or the variables resolve to nothing.

When should I nest selectors in SCSS here?▼

Nesting is only for modifiers of the current selector: attribute selectors, pseudo-classes, pseudo-elements, and media queries. Never nest elements under their block with &__ because the resulting class name would not appear in the file.