bem-naming

Explain BEM naming conventions for CSS classes in Fundamental Styles.

232|70|Updated May 16, 2019
One-click install
npx skills add https://github.com/SAP/fundamental-styles --skill bem-naming
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bem-naming
Source: https://github.com/SAP/fundamental-styles/tree/main/skills/bem-naming
Command: npx skills add https://github.com/SAP/fundamental-styles --skill bem-naming

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill helps developers understand and implement the BEM (Block Element Modifier) methodology in Fundamental Styles, improving code readability and maintainability.

Core Features & Use Cases

  • BEM Naming Convention: Provides detailed guidance on naming conventions used in Fundamental Styles.
  • Real Examples: Offers practical examples demonstrating how BEM is applied in various components.
  • Quick Reference: Includes a table summarizing common BEM patterns for quick lookup.
  • Best Practices: Suggests best practices for writing BEM classes to avoid common pitfalls.

Quick Start

Use the 'bem-naming' skill to learn how to name CSS classes in Fundamental Styles according to BEM methodology.

Frequently Asked Questions about bem-naming

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

FAQPage Schema
How do I name CSS classes in Fundamental Styles using the BEM convention?

To name CSS classes in Fundamental Styles using BEM, you structure them as Block, Element, and Modifier. This methodology isolates component styles, improving code readability and maintainability across the UI design system.

What is the BEM naming convention structure for blocks, elements, and modifiers?

The BEM naming convention structures CSS classes by separating a parent block, its child elements, and state modifiers. This creates strict, transparent relationships in your UI design that prevent scope leakage and simplify stylesheet maintenance.

Are there common BEM class patterns for quick reference in Fundamental Styles?

Yes, Fundamental Styles provides a quick reference table summarizing common BEM patterns. These examples demonstrate how to correctly apply block, element, and modifier naming conventions to various UI components for consistent styling.

What are the best practices for writing BEM classes to avoid common pitfalls?

Best practices for writing BEM classes include strictly following the block, element, and modifier hierarchy without unnecessary nesting. Adhering to these guidelines in Fundamental Styles prevents specificity issues and ensures scalable UI architecture.

Why should I use the BEM methodology for UI design instead of standard CSS naming?

You should use the BEM methodology for UI design because it enforces strict naming conventions that prevent style conflicts. By clearly defining blocks, elements, and modifiers, it significantly improves code readability and long-term maintainability.