This is an illustration of a Themed Heading component with default configuration.
<Heading>I am a Heading</Heading>

API Reference

Import

To use this component in your project, include the following import statement in your file.
import { Heading } from "@gluestack-ui/themed"

Anatomy

The structure provided below can help you identify and understand a Heading component's various parts.
export default () => <Heading />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Heading

It inherits all the properties of @expo/html-elements's H1 component.

Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this link.

Props

Heading component is created using H1 component from @expo/html-elements. It extends all the props supported by Expo HTML Heading Elements, utility props and the props mentioned below.

Heading

Name
Value
Default
isTruncated
true | false
false
bold
true | false
false
underline
true | false
false
strikeThrough
true | false
false
sub
true | false
false
italic
true | false
false
highlight
true | false
false
size
5xl | 4xl | 3xl | 2xl | xl | lg | md | sm | xs
md
Note: These props are exclusively applicable when utilizing the default configuration of gluestack-ui/config. If you are using a custom theme, these props may not be available.

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

Heading Sizes

Heading component offers a range of sizes, including xs, sm, md, lg, xl, 2xl, 3xl, 4xl, and 5xl, allowing users to customize the size of the heading according to their design requirements. The size attribute determines which HTML tag (h1 to h6) will be rendered.
  • For 5xl, 4xl, and 3xl, it renders h1.
  • For 2xl, it renders h2.
  • For xl, it renders h3.
  • For lg, it renders h4.
  • For md, it renders h5.
  • Finally, for sm and xs, it renders h6.
function App() {
const sizes = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl", "4xl", "5xl"]
return (
<Center>
{sizes.map((size) => (
<Heading size={size}>{size}</Heading>
))}
</Center>
)
}
The Heading component also accepts some shorthands for basic quick styling.
Prop
Type
Default
Description
bold
boolean
false
Used to make the text bold.
isTruncated
boolean
false
If true, it will render an ellipsis when the text exceeds the width of the viewport or maxWidth set.
italic
boolean
false
Used to make the text italic.
underline
boolean
false
Used underline the text.
strikeThrough
boolean
false
A horizontal line through the center of the text.
highlight
boolean
false
Used to highlight the text with a yellow background.

Unstyled

All the components in gluestack-ui are unstyled by default. To customize your UI using the extendedTheme, please refer to this link. The import names of components serve as keys to customize each component.