Repository navigation
Subtitle
Subtitle is a minimal typography helper for secondary page and section text. It renders a styled <p> element and accepts either plain text or any React node as its content.
This component exists to keep supporting text visually consistent across pages, empty states, and detail views.
| Name | Type | Required | Description |
|---|---|---|---|
text |
string | ReactNode |
Yes | Content rendered inside the subtitle paragraph. |
className |
string |
No | Optional class name prepended before the built-in subtitle-section class. |
The component always renders a <p> element.
- when
classNameis omitted, the element class issubtitle-section - when
classNameis provided, the final class string is<className> subtitle-section -
textis rendered directly, so strings and React elements are both supported
Because text is rendered directly, the component does not transform or sanitize the content.
import Subtitle from "@/components/core/Subtitle";
<Subtitle text="User Settings" />;
<Subtitle text={<strong>Important note</strong>} className="custom-class" />;The component uses the .subtitle-section class from index.scss.
@use "../../../styles/variables" as vars;
@use "@carbon/type";
.subtitle-section {
@include type.type-style("body-02");
font-size: 14px;
line-height: 20px;
font-weight: 400;
color: var(--#{vars.$bcgov-prefix}-text-secondary);
}Style characteristics:
- based on Carbon
body-02 - fixed
14pxfont size -
20pxline height - regular
400weight - uses the BC Gov secondary text token for color
The unit tests cover:
- string rendering
- React node rendering
- custom class name composition
These tests confirm both the DOM element type and the final class string.
- supporting copy below a page title
- helper text inside empty states
- secondary descriptive text in cards or sections
Avoid using Subtitle as the primary heading element. It is a typography utility, not a heading component.
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository