2.4 KiB
Heading Levels and Sizing
Heading Levels are used by screen readers, and other software, to get a rough idea of the document structure, so it is important to keep this structure in mind when deciding on a headings level.
Heading Level best practices
-
Make sure every route has exactly one
<h1>element, which best describes the content of the current page. -
When increasing a heading level, do not skip Levels.
-
Do not use a headings level to determine it's size. Use one of the heading utility classes (e.g.
h-lg) instead. -
Do not use a heading tag to make a non-heading text large. Use a heading utility class on a
<span>instead.
Sizing Headings
There are several utility classes which size headings:
h-xl- Extra large headingsh-lg- Large headings (most main headings should have this size)h-md- Medium headingsh-sm- Small headings (many sub-headings have this size)h-text- Text sized headings
Galaxy uses h-lg for most top-level (<h1>) headings.
These sizes are purely visual, and do not necessarily have to follow the document structure.
It is fine to use several headings on the same page with the same heading level, and different sizes. An example for this would be the heading of an error message, which has a heading level of 2 (<h2>) in most cases, but is visually smaller than other sub-headings.
Styling Headings with the <Heading> component
For more visually distinct headings, there is an Heading component, found under components/Common/Heading.vue
Make use of this component to break up flat layouts and add better separation to a page with multiple sections.
Usage
Set the headings level, by setting aa h1 ... h6 prop:
<Heading h1>Top Level Heading</Heading>
Following properties allow for further styling the component:
size=["xl", "lg", "md", "sm", "text"]- sets the headings size classbold- makes a heading boldinline- displays the heading inlineseparator- draws a separating line, to better distinguish sectionsicon="..."- adds a font-awesome icon decoration to the left of the heading. Make sure to also load the icon withlibrary.add(...).