Skip to content
cccskills
FreePublished on GitHub

blazor-css-isolation

Load when editing Blazor `.razor.css`, scoped selectors, `::deep`, BEM class names, RTL/logical CSS properties, or styling nested MudBlazor components; not for global design tokens or non-Blazor CSS.

The English summary is being prepared. Showing the original description.

See how to install

Files included (5)

  • SKILL.md4.1 KB
  • resources/bem-with-isolation.md414 B
  • resources/debugging-scoped-css.md1.1 KB
  • resources/deep-selector-patterns.md564 B
  • resources/mudblazor-styling.md5.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

ABOUTME: CSS isolation + BEM rules for Blazor components. ABOUTME: Read referenced resources before applying.

Blazor CSS Isolation with BEM Methodology

Project-Agnostic CSS Isolation Patterns for Blazor

Placeholders use {Placeholder} syntax - see docs/internal/TEMPLATE_GLOSSARY.md.

Non‑Inferable Rules (Must Follow)

  • .razor.css file must match component name (colocated).
  • Prefer BEM naming even though isolation prevents collisions.
  • Style child components in their own CSS; use wrapper pattern before ::deep.
  • ::deep only for third‑party internals (fragile).
  • Ensure {Project}.styles.css is referenced in host.
  • MudBlazor styling: Always wrap MudBlazor components in a <div> with a BEM class before using ::deep selectors.
  • Customization priority: component params → Class + utility classes → MudTheme → CSS variables → wrapper components → ::deep (last resort).
  • Anti-pattern: Never use global CSS to override MudBlazor base classes without scoping. Never use !important in isolated CSS.

Global CSS Architecture (@layer)

Global styles use @layer cascade ordering via css/layers.css:

@layer reset, base, tokens, mudblazor-overrides, components, utilities;

Each layer file is imported with @import url("file.css") layer(name). The layer order determines cascade priority — later layers win over earlier ones regardless of specificity. Files:

LayerFileContents
resetreset.cssUniversal margin/padding reset, link/list reset
basebase.csshtml/body defaults, scroll-lock
tokenstokens.css3-tier design tokens (primitives → semantic → component)
mudblazor-overridesmudblazor-overrides.cssApproved .mud-* exceptions with justification comments
componentscomponents.css.isl-card, footer, .isl-button-pill, .isl-popover-menu, .isl-form-*
utilitiesutilities.css.isl-typo-*, .sr-only, a11y media queries

CSS Nesting (Native)

Use native CSS nesting with & in .razor.css files:

  • Nest: pseudo-classes (:hover, :focus), pseudo-elements (::before), modifiers (&.block--modifier), media/container queries
  • Cannot concatenate BEM: &__element does NOT work in native CSS (Sass-only). Keep BEM element selectors flat.
  • Max depth: 3 levels. Cross-cutting media queries affecting 5+ selectors stay flat at file bottom.
/* CORRECT */
.my-card {
    border: 1px solid var(--isl-color-border);
    &:hover { transform: translateY(-2px); }
    &.my-card--featured { border-color: var(--mud-palette-primary); }
    @media (max-width: 48em) { padding: var(--isl-space-3); }
}

/* WRONG — BEM concatenation doesn't work in native CSS */
.my-card { &__title { font-weight: 600; } }

Container Queries

Use container-type: inline-size on layout wrappers, then @container queries inside child selectors for component-level responsive adaptation:

.event-list__main { container-type: inline-size; }
::deep .event-grid { @container (max-width: 599.98px) { /* single column */ } }
  • Prefer unnamed containers (anonymous) unless disambiguation is needed.
  • Use container queries instead of viewport media queries for component layouts.
  • Keep viewport media queries for truly page-level concerns (navigation, footer).

Resources (Read Before Applying)

Related Documentation

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Load for Blazor/MudBlazor UI changes involving forms, dialogs, focus, keyboard navigation, landmarks, ARIA, color contrast, RTL-safe styling, or WCAG 2.2 AA tests; not for backend-only changes.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

Load when a task asks to research, verify, compare, or look up framework/package behavior, release notes, standards, RFCs, CVEs, or unfamiliar APIs; use repository evidence first, then official docs, and not for codebase navigation alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

aspire

Free

Load for Aspire AppHost work: start/stop/wait resources, inspect dashboard/logs/traces, add integrations/resources, rebuild a service, run isolated worktrees, or diagnose Aspire orchestration; not for plain dotnet apps, container-only deployments, or cloud deployment.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

Load for authentication or authorization changes involving BFF cookies/tokens, JWT validation, claims/user ID extraction, policies, handler access checks, impersonation, or 401/403 bugs; not for UI affordance gating alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

Load for Blazor BFF server work involving YARP proxy routes, cookie sessions, access-token forwarding/refresh, downstream API calls, BFF handlers, or browser-to-API auth failures; not for client component rendering or API JWT validation alone.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

Load for Blazor/MudBlazor component or page changes involving render modes, dialogs, parameters/events, HAL-gated actions, generated API clients or generated record consumption, theming, or component tests; add accessibility or CSS-isolation only when touched.

The English summary is being prepared. Showing the original description.

islamu-ngo/Event8Updated Oct 20, 2026

See all skills by islamu-ngo

Report a problem with this skill