Sign in


Sign up


Bootstrap inputs

MDB provides several form control styles, layout options, and custom components for creating a wide variety of forms.

All of them are created in beautiful, material design style.


Input fields

Basic example

                            
<Input label="Example label" />
                            

Small input

                            
<Input label="Example label" size="sm" />
                            

Icon Prefixes

                
<Input label="Example label" icon="envelope" />
            

Placeholder

                            
<Input label="Example label" hint="placeholder" />
                            

Prefilling Text Inputs

                            
<Input label="Example label" defaultValue="John Doe" />
                            

Disabled input

Add the disabled boolean attribute on an input to prevent user interactions.

                            
<Input label="Example label" disabled />
                            

Form layouts

Since Bootstrap applies display: block and width: 100% to almost all our form controls, forms will by default stack vertically. Additional classes can be used to vary this layout on a per-form basis.

Inline forms:

Use the FormInline component to display a series of labels, form controls, and buttons on a single horizontal row. Form controls within inline forms behave differently:

  • Controls are display: inline-block to provide alignment control via vertical-align and margin.
  • Controls receive width: auto to override the Bootstrap default width: 100%.
  • Controls only appear inline in viewports that are at least 768px wide to account for narrow viewports on mobile devices.

Because of this, you may need to address the width and alignment of individual form controls manually. Lastly, as shown below, you should always include a <label> with each form control.

                            
        <FormInline>
          <Input label="Type your email" icon="envelope" group type="email" />
          <Input label="Type your password" icon="lock" group type="password" />
          <Button>Login</Button>
        </FormInline>
                            

Using the Grid

For more structured form layouts, you can utilize Bootstrap’s predefined grid classes (or mixins). Add the .row class to form groups and use the .col-* classes to specify the width of your labels and controls.

                            
<form>
    <!--First row-->
    <div className="row">
        <!--First column-->
        <div className="col-md-6">
          <Input label="Example label" icon="envelope" />
        </div>

        <!--Second column-->
        <div className="col-md-6">
            <Input label="Example label" icon="lock" />
        </div>
    </div>
    <!--/.First row-->

    <!--Second row-->
    <div className="row">
        <!--First column-->
        <div className="col-md-12">
          <Input type="textarea" label="Basic textarea"/>
        </div>
    </div>
    <!--/.Second row-->

    <!--Third row-->
    <div className="row">

        <!--First column-->
        <div className="col-md-4">
            <Input label="Example label" />
        </div>

        <!--Second column-->
        <div className="col-md-4">
            <Input label="Example label" />
        </div>

        <!--Third column-->
        <div className="col-md-4">
            <Input label="Example label" />
        </div>

    </div>
    <!--/.Third row-->
</form>
                            

Textarea

                
<!--Basic textarea-->
<Input type="textarea" label="Basic textarea"/>

<!--Textarea with icon prefix-->
<Input type="textarea" label="Icon Prefix" icon="pencil"/>