How to use
PageTitle is a semantic heading component for page and section titles — it decouples the visual size from the actual heading level, so a title can look like an h1 while genuinely rendering as an h2 (or vice versa) to keep the document's real heading hierarchy correct regardless of visual design.
import { PageTitle } from "oks-ui";title is the heading content; as picks which semantic element actually renders (h1 through h6, defaulting to h4). Decide as based on the page's real document outline, not visual size — a section heading three levels deep in a page should be an h3/h4 even if it needs to look large.
<PageTitle as="h1" title="Dashboard" />
<PageTitle as="h3" title="Recent activity" />subtitle renders secondary text below the title — a short description of what the page/section contains, or supplementary context that doesn't belong in the heading itself.
<PageTitle title="Team members" subtitle="Manage who has access to this workspace." />icon renders next to the title, with iconPosition (start or end) controlling which side. color applies a semantic tint to the title text — leave it unset to inherit currentColor from the surrounding context, which is usually the right default for a heading meant to match its surrounding text color.
<PageTitle title="Billing" icon={<CreditCardIcon />} color="primary" />For a title that benefits from extra context on hover (an abbreviation, a truncated long name), pass tooltip — true for a simple default, or an options object/content override for more control. It wraps just the title text, not the subtitle.
<PageTitle title="Q3 Revenue Forecast (FY26)" tooltip={{ content: "Fiscal year 2026, third quarter" }} />All available props for PageTitle. See the full component page for an interactive playground.
| Prop | Type | Default | Description |
|---|---|---|---|
title | ReactNode | "Title" | Heading text/content. |
icon | ReactNode | — | Icon rendered beside the title. |
subtitle | ReactNode | — | Secondary text rendered below the title. |
title
ReactNode
Default: "Title"
Heading text/content.
icon
ReactNode
Default: —
Icon rendered beside the title.
subtitle
ReactNode
Default: —
Secondary text rendered below the title.
| Prop | Type | Default | Description |
|---|---|---|---|
color | "default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" | "black" | "white" | string | — | Text color; inherits currentColor when unset. |
colorDepth | number | 500 | Shade depth for the selected color. |
iconPosition | "start" | "end" | start | Icon placement relative to the title. |
color
"default" | "primary" | "secondary" | "info" | "success" | "warning" | "danger" | "black" | "white" | string
Default: —
Text color; inherits currentColor when unset.
colorDepth
number
Default: 500
Shade depth for the selected color.
iconPosition
"start" | "end"
Default: start
Icon placement relative to the title.
| Prop | Type | Default | Description |
|---|---|---|---|
as | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "h4" | Semantic heading element rendered. |
tooltip | ReactNode | boolean | (Omit<TooltipProps, "children"|"content"> & { content?: ReactNode }) | — | Wraps the title in a Tooltip. A plain value is shorthand content; bare true derives content from title; an object accepts any Tooltip prop plus an optional content override. |
as
"h1" | "h2" | "h3" | "h4" | "h5" | "h6"
Default: "h4"
Semantic heading element rendered.
tooltip
ReactNode | boolean | (Omit<TooltipProps, "children"|"content"> & { content?: ReactNode })
Default: —
Wraps the title in a Tooltip. A plain value is shorthand content; bare true derives content from title; an object accepts any Tooltip prop plus an optional content override.
| Prop | Type | Default | Description |
|---|---|---|---|
onKeyDown | (e: KeyboardEvent<HTMLDivElement>) => void | — | Keydown handler on the root element. |
onKeyDown
(e: KeyboardEvent<HTMLDivElement>) => void
Default: —
Keydown handler on the root element.
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Class applied to the root element. |
classNames | Partial<Record<PageTitleSlot, string>> | — | Per-slot class overrides (base/title/icon/subtitle). |
style | CSSProperties | — | Inline styles for the root element. |
className
string
Default: —
Class applied to the root element.
classNames
Partial<Record<PageTitleSlot, string>>
Default: —
Per-slot class overrides (base/title/icon/subtitle).
style
CSSProperties
Default: —
Inline styles for the root element.