Skip to content

The open alternative to Salesforce, designed for AI.

1.8 KB
Raw Blame
---
title: Heading
description: Render semantic headings with independent visual sizes.
---

import { PageBanner } from "/snippets/page-banner.mdx"

import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
import HeadingReference from '/snippets/ui/generated/typography/heading.mdx';

## Overview

`Heading` renders an `h2` by default. Use `children` for its content, `level` for document structure, and `size` for appearance.

<StoryEmbed
  storyId="ui-typography-heading--display"
  title="Heading example"
  height={90}
/>

## Usage

Choose levels in document order. A smaller visual size does not change the level announced by assistive technology.

```tsx
import { Heading } from 'twenty-ui/primitives/typography';

export const WorkspaceTitle = () => <Heading>Workspace settings</Heading>;
```

Sizes `xs`, `sm`, `md`, `lg`, `xl`, and `xxl` use the matching font tokens. The larger sizes use `1.54rem` and `1.85rem`, respectively. All sizes keep semibold weight and a `1.1` line height. `Section.Header` and `Dialog.Title` accept the same size values. Headings have no outer margin; their surrounding layout owns spacing.

## Color and composition

<StoryEmbed
  storyId="ui-typography-heading--catalog"
  title="Heading sizes and colors"
  height={480}
/>

Use `color="secondary"` for less prominent headings. `tertiary` is also available, but its contrast depends on the font size, theme, and background. Check readability when using it.

Native attributes, styles, class names, and refs pass to the heading. Use `render` to compose with a custom element or component; that element is responsible for preserving heading semantics.

For a heading with supporting text or actions, use [Section](/ui/components/layout/section).

## Props

<HeadingReference />

<PageBanner illustration="section-document-generator" />