Input

Input

Angular Bootstrap Input is a special field which is used in order to receive data from the user. Used mostly in a variety of web-based forms. You can use material design version or default bootstrap style.

Default Input Types

Default Input example.

image info

html
<CDBInput id="username" label="Username"></CDBInput>
<CDBInput hint="Your e-mail" type="email"></CDBInput>
<CDBInput type="number"></CDBInput>
<CDBInput [material]=true type="text"></CDBInput>
<CDBInput [background]=true type="text"></CDBInput>
<CDBInput type="checkbox"></CDBInput>
<CDBInput class="mt-5" type="textarea"></CDBInput>

Input Sizing

image info

html
<CDBInput label="Your e-mail" type="email" size="sm"></CDBInput>
<CDBInput type="number" label="Your Number" size="lg"></CDBInput>

Input with icons

image info

html
<CDBInput label="Username" type="text" icon="user"></CDBInput>
<CDBInput label="Password" type="password" icon="bell"></CDBInput>

Input with MD

image info

html
<CDBInput [material]=true label="Your e-mail" type="email"></CDBInput>
<CDBInput [material]=true type="number" label="Your Number"></CDBInput>

Placeholder

image info

html
<CDBInput hint="Your e-mail" type="email"></CDBInput>
<CDBInput type="number" hint="Your Number"></CDBInput>

Disabled Inputs

image info

html
<CDBInput hint="Your e-mail" type="email" [disabled]=true></CDBInput>
<CDBInput type="number" hint="Your Number" [disabled]=true></CDBInput>

Textarea

image info

html
<CDBInput label="Your name" type="textarea"></CDBInput>
<CDBInput label="Your story" type="textarea" [material]=true rows=20 cols=30></CDBInput>

Background

image info

html
<CDBInput hint="Your e-mail" type="email" [background]=true></CDBInput>
<CDBInput type="number" hint="Your Number" [background]=true></CDBInput>

API

Here in this section you will find information about required modules and available inputs, outputs, methods and events of this component.

Contrast Input Bootstrap Modules used

import {InputModule } from 'cdbangular';

API Reference: Contrast Input Inputs

The table below shows the possible input of the Input component.

NameTypeDefaultDescriptionExample
classStringAdds custom classesclass="myClass"
containerClassStringAdds custom class to wrapping divcontainerClass="wrapper"
errorStringSets the error message for the labels data-error attributeerror="Ouch!"
hintStringSets the placeholder for the Inputhint="Placeholder"
valueNumber, Boolean or StringThe value of the input element (use with the controlled input)value="I am controlled" onChange={this.handleChange}
materialBooleanfalseChanges component styles for material themematerial=true
valueDefaultNumber or StringThe default value of the input (use with the uncontrolled input)valueDefault="I am uncontrolled"
idStringRequired! Set the id of the input elementid="myId"
labelStringAdd label to the component; you can attach jsx elements (f.e. links)label="My custom input"
labelClassStringAdd custom class to labellabelClass="My custom label class"
labelIdStringSets custom id to labellabelId="myId"
sizeStringlgChanges size of the component; available lg and smsize="lg"
successStringSets the success message for the labels data-success attributesuccess="Great!"
typeStringtextThe type of the input elementtype="checkbox"
inputRefObject or functionAllows to attach Angular Ref to the input component; accepts only Callback RefinputRef={ref => this.myRef = ref }
iconStringAdds font awesome iconicon="caret-right"
iconBrandStringUse this property to set brand icon (fab)icon="twitter" iconBrand=true
iconLightStringUse this property to set light icon (fal)icon="twitter" iconLight=true
iconRegularStringUse this property to set regular icon (far)icon="twitter" iconRegular=true
iconClassStringAdds custom classes to icon elementicon="caret-right" iconClass="my-class"
disableBooleanfalseDisables Input componentdisabled=true
groupBooleanfalseAdd .form-group class to the wrapping diverror=true
filledBooleanfalseAdd filled-in style to checkbox/radio buttontype="checkbox" filled=true
validateBooleanfalseAdds .validate class to the Input componentvalidate=true
gapBooleanfalseCreates gap inside checkbox/radio buttontype="checkbox" gap=true