Heading

A heading element for page titles and section headers with configurable size, weight, and semantic level.

Anatomy

<script>
  import { Heading } from "@saas-ui/svelte/typography/heading";
</script>

<!-- Basic heading -->
<Heading>Page Title</Heading>

<!-- With size -->
<Heading size="3xl">Large Heading</Heading>

<!-- As different element -->
<Heading as="h1" size="4xl">Main Title</Heading>

Examples

As Element Accessibility

Use the as prop to render as different heading levels (h1-h6) for proper semantic structure.

Basic Accessibility

Basic heading with default styling for page titles and section headers.

Composition Accessibility

Compose headings with other components for rich layouts and visual hierarchy.

Highlight Accessibility

Combine with the Mark component to highlight important text within headings.

Multiline Accessibility

Headings work well with multiline text content for longer titles.

Sizes Accessibility

Use the size prop to change the size of the heading. Available sizes: xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl, 6xl, 7xl.

Weights Accessibility

Use the weight prop to change the font weight. Available weights: normal, medium, semibold, bold.

Props

Prop Type Default Description
as text h2 -
size xs | sm | md | lg | xl | 2xl | 3xl | 4xl | 5xl | 6xl | 7xl md The size of the component.
weight normal | medium | semibold | bold semibold -
fontWeight any - -
children any - The content to be rendered inside the component.
class text - Additional CSS classes to apply.