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.
- Basic
- Required
- Error
import { Label } from "react-better-html";
function App() {
return (
<Label text="Username" />
);
}
import { Label } from "react-better-html";
function App() {
return (
<Label text="Email" required />
);
}
import { Label } from "react-better-html";
function App() {
return (
<Label text="Password" isError />
);
}
Common Props
type LabelProps = {
text?: string;
required?: boolean;
isError?: boolean;
};
text
- the text to display in the labelrequired
- iftrue
, an asterisk is appended to the label to indicate it is requiredisError
- iftrue
, the label is styled with an error color