BaseTextInput
A text input that provides basic functionality and styling but can be extended or composed to create a wide range of text input variants.
Properties#
className: a className appended to the default classNames.inputProps: (required) Object of props related to the input, they are used to pass properties to the underlyinginputtag or to the input component provided in props (see component property below).type: It is be passed directly to the underlyinginputor alternativecomponent.value: It is be passed directly to the underlyinginputor alternativecomponent.onChange: It is be passed directly to the underlyinginputor alternativecomponent.placeholder: It is be passed directly to the underlyinginputor alternativecomponent.disabled: It is be passed directly to the underlyinginputor alternativecomponent.className: aclassNamestringto append to the default classNames, it is one of the two ways you can style theinput.style: astyleobjectpassed directly to the underlyinginputor alternativecomponent, it is the other way you can style theinput.onFocusChange: afunctioncallback called with argumenttruewhen the underlyinginputor component gets the focus, andfalse, when it loses the focus.
labelProps:objectofpropsrelated to the label, they will be passed to the underlyingControlLabelcomponent. If not provided, theControlLabelwill not be displayed.component: An alternative component to the reactinputtag.children: A ReactNodeor anarrayofNodethat is displayed after theinputin the DOM.
PropTypes#
BaseTextInput#
{ className: string, labelProps: ControlLabel.propTypes, inputProps: shape({ type: string, value: any, onChange: func, placeholder: string, disabled: bool, className: string, style: object, onFocusChange: func, }).isRequired, component: element,}ControlLabel#
{ style: object, text: string, className: string,}Examples#
You can find examples of usage in the components below :
EntityModalTextInput: A classic example of composition, theBaseTextInputis used without thecomponentprop but wrapped in another component to add a text overlay that responds to the input's focus.CollapsibleTextInput: This component usesBaseTextInputbut changes it's coreinputcomponent to another component with specific features when abuttonpassed aschildrenis clicked.