Skip to content

What is variant field in heading component and how is it different from as field #3320

Answered by SiTaggart
jdesai321 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jdesai321

Simply put, visual hierarchy doesn't always follow document hierarchy in single page apps. So we decouple the visual appearance, via a variant, from the semantic hierarchy of the element to render as.

For accessibility reasons we want to create a nice clean document hierarchy where:

  • We only have one h1
  • We don't skip levels as we travel the DOM
h1
  h2
    h3
    h3
  h2
  h2
    h3
    h3
      h4

Sometimes, the appropriate document level doesn't match the visual design, because, for example, the third section of content is less important than the previous two, but at the same logical level of document hierarchy.

By decoupling visual appearance from hierarchy, we enable d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SiTaggart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants