Skip to main content

PageHeader Component

The <PageHeader> component is designed to render a consistent header for pages and/or sections within your application. It supports an optional icon or image, title, description and more.

Basic Usage​

The component renders a header with a title and description.

import { PageHeader } from "react-better-html";

function App() {
return (
<PageHeader title="Addresses" description="All available addresses listed bellow" />
);
}

Common Props​

type PageHeaderProps = {
icon?: IconName;
iconColor?: string;
iconSize?: number;
image?: AssetName;
imageUrl?: string;
imageSize?: number;
imageWidth?: React.CSSProperties["width"];
imageHeight?: React.CSSProperties["height"];
imageAzProfileImage?: boolean;
imageObjectFit?: React.CSSProperties["objectFit"];
title?: string | React.ReactNode;
titleAs?: TextAs;
titleFontSize?: React.CSSProperties["fontSize"];
titleColor?: React.CSSProperties["color"];
titleRightElement?: React.ReactNode;
description?: string | React.ReactNode;
descriptionFontSize?: React.CSSProperties["fontSize"];
descriptionColor?: React.CSSProperties["color"];
imageGap?: React.CSSProperties["gap"];
titleGap?: React.CSSProperties["gap"];
textAlign?: React.CSSProperties["textAlign"];
rightElement?: React.ReactNode;
lightMode?: boolean;
width?: React.CSSProperties["width"];
flex?: React.CSSProperties["flex"];
} & Pick<ComponentMarginProps, "marginBottom">;
  • icon / iconColor / iconSize - an icon rendered before the title (size defaults to 20)
  • image / imageUrl - an asset name or a URL of an image to display in the header
  • imageSize - the size of the image in pixels (defaults to 60)
  • imageWidth / imageHeight / imageObjectFit - override the image size and fit
  • imageAzProfileImage - renders the image as a circular profile image
  • title - the title text or a custom element
  • titleAs - the HTML tag to use for the title (defaults to h1)
  • titleFontSize / titleColor - the style of the title
  • titleRightElement - react element to render right after the title text
  • description - the description text or a custom element
  • descriptionFontSize / descriptionColor - the style of the description
  • imageGap - the space between the image/icon and the texts (defaults to theme.styles.space)
  • titleGap - the space between the title and the description (defaults to theme.styles.gap / 2)
  • textAlign - the text alignment for the title and description
  • rightElement - react element to display in the right end of the component
  • lightMode - if true, uses white text colors
  • marginBottom - the space under the header (defaults to theme.styles.space * 2)
tip

The same header props are available on <Div.box> and <Foldable>.