Input group
React Bootstrap 5 Input group component
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
Basic example
Place one add-on or button on either side of an input. You may also place one on both sides of
an input. Remember to place <label>
s outside the input group.
Wrapping
Input groups wrap by default via flex-wrap: wrap
in order to accommodate custom
form field validation within an input group. You may disable this with
noWrap
.
Sizing
Add the relative form sizing props to the MDBInputGroup
itself and contents
within will automatically resize—no need for repeating the form control size classes on each
element.
No border
Add noBorder
prop to the MDBInputGroupText
to remove the border.
Checkboxes and radios
Place any checkbox or radio option within an input group’s addon instead of text.
Multiple inputs
While multiple <input>
s are supported visually, validation styles are only
available for input groups with a single <input>
.
Multiple addons
Multiple add-ons are supported and can be mixed with checkbox and radio input versions.
File input
Input group - API
Import
Properties
MDBInputGroup
Name | Type | Default | Description | Example |
---|---|---|---|---|
noBorder
|
boolean | false |
Disables flex: wrap; style in the MDBInputGroup |
<MDBInputGroup noWrap />
|
noWrap
|
boolean | false |
Disables flex: wrap; style in the MDBInputGroup |
<MDBInputGroup noWrap />
|
size
|
string | '' |
Set size of the MDBInputGroup |
<MDBInputGroup size="lg" />
|
tag
|
string | 'div' |
Defines tag of the MDBInputGroup element |
<MDBInputGroup tag="section" />
|
textTag
|
string | 'span' |
Defines tag of the MDBInputGroup text element |
<MDBInputGroup textTag="section" />
|
textClass
|
string | '' |
Add custom class to the MDBInputGroup text element |
<MDBInputGroup textClass='class' />
|
textBefore
|
React.ReactNode | React.ReactNode[] | '' |
Element/Elements inserted before the input |
<MDBInputGroup textBefore='test' />
|
textAfter
|
React.ReactNode | React.ReactNode[] | '' |
Element/Elements inserted after the input |
<MDBInputGroup textAfter='test' />
|
textProps
|
Record<string, unknown/> | undefined |
Custom properties to the text element |
<MDBInputGroup textProps={customProps} />
|