Skip to main content

Divider Component

The <Divider> component provides a simple way to render vertical and horizontal dividers with customizable styles. It is designed to visually separate content within your application.

Basic Usage​

The component offers two types of dividers: vertical and horizontal. You can customize the width of the line with the width prop. backgroundColor will change the color of the divider and the paddingBlock will put some space above and below.

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

function App() {
return (
<Div.row height={200} alignItems="center" gap={20}>
<Text textAlign="center">Content Left</Text>

<Divider.vertical />

<Text textAlign="center">Content Right</Text>
</Div.row>
);
}

You can set a height for the divider if you do not want it to span the 100% of the parent.

Common Props​

  • width - the thickness of the line (defaults to 1)
  • backgroundColor - the color of the line (defaults to border)
  • height - the height of the vertical divider (defaults to 100%)
  • All margin props (margin, marginBlock, ...)

The text of the horizontal divider can be customized with textColor, textFontSize, textFontWeight, textFontFamily, textTransform and textLetterSpacing.

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

function App() {
return (
<Divider.horizontal
text="Or continue with"
textFontSize={12}
textTransform="uppercase"
textLetterSpacing={1}
marginBlock={20}
/>
);
}