Skip to content

Commit 06ed3a6

Browse files
author
edwardxiao
committed
- add label to textbox
1 parent 29ce19c commit 06ed3a6

File tree

9 files changed

+12
-6
lines changed

9 files changed

+12
-6
lines changed

docs/v4-doc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
|attributesWrapper | Opt | Obj | Modify wrapper general attributes.<br/> **{<br/>id: 'myTextInputWrapperId'<br/>...<br/>}** | {} |
3131
|attributesInput | Opt | Obj | Modify input general attributes. <br/> **{<br/>id: 'myTextInputId',<br/>maxLength: 524288,<br/>name: 'myTextInputName',<br/>type: 'password',<br/>autoComplete: 'On',<br/>placeholder: 'my placeholder text',<br/>...<br/>}** | {} |
3232
|value | Opt | Str | | "" |
33+
|label | Opt | Str | | "" | The content of label
3334
|disabled | Opt | Bool | | false |
3435
|**validate** |**Opt**|**Bool**|**If you have a submit button and trying to validate all the inputs of your form at once, toggle it to true, then it will validate the field and pass the result via the "validationCallback" you provide.**|**false** |
3536
|**validationCallback** |**Opt**|**Func**|**Return the validation result.**|**none** |
@@ -82,6 +83,7 @@ import 'react-inputs-validation/lib/react-inputs-validation.min.css';
8283
placeholder: 'Place your name here ^-^',
8384
}}
8485
value={name} //Optional.[String].Default: "".
86+
label="" // Optional.[String].Default: "". The content of label
8587
disabled={false} //Optional.[Bool].Default: false.
8688
validate={validate} //Optional.[Bool].Default: false. If you have a submit button and trying to validate all the inputs of your form at once, toggle it to true, then it will validate the field and pass the result via the "validationCallback" you provide.
8789
validationCallback={res => this.setState({ hasNameError: res, validate: false })} //Optional.[Func].Default: none. Return the validation result.

example/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,7 @@ class Index extends Component {
848848
placeholder: 'Place your name here ^-^',
849849
}}
850850
value={name} // Optional.[String].Default: "".
851+
label="" // Optional.[String].Default: "". The content of label
851852
disabled={false} // Optional.[Bool].Default: false.
852853
validate={validate} // Optional.[Bool].Default: false. If you have a submit button and trying to validate all the inputs of your form at onece, toggle it to true, then it will validate the field and pass the result via the "validationCallback" you provide.
853854
validationCallback={res => this.setState({ hasNameError: res, validate: false })} // Optional.[Func].Default: none. Return the validation result.

lib/components/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-inputs-validation",
3-
"version": "4.4.5",
3+
"version": "4.4.6",
44
"description": "A react component for form inputs validation.",
55
"main": "index.js",
66
"repository": {

src/js/Inputs/Textbox.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ interface Props {
9292
attributesWrapper?: object;
9393
attributesInput?: AttributesInputObj;
9494
value?: string;
95+
label?: string;
9596
disabled?: boolean;
9697
validate?: boolean;
9798
classNameInput?: string;
@@ -159,6 +160,7 @@ const component: React.FC<Props> = ({
159160
attributesWrapper = {},
160161
attributesInput = {},
161162
value = '',
163+
label = '',
162164
disabled = false,
163165
validate = false,
164166
classNameInput = '',
@@ -463,6 +465,7 @@ const component: React.FC<Props> = ({
463465
ref={$input}
464466
{...attributesInput}
465467
/>
468+
{label && <label>{label}</label>}
466469
</div>
467470
{msgHtml}
468471
</div>

0 commit comments

Comments
 (0)