Skip to main content

Label Component

The <Label> component is designed to render <label> html element. It provides options for displaying a required indicator and error styling.

Basic Usage

The component renders a label with optional required indicator and error styling.

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

function App() {
return (
<Label text="Username" />
);
}

Common Props

type LabelProps = {
text?: string;
required?: boolean;
isError?: boolean;
};
  • text - the text to display in the label
  • required - if true, an asterisk is appended to the label to indicate it is required
  • isError - if true, the label is styled with an error color