Sitelet https://github.com/angular/angular/pull/70835
Skip to content

docs: document CSS custom property namespacing in the styling guide - #70835

Closed
erkamyaman wants to merge 3 commits into
angular:mainfrom
erkamyaman:docs-css-var-namespacing-guide
Closed

erkamyaman wants to merge 3 commits into
angular:mainfrom
erkamyaman:docs-css-var-namespacing-guide

Conversation

@erkamyaman

@erkamyaman erkamyaman commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #70834

Adds a section to the component styling guide for the CSS namespacing featurefrom #68846. Covers what gets renamed, what doesn't (static style attributes, [style] object bindings, Renderer2.setStyle, global stylesheets, and library components reading a theme, all of which fail silently), the --global-- opt-out, and CssVarNamespacer for DOM APIs. Written against the merged code, not the PR description, which is out of date: the _ separator is appended for you now, the --global- error only runs in g3, and a <link> in a template gets inlined and namespaced.

`provideCssVarNamespacing` and `CssVarNamespacer` landed in v22.1 (#68846)
with no guide coverage, so the generated API reference was the only
description of them. That reference cannot explain where the feature stops:
Angular rewrites the custom property names in the styles it compiles, but
static `style` attributes, object style bindings, `Renderer2.setStyle`,
global stylesheets, and library components that read a global theme all keep
the original name, and nothing reports the mismatch at build time or at
runtime.

Document the feature in the component styling guide: what Angular rewrites,
the surfaces that keep the name you write, how to opt a name out with
`--global--`, and how to resolve a namespaced name from TypeScript.

Fixes #70834
@pullapprove
pullapprove Bot requested a review from MarkTechson September 20, 2026 19:06
@angular-robot angular-robot Bot added the area: docs Related to the documentation label Sep 20, 2026
@ngbot ngbot Bot added this to the Backlog milestone Sep 20, 2026

@JeanMeche JeanMeche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AGENT: The documentation additions look great and adhere nicely to the adev-writing-guide. I have left one minor inline suggestion for adding a file header to the final code block for consistency.

Point the TSDoc of `provideCssVarNamespacing` and `CssVarNamespacer` at the
guide section that describes them, so the generated API pages lead back to
it, and name the component file in the guide's example.
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Sep 20, 2026
@JeanMeche
JeanMeche requested review from mattrbeck and removed request for JeanMeche and MarkTechson September 20, 2026 20:15
@JeanMeche JeanMeche added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 30, 2026
@JeanMeche JeanMeche added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Sep 30, 2026
@JeanMeche

Copy link
Copy Markdown
Member

caretaker note: This is a doc only change, no need to presubmit.

@kirjs

kirjs commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@kirjs kirjs closed this in 95f607c Oct 1, 2026
kirjs pushed a commit that referenced this pull request Oct 1, 2026
…70835)

`provideCssVarNamespacing` and `CssVarNamespacer` landed in v22.1 (#68846)
with no guide coverage, so the generated API reference was the only
description of them. That reference cannot explain where the feature stops:
Angular rewrites the custom property names in the styles it compiles, but
static `style` attributes, object style bindings, `Renderer2.setStyle`,
global stylesheets, and library components that read a global theme all keep
the original name, and nothing reports the mismatch at build time or at
runtime.

Document the feature in the component styling guide: what Angular rewrites,
the surfaces that keep the name you write, how to opt a name out with
`--global--`, and how to resolve a namespaced name from TypeScript.

Fixes #70834

PR Close #70835
kirjs pushed a commit that referenced this pull request Oct 1, 2026
…PIs (#70835)

Point the TSDoc of `provideCssVarNamespacing` and `CssVarNamespacer` at the
guide section that describes them, so the generated API pages lead back to
it, and name the component file in the guide's example.

PR Close #70835
nikos-moysiadis pushed a commit to nikos-moysiadis/angular that referenced this pull request Oct 1, 2026
…PIs (angular#70835)

Point the TSDoc of `provideCssVarNamespacing` and `CssVarNamespacer` at the
guide section that describes them, so the generated API pages lead back to
it, and name the component file in the guide's example.

PR Close angular#70835
@erkamyaman
erkamyaman deleted the docs-css-var-namespacing-guide branch October 30, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime area: docs Related to the documentation merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the CSS namespacing feature.

5 participants