PageHeader Component
The <PageHeader>
component is designed to render a consistent header for pages and/or sections within your application. It supports an optional image, title, description and more.
Basic Usage
The component renders a header with a title and description.
- Basic
- With Image
- With Actions
import { PageHeader } from "react-better-html";
function App() {
return (
<PageHeader title="Addresses" description="All available addresses listed bellow" />
);
}
import { PageHeader } from "react-better-html";
function App() {
return (
<PageHeader
imageUrl="https://picsum.photos/200/300"
title="Addresses"
description="All available addresses listed bellow"
/>
);
}
import { Button, PageHeader } from "react-better-html";
function App() {
return (
<PageHeader
title="Addresses"
description="All available addresses listed bellow"
rightElement={<Button text="Add New" icon="XMark" />}
/>
);
}
Common Props
type PageHeaderProps = {
imageUrl?: string;
imageSize?: number;
title?: string;
titleAs?: TextAs;
titleRightElement?: React.ReactNode;
description?: string;
textAlign?: React.CSSProperties["textAlign"];
rightElement?: React.ReactNode;
lightMode?: boolean;
} & Pick<ComponentMarginProps, "marginBottom">;
imageUrl
- a URL of an image to display in the headerimageSize
- the size of the image in pixelstitle
- the title texttitleAs
- the HTML tag to use for the title (e.g., "h1", "h2", ...)titleRightElement
- react element to render right after the title textdescription
- the description texttextAlign
- the text alignment for the title and descriptionrightElement
- react element to display in the right end of the componentlightMode
- if true, uses white text colors