Skip to main content

PageHolder Component

The <PageHolder> component is designed to provide a consistent layout for page content within your application. It applies padding, optional maximum width, and margin to center the content.

Basic Usage​

The component wraps the main content of a page inside a <main> tag, ensuring the layout's semantics and look.

import { Text, PageHolder } from "react-better-html";

function App() {
return (
<PageHolder>
<Text as="h1">Page Title</Text>

<Text>Page content here</Text>

// Rest of the page
</PageHolder>
);
}

Common Props​

  • noMaxContentWidth - If true, the content will not be constrained by the maximum width defined in the <BetterHtmlProvider> config
  • backgroundColor / backgroundImage - the background of the holder
  • All padding props (padding, paddingInline, ...). Defaults to theme.styles.space

Subcomponents​

A number of components in the library have a subcomponent feature witch is like a preset of the same component that is frequently used.

PageHolder.center​

This component centers its content vertically and horizontally on the screen inside a <Div.box>. It is perfect for login, register and other single-card pages.

import { PageHolder, PageHeader, Form, InputField } from "react-better-html";

function LoginPage() {
return (
<PageHolder.center>
<PageHeader title="Welcome back" titleAs="h2" />

<Form submitButtonText="Login" gap={10}>
<InputField.email />
<InputField.password />
</Form>
</PageHolder.center>
);
}
  • contentMaxWidth - the max width of the box (defaults to half of app.contentMaxWidth)
  • contentInsideBox - set to false to render the content without the box styles
  • height - the height of the box
  • pageBackgroundColor / pageBackgroundImage - the background of the whole page
  • sideComponent / sideComponentPosition - an element fixed on one half of the screen (right by default)
  • behindComponent - an element rendered behind the content
  • border, borderRadius, boxShadow and all margin and padding props are applied to the box