- Basic Usage
- Prop Table
import { TextField } from '@duik/it'import TextField from '@duik/text-field'<TextField defaultValue="Default text" /><div class="form-group"> <div class="input-group"> <input type="text" class="form-control" value="Default text" /> </div> </div> ReactHTML Snippet | |
<TextField label="Label" placeholder="Write Something" /><div class="form-group"> <label>Label</label> <div class="input-group"> <input type="text" class="form-control" placeholder="Write Something" /> </div> </div> ReactHTML Snippet | |
There is a problem | <TextField
errorMessage="There is a problem"
label="Label"
placeholder="Write Something"
/><div class="form-group"> <label>Label</label> <div class="input-group is-invalid"> <input type="text" class="form-control" placeholder="Write Something" /> </div> <div class="invalid-feedback">There is a problem</div> </div> ReactHTML Snippet |
It's ok! | <TextField
label="Label"
placeholder="Write Something"
successMessage="It's ok!"
/><div class="form-group"> <label>Label</label> <div class="input-group is-valid"> <input type="text" class="form-control" placeholder="Write Something" /> </div> <div class="valid-feedback">It&#x27;s ok!</div> </div> ReactHTML Snippet |
search_left | <TextField
label="Label"
leftEl={<Icon>search_left</Icon>}
placeholder="Write Something"
/><div class="form-group"> <label>Label</label> <div class="input-group"> <div class="input-group-prepend"> <i class="uikon">search_left</i> </div> <input type="text" class="form-control" placeholder="Write Something" /> </div> </div> ReactHTML Snippet |
search_left | <TextField
label="Label"
placeholder="Write Something"
rightEl={<Icon>search_left</Icon>}
/><div class="form-group"> <label>Label</label> <div class="input-group"> <input type="text" class="form-control" placeholder="Write Something" /> <div class="input-group-append"> <i class="uikon">search_left</i> </div> </div> </div> ReactHTML Snippet |
search_left | <TextField
disabled
label="Label"
placeholder="Write Something"
rightEl={<Icon>search_left</Icon>}
/><div class="form-group"> <label>Label</label> <div class="input-group"> <input type="text" class="form-control" disabled="" placeholder="Write Something" /> <div class="input-group-append"> <i class="uikon">search_left</i> </div> </div> </div> ReactHTML Snippet |
<TextField label="Label" placeholder="Write Something" readOnly /><div class="form-group"> <label>Label</label> <div class="input-group"> <input type="text" class="form-control" readonly="" placeholder="Write Something" /> </div> </div> ReactHTML Snippet | |
<TextField clear placeholder="Write Something" /><div class="form-group"> <div class="input-group input-group-clear"> <input type="text" class="form-control" placeholder="Write Something" /> </div> </div> ReactHTML Snippet | |
search_left | <TextField
clear
leftEl={<Icon>search_left</Icon>}
placeholder="Write Something"
/><div class="form-group"> <div class="input-group input-group-clear"> <div class="input-group-prepend"> <i class="uikon">search_left</i> </div> <input type="text" class="form-control" placeholder="Write Something" /> </div> </div> ReactHTML Snippet |
search_left | <TextField
clear
placeholder="Write Something"
rightEl={<Icon>search_left</Icon>}
/><div class="form-group"> <div class="input-group input-group-clear"> <input type="text" class="form-control" placeholder="Write Something" /> <div class="input-group-append"> <i class="uikon">search_left</i> </div> </div> </div> ReactHTML Snippet |
| className | Required: false |
| type: string | |
| className, e.g. "my-custom-styling" |
| label | Required: false |
| type: string | |
| Label text. Ideally you should pass "id" as well, TextField will automatically connect the label with "for" |
| clear | Required: false |
| type: boolean | |
| Renders without borders. |
| errorMessage | Required: false |
| type: React.ReactNode | |
| Displays error message and renders input in error state. |
| successMessage | Required: false |
| type: React.ReactNode | |
| Displays success message and renders input in success state. |
| leftEl | Required: false |
| type: React.ReactNode | |
| Displayes content on left side of the input, e.g. icon |
| rightEl | Required: false |
| type: React.ReactNode | |
| Displayes content on right side of the input, e.g. icon |
| wrapperProps | Required: false |
| type: Props of "div" | |
| Pass down properties to the element that wraps the input and icons. |
| noWrap | Required: false |
| type: boolean | |
| When multiple elements are rendered, e.g. providing a label, the component will wrap the content with a FormGroup component for mroe consistent UI. pass noWrap={false} to disable the default behaviour. |
| ...rest | Required: false |
| type: any | |
| Other properties are passed down to the input element |