A simple Bootstrap-styled form label with a required field indicator.
// Default import (recommended for single-component tree-shaking)
import Label from 'react-bootstrap-plugins/Label'
// Named import from individual entry point
import { Label } from 'react-bootstrap-plugins/Label'
// Barrel import
import { Label } from 'react-bootstrap-plugins'import { Label } from 'react-bootstrap-plugins'
<Label hf="studentName" label="Student Name" />
// Renders: <label for="studentName">Student Name <b class="text-danger">*</b></label>| Prop | Type | Default | Description |
|---|---|---|---|
hf |
string |
'default' |
htmlFor attribute — matches input id |
label |
string |
'Title' |
Label text |
required |
boolean |
true |
Show red asterisk |
className |
string |
— | Additional CSS classes |
<Label hf="email" label="Email Address" required /><Label hf="middleName" label="Middle Name" required={false} /><div className="mb-3 row">
<div className="col-sm-3">
<Label hf="phone" label="Phone Number" className="col-form-label" />
</div>
<div className="col-sm-9">
<input id="phone" type="tel" className="form-control" />
</div>
</div>The Label respects Bootstrap 5's dark mode. Set data-bs-theme="dark" on any parent element.
~0.3 KB (min+gzip).
- DatePicker — Date, time, and datetime picker
- SearchSelect — Filterable, searchable select dropdown
- Main README — Package overview, installation, and general info