Skip to content

docs: mention themed HTML on the Styling HTML Elements page - #6770

Open
totally-not-ai[bot] wants to merge 5 commits into
mainfrom
docs/themed-html-styling-elements
Open

totally-not-ai[bot] wants to merge 5 commits into
mainfrom
docs/themed-html-styling-elements

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a "Theme Styles for HTML Elements" section to the Styling HTML Elements page. Until now, the theme styles for native HTML elements were only described on the Table page and in the configuration properties, not on the page about styling HTML elements.

Fixes #6769

What changed

  • New section, with a 25.3 since badge, that explains:
    • that the themes already style typography, such as headings, by default, while the fuller, component-matching styles are opt-in
    • opting in with the vaadin-themed-html class name on an element or an ancestor (Flow and React examples)
    • turning it on for the whole app with the themedHtml configuration property
    • opting a single element out with vaadin-unthemed-html
    • that the theme styles use low specificity, so a class-based rule of your own overrides them
  • The section says <table> is the only element supported so far, so it stays correct when more elements are added.
  • Links to the configuration property and to the Table page's Styling section.
  • The themedHtml property description and the Table page's Styling section no longer say that the themes don't style other HTML elements at all; they now say those elements don't get the theme's table-style (fuller) styles.

Test summary

  • Vale reports no errors or warnings for the page.
  • Checked the class names, the constants and their package, and the property against the Flow sources. Checked the opt-out and the specificity of the rules against the Aura and Lumo table CSS.

Working on behalf of Stefan

The theme styles for native HTML elements were described only on the
Table page and in the configuration properties. Add a section to the
page about styling HTML elements, where readers look for it.
@totally-not-ai totally-not-ai Bot added the target/v25.3 Automatically cherry-pick to the v25.3 branch label Nov 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6770.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 71bc02a

@peholmst
peholmst marked this pull request as ready for review December 2, 2026 08:53

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed the changes — left 2 comments.

Finding
⚠️ The themes already style many native HTML elements by default, so the opening claim is wrong
⚠️ Only the outer table rule has zero specificity; the cell rules do not

Comment thread articles/styling/styling-elements.adoc Outdated
[role="since:com.vaadin:vaadin@V25.3"]
== Theme Styles for HTML Elements

By default, native HTML elements are styled only by the browser and your own CSS. The Aura and Lumo themes can also style some of them, so that they match the Vaadin components. The `<table>` element is the one supported so far.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ The themes already style many native HTML elements by default, so the opening claim is wrong

By default, native HTML elements are styled only by the browser and your own CSS.

Both themes style native elements out of the box, with no opt-in class:

  • Lumo: packages/vaadin-lumo-styles/src/global/typography.css styles h1–h6, p, blockquote, a, hr, b, strong, small, code and pre. It is pulled in by lumo.css through src/global/index.css.
  • Aura: packages/aura/src/typography.css styles h1–h6 and b, strong, and sets the font on the root.

What the vaadin-themed-html class adds is the fuller, component-matching styling, currently for <table> only. Suggested rewrite of the first two sentences:

The Aura and Lumo themes already set typography on native HTML elements, such as headings, paragraphs and links. Some elements can also get the fuller styling that matches the Vaadin components, which is opt-in. The <table> element is the one supported so far.

styling-elements.adoc:89 · accuracy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. The opening now says the themes already style the typography of some native elements, such as headings, and that the fuller, component-matching styles are opt-in, with <table> the only element so far. I also fixed the same claim in the themedHtml property description and in the Table page's Styling section, so the three pages agree.

Comment thread articles/styling/styling-elements.adoc Outdated

To leave an element under a themed ancestor to the browser and your own CSS, add the `vaadin-unthemed-html` class name to that element. In Flow, this class name is available as [classname]`Constants.UNTHEMED_HTML_CLASS_NAME`, in the same class.

The theme styles have zero specificity, so your own CSS overrides them. For the Flow component that renders a table, see <<{articles}/components/html-elements/table#styling,Table>>.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Only the outer table rule has zero specificity; the cell rules do not

The theme styles have zero specificity, so your own CSS overrides them.

In packages/aura/src/table.css (and the Lumo equivalent) only the outer selector is wrapped in :where(…). The nested rules inside it carry element specificity, because the nesting selector contributes 0 and the nested part adds its own:

  • :is(th, td) { padding; text-align } → (0,0,1)
  • th { font-weight } → (0,0,1)
  • :is(thead, tfoot) :is(th, td) { background } → (0,0,2)

So a reader whose own rule is td { padding: 0 } ties with the theme and wins only on source order, not on specificity. Consider: "The theme styles use low specificity, so a class-based rule of your own overrides them."

styling-elements.adoc:121 · accuracy

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, only the outer :where(…) rule has zero specificity. Changed it to: "The theme styles use low specificity, so a class-based rule of your own overrides them."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/v25.3 Automatically cherry-pick to the v25.3 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mention themed HTML (vaadin-themed-html / themedHtml) on the Styling HTML Elements page

1 participant