# PageTitle

> A specialized component for the primary heading of a page. It ensures consistent styling for top-level titles across your application.

Source: https://vaneui.com/docs/typography-components/page-title

Import: `import { PageTitle, Button, Card, Col, Divider, Row, SectionTitle, Stack, Text, Title } from "@vaneui/ui"`

PageTitle is the heading that names the whole screen, such as an article title, a dashboard name or a hero headline. Long titles wrap into lines of similar length (`text-wrap: balance`), and the font size steps down at tablet and mobile widths. Headings below it belong in [SectionTitle](/docs/typography-components/section-title), which renders `<h2>`, and [Title](/docs/typography-components/title), which renders `<h3>`.

## Basic usage

PageTitle renders a large `<h1>` heading for page titles. It defaults to `fontSemibold` weight, `fontHeading` font family, `trackingTight` letter spacing, and `inheritAppearance` appearance.

```tsx demo
<PageTitle>Welcome to VaneUI</PageTitle>
```

## Sizes

Page titles come in five sizes: `xs`, `sm`, `md` (default), `lg`, `xl`.

```tsx demo
<Col>
  <PageTitle xs>Extra Small Page Title</PageTitle>
  <PageTitle sm>Small Page Title</PageTitle>
  <PageTitle>Medium Page Title (default)</PageTitle>
  <PageTitle lg>Large Page Title</PageTitle>
  <PageTitle xl>Extra Large Page Title</PageTitle>
</Col>
```

## Appearances

By default, PageTitle uses the `inheritAppearance` appearance: it inherits color from its parent. Use explicit appearances like `primary`, `secondary`, `success`, `warning`, `danger`, `info` to override.

```tsx demo
<Col>
  <PageTitle primary>Primary Page Title</PageTitle>
  <PageTitle secondary>Secondary Page Title</PageTitle>
  <PageTitle success>Success Page Title</PageTitle>
  <PageTitle warning>Warning Page Title</PageTitle>
  <PageTitle danger>Danger Page Title</PageTitle>
  <PageTitle info>Info Page Title</PageTitle>
</Col>
```

## Variants

Headings never paint a background, so the variant only picks which colour of the appearance the heading is painted in. `outline`, the default, uses the appearance's own colour. `filled` uses the "on this fill" colour, for a heading sitting on a filled surface of the same appearance.

```tsx demo
<Col>
  <PageTitle info>outline info, on the page surface</PageTitle>
  <PageTitle danger>outline danger, on the page surface</PageTitle>
  <Card info filled>
    <PageTitle info filled>filled info, on a matching filled Card</PageTitle>
  </Card>
  <Card danger filled>
    <PageTitle danger filled>filled danger, on a matching filled Card</PageTitle>
  </Card>
</Col>
```

## PageTitle vs SectionTitle vs Title

Three heading components for a clean semantic hierarchy. Use them together so the document outline matches the visual hierarchy.

```tsx demo
<Col>
  <PageTitle>Page Heading (h1)</PageTitle>
  <SectionTitle>Section Heading (h2)</SectionTitle>
  <Title>Subsection Heading (h3)</Title>
</Col>
```

## Font weights

PageTitle is `fontSemibold` by default. Override with any weight prop: `fontThin`, `fontExtralight`, `fontLight`, `fontNormal`, `fontMedium`, `fontSemibold`, `fontBold`, `fontExtrabold`, `fontBlack`.

```tsx demo
<Col>
  <PageTitle fontLight>Light Page Title</PageTitle>
  <PageTitle fontNormal>Normal Page Title</PageTitle>
  <PageTitle fontMedium>Medium Page Title</PageTitle>
  <PageTitle>Semibold Page Title (default)</PageTitle>
  <PageTitle fontBold>Bold Page Title</PageTitle>
  <PageTitle fontBlack>Black Page Title</PageTitle>
</Col>
```

## Font families

Switch between `fontSans`, `fontSerif`, and `fontMono` font families.

```tsx demo
<Col>
  <PageTitle fontSans>Sans-serif Page Title</PageTitle>
  <PageTitle fontSerif>Serif Page Title</PageTitle>
  <PageTitle fontMono>Monospace Page Title</PageTitle>
</Col>
```

## Italic

Use the `italic` prop for italic emphasis.

```tsx demo
<PageTitle italic>Italic Page Title</PageTitle>
```

## Text alignment

PageTitle is left-aligned by default. Use `textCenter`, `textRight`, or `textJustify` to change alignment.

```tsx demo
<Card>
  <PageTitle wFull>Left Aligned (default)</PageTitle>
  <PageTitle wFull textCenter>Center Aligned</PageTitle>
  <PageTitle wFull textRight>Right Aligned</PageTitle>
</Card>
```

## Custom HTML tag

Override the rendered tag with the `tag` prop when the visual style of PageTitle is wanted but a different semantic level is required.

```tsx demo
<Col>
  <PageTitle>Rendered as h1 (default)</PageTitle>
  <PageTitle tag="h2">Rendered as h2</PageTitle>
  <PageTitle tag="h3">Rendered as h3</PageTitle>
  <PageTitle tag="div">Rendered as div</PageTitle>
</Col>
```

## PageTitle in context

Page titles work well as the main heading of a page, paired with a subtitle.

```tsx demo
<Card>
  <PageTitle lg primary>Product Documentation</PageTitle>
  <Text secondary>Learn how to use VaneUI components in your projects.</Text>
  <Text>Get started with our comprehensive guides and examples.</Text>
</Card>
```

## Page header pattern

Combine PageTitle with Text and Divider for a complete page header.

```tsx demo
<Col>
  <PageTitle xl>Dashboard</PageTitle>
  <Text lg secondary>Welcome back. Here is an overview of your projects.</Text>
  <Divider />
  <Text>Content goes here...</Text>
</Col>
```

## Hero page header

Combine an `xl` PageTitle with a large subtitle and a call to action for a marketing-style hero.

```tsx demo
<Stack itemsCenter>
  <PageTitle xl textCenter>Build Faster with VaneUI</PageTitle>
  <Text lg secondary textCenter>A boolean-props React component library powered by Tailwind CSS v4.</Text>
  <Row>
    <Button filled>Get Started</Button>
    <Button>View on GitHub</Button>
  </Row>
</Stack>
```

## Frequently asked questions

### Can a page have more than one PageTitle?

Use one. PageTitle renders an `<h1>`, and a page reads best with a single top-level heading that names it, which screen reader users often jump to first. For a large heading further down, use a SectionTitle with a size prop such as `xl`, or `<PageTitle tag="h2">`, which keeps the look and renders an `<h2>`.

### Does PageTitle set the title in the browser tab?

No. PageTitle renders an `<h1>` in the page, and the document `<title>` comes from your framework, such as the `metadata` export of a Next.js page or layout. Set both, and keep their wording close: the tab title can add the site name, while the PageTitle names the page itself.

### How do I keep a PageTitle the same size on a phone?

Pass `responsiveSizing={false}`. `responsiveSizing` is on by default for the headings, so a PageTitle steps its font size down below 1024px and again below 768px. Turned off, it keeps the size of its size prop at every width, so pick a size whose longest title still fits a narrow screen in a few lines.

## Props

| Prop | Category | Default | Description |
| --- | --- | --- | --- |
| `primary` | Appearance |  | Primary color appearance (gray) |
| `accent` | Appearance |  | Accent color appearance (rose) |
| `secondary` | Appearance |  | Secondary color appearance (gray) |
| `tertiary` | Appearance |  | Tertiary color appearance |
| `success` | Appearance |  | Success color appearance (green) |
| `danger` | Appearance |  | Danger color appearance (red) |
| `warning` | Appearance |  | Warning color appearance (amber) |
| `info` | Appearance |  | Info color appearance (cyan) |
| `inheritAppearance` | Appearance | yes | Inherit appearance from parent — suppresses own data-appearance/data-variant, uses parent's CSS variables |
| `fontSans` | Font Family |  | Sans-serif font family (default) — emits font-sans |
| `fontSerif` | Font Family |  | Serif font family — emits font-serif |
| `fontMono` | Font Family |  | Monospace font family — emits font-mono |
| `fontHeading` | Font Family | yes | Heading font family (defaults to sans, customizable via --font-heading) — emits font-heading |
| `italic` | Font Style |  | Italic font style |
| `notItalic` | Font Style |  | Not italic (normal) font style |
| `fontThin` | Font Weight |  | Thin font weight (100) — emits font-thin |
| `fontExtralight` | Font Weight |  | Extra light font weight (200) — emits font-extralight |
| `fontLight` | Font Weight |  | Light font weight (300) — emits font-light |
| `fontNormal` | Font Weight |  | Normal font weight (400) — emits font-normal |
| `fontMedium` | Font Weight |  | Medium font weight (500) — emits font-medium |
| `fontSemibold` | Font Weight | yes | Semibold font weight (600) — emits font-semibold |
| `fontBold` | Font Weight |  | Bold font weight (700) — emits font-bold |
| `fontExtrabold` | Font Weight |  | Extra bold font weight (800) — emits font-extrabold |
| `fontBlack` | Font Weight |  | Black font weight (900) — emits font-black |
| `inheritColor` | Inherit Color |  | Inherit text color from parent via CSS variable cascade (suppresses data-appearance emission) |
| `noInheritColor` | Inherit Color |  | Keep own text color; do not inherit from parent |
| `inheritSize` | Inherit Size |  | Inherit font-size and line-height from the nearest parent typography element |
| `noInheritSize` | Inherit Size |  | Keep own font-size; do not inherit from parent |
| `trackingTighter` | Letter Spacing |  | Tighter letter spacing (-0.05em) |
| `trackingTight` | Letter Spacing | yes | Tight letter spacing (-0.025em) |
| `trackingNormal` | Letter Spacing |  | Normal letter spacing (0) |
| `trackingWide` | Letter Spacing |  | Wide letter spacing (0.025em) |
| `trackingWider` | Letter Spacing |  | Wider letter spacing (0.05em) |
| `trackingWidest` | Letter Spacing |  | Widest letter spacing (0.1em) |
| `margin` | Margin |  | Enable margin on all sides |
| `marginX` | Margin |  | Enable only horizontal (inline) margin |
| `marginY` | Margin |  | Enable only vertical (block) margin |
| `marginT` | Margin |  | Enable only top margin |
| `marginB` | Margin |  | Enable only bottom margin |
| `noMargin` | Margin |  | Disable margin (reset to 0) |
| `xs` | Size |  | Extra small size |
| `sm` | Size |  | Small size |
| `md` | Size | yes | Medium size (default) |
| `lg` | Size |  | Large size |
| `xl` | Size |  | Extra large size |
| `skeleton` | Skeleton |  | Show the component as a loading placeholder in its own size and shape. On a container, every component inside it becomes a placeholder too |
| `srOnly` | Sr Only |  | Hide visually and keep it for screen readers (sr-only) |
| `textLeft` | Text Align | yes | Align text to left (physical side, does not flip under RTL) |
| `textCenter` | Text Align |  | Align text to center |
| `textRight` | Text Align |  | Align text to right (physical side, does not flip under RTL) |
| `textJustify` | Text Align |  | Justify text |
| `textStart` | Text Align |  | Align text to the reading-direction start (left in LTR, right in RTL) |
| `textEnd` | Text Align |  | Align text to the reading-direction end (right in LTR, left in RTL) |
| `underline` | Text Decoration |  | Add underline decoration below text |
| `lineThrough` | Text Decoration |  | Add strikethrough/line-through decoration across text |
| `noUnderline` | Text Decoration |  | Remove ALL text-decoration — underline, line-through, and overline (text-decoration: none) |
| `overline` | Text Decoration |  | Add overline decoration above text |
| `uppercase` | Text Transform |  | Transform text to uppercase |
| `lowercase` | Text Transform |  | Transform text to lowercase |
| `capitalize` | Text Transform |  | Capitalize first letter of each word |
| `normalCase` | Text Transform |  | Normal text case (no transformation) |
| `truncate` | Truncate |  | Single line truncation with ellipsis |
| `lineClamp2` | Truncate |  | Truncate at 2 lines with ellipsis |
| `lineClamp3` | Truncate |  | Truncate at 3 lines with ellipsis |
| `lineClamp4` | Truncate |  | Truncate at 4 lines with ellipsis |
| `lineClamp5` | Truncate |  | Truncate at 5 lines with ellipsis |
| `noTruncate` | Truncate |  | Remove truncation |
| `filled` | Variant |  | Filled variant - solid background with contrasting text color |
| `outline` | Variant | yes | Outline variant - transparent background with border and colored text (default) |
| `ghost` | Variant |  | Ghost variant - transparent background, no border, appearance-colored text, tinted hover background |
| `breakNormal` | Word Break |  | Reset breaking - overflow-wrap and word-break normal |
| `breakWords` | Word Break |  | Break long words to prevent overflow - overflow-wrap: break-word |
| `breakAll` | Word Break |  | Break between any two characters - word-break: break-all |
| `breakKeep` | Word Break |  | Do not break CJK text - word-break: keep-all |

Layout and utility props (Cursor, Display, Height, Hide, Items, Justify, Overflow, Position, Responsive Sizing, Responsive Width, Show, Whitespace, Width) are listed on [Common Props](https://vaneui.com/docs/reference/common-props.md).
