ba-content
This component applies our typography styling to text elements and controls the vertical rhythm between copy and other components
Airframe
Web Components
React
React Native
Anatomy
Content container
The boundary of the component. It groups related content and applies consistent typography and spacing to its direct children.
Content element
A first-level element placed inside the component, such as a heading, paragraph, list, image, link or table
Vertical rhythm
The consistent vertical spacing applied between first-level content elements. The amount of spacing can be adjusted using the component’s spacing property.
Design Documentation
Increasing the whitespace between the content makes it easier for users to skim content and increase comprehension.
Further reading:
Live Demo
Header 1
Header 2
Header 3
Header 4
Header 5
Header 6
Body text
<ba-content>
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<h4>Header 4</h4>
<h5>Header 5</h5>
<h6>Header 6</h6>
<p>Body text</p>
</ba-content>
Properties and attributes
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
spacing |
spacing |
Set's the relative space between first level child elements | string | undefined |
undefined |
Permitted ARIA roles
- None
Slots
| Slot | Description | Permitted elements |
|---|---|---|
| Unnamed slot | Elements will render in the body of the component | <ba‑image>, <ba‑link>, <ba‑link‑back>, <ba‑star‑rating>, <ba‑table>, <ba‑tag>, <code>, <dl>, <figure>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ol>, <p>, <pre>, <table>, <ul> |
Parent components
ba-content can be slotted into:
<ba‑tab‑container‑content><ba‑tab‑chip‑content><ba‑radio‑card><ba‑page‑segment><ba‑message‑global><ba‑message><ba‑media‑viewer‑slide><ba‑media‑object><ba‑hero><ba‑header‑section><ba‑grid><ba‑form‑group‑dropdown><ba‑form‑group><ba‑form><ba‑flex><ba‑details><ba‑checkbox‑list‑card><ba‑checkbox‑card><ba‑card‑segmented><ba‑card><ba‑accordion>
Usage
Clean HTML structure
In order to work correctly, ba-content relies on clean HTML. For example, wrapping content in unnecessary <div> elements will break the styling of the component's children.
<ba-content>
<h1>Header 1</h1>
<h2>Header 2</h2>
<h3>Header 3</h3>
<p>Body paragraph with proper typography styling applied automatically.</p>
</ba-content>
Default typography sizes
Each HTML element within ba-content receives default typography styling automatically.
<ba-content>
<h1>Header 1 is 44px and 56px on viewports 1024px and wider</h1>
<h2>Header 2 is 36px and 44px on viewports 1024px and wider</h2>
<h3>Header 3 is 24px and 36px on viewports 1024px and wider</h3>
<h4>Header 4 is 20px across all viewports</h4>
<h5>Header 5 is 16px across all viewports</h5>
<h6>Header 6 is 12px across all viewports</h6>
<p>Body text is 16px across all viewports</p>
</ba-content>
Overiding the default styling
<ba-content>
<h2 class="ba-c-content__header-36">This h2 uses a custom 36px heading style</h2>
<p class="ba-c-content__header-20">This paragraph uses a custom 20px heading style</p>
<p class="ba-c-content__body-12">This paragraph is styled as small print</p>
</ba-content>
<ba-content>
<h2 class="ba-c-content__1024vw-header-56">This uses the default h2 size for viewports less than 1024px wide and 56px for viewports 1024px and wider</h2>
<p class="ba-c-content__1024vw-header-20">This paragraph is styled as a 20px heading for viewports 1024px and wider</p>
<p class="ba-c-content__1024vw-body-12 ba-c-content__1024vw-body-16">This paragraph is styled at 12px for viewports less than 1024px wide and 16px for viewports 1024px and wider</p>
</ba-content>
Custom typography classes
The following CSS classes can be added to elements to apply custom typography styling beyond the defaults.
| Class | Typography styling |
|---|---|
ba-c-content__header-56 |
Header 56 |
ba-c-content__header-44 |
Header 44 |
ba-c-content__header-36 |
Header 36 |
ba-c-content__header-28 |
Header 28 |
ba-c-content__header-24 |
Header 24 |
ba-c-content__header-20 |
Header 20 |
ba-c-content__header-16 |
Header 16 |
ba-c-content__header-12 |
Header 12 |
ba-c-content__body-16 |
Body 16 |
ba-c-content__body-12 |
Body 12 |
ba-c-content__1024vw-header-56 |
Header 56 (≥1024px) |
ba-c-content__1024vw-header-44 |
Header 44 (≥1024px) |
ba-c-content__1024vw-header-36 |
Header 36 (≥1024px) |
ba-c-content__1024vw-header-28 |
Header 28 (≥1024px) |
ba-c-content__1024vw-header-24 |
Header 24 (≥1024px) |
ba-c-content__1024vw-header-20 |
Header 20 (≥1024px) |
ba-c-content__1024vw-header-16 |
Header 16 (≥1024px) |
ba-c-content__1024vw-body-16 |
Body 16 (≥1024px) |
ba-c-content__1024vw-body-12 |
Body 12 (≥1024px) |
The following CSS classes are all deprecated.
| Class | Typography styling |
|---|---|
ba-c-content__heading-secondary |
Secondary heading |
ba-c-content__heading-tertiary |
Tertiary heading |
ba-c-content__summary |
Summary |
ba-c-content__heading-micro-xs |
Micro XS heading |
ba-c-content__heading-micro-xxs |
Micro XXS heading |
ba-c-content__small-print |
Small print |
Guidelines
ba-content follows the typography guidelines, which ensure proper contrast, font sizes, and line heights for readability.
These guidelines help all users, including those with low vision or reading difficulties, to comfortably read and comprehend content.
Headings should follow a logical order (h1, h2, h3, etc.) without skipping levels. Screen readers and other assistive technology rely on headings to navigate and understand the structure of pages.
Users of assistive technology often navigate by headings, jumping between sections to find relevant content. A proper hierarchy makes this navigation efficient and accurate.
Further reading:
ba-content works best with semantic HTML elements like <h1> through <h6>, <p>, and other native elements. These elements provide important meaning and structure that assistive technologies can interpret.
Avoid using presentational markup or styling non-semantic elements to look like headings or paragraphs. Use the correct semantic element for the content's purpose.
In order to work correctly, ba-content relies on clean HTML. For example, wrapping content in unnecessary <div> elements will break the styling of the component's children.
Keep your markup semantic and avoid unnecessary wrapper elements to ensure proper typography styling is applied.
Keyboard navigation
State: ba-content is a non-interactive container
Focus moves through interactive elements within ba-content (links, buttons, etc.), skipping ba-content itself
Usage and accessibility checklist
Use this checklist to confirm the component has been configured and used correctly.
UX checklist
- ba-content relies on clean HTML structure (avoid wrapping elements in unnecessary divs)
- Spacing between content elements follows vertical rhythm guidelines for readability
- Long content sections use increased spacing to improve skimmability and comprehension
Accessibility checklist
- Heading elements follow proper document hierarchy
- Text content follows typography guidelines
- Semantic HTML elements are used appropriately within ba-content
- Text is not presented in all caps
- Bold and italic text have not been used
These checks are handled by the component and do not need to be repeated each time it is used.
- ba-content correctly applies typography styles to child elements
- Line lengths are optimised for readability across different screen sizes
- Colour contrast for all text elements in all BAgel themes
- Spacing calculations work correctly across different content combinations
- Custom CSS classes apply correct typography styling