Skip to main content

Installation

Welcome to the installation guide for react-better-html. This guide will help you get started with installing and using the library in your React projects.

Requirements​

  • React version 19.0 or above.

The library uses styled-components under the hood to create all of the components in the library. styled-components is a peer dependency and will be installed automatically when downloading the react-better-html.

Installation​

To install react-better-html run the following command in your project directory:

npm install react-better-html

Quick start​

Wrap your app with the <BetterHtmlProvider> and start using the components.

main.tsx
import { createRoot } from "react-dom/client";
import { BetterHtmlProvider } from "react-better-html";

import App from "./App";

createRoot(document.getElementById("root")).render(
<BetterHtmlProvider>
<App />
</BetterHtmlProvider>
);
App.tsx
import { PageHolder, PageHeader, Div, Button } from "react-better-html";

function App() {
return (
<PageHolder>
<PageHeader title="Hello" description="My first react-better-html page" />

<Div.row gap={10}>
<Button text="Get started" />
<Button.secondary text="Read more" />
</Div.row>
</PageHolder>
);
}

export default App;

Problems?​

If you encounter any issues, please:

tip

When reporting an issue, please include:

  • Your React version.
  • Your react-better-html version.
  • Any relevant error messages.
  • A code snippet that reproduces the issue.

Using AI assistants​

The documentation is available for AI assistants (llms.txt and llms-full.txt) and there is a ready rule you can add to your editor. Check out the AI Assistants page.