Skip to content

Commit 557cafe

Browse files
committed
added : value props on Input component
1 parent 5aa2b80 commit 557cafe

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ inputReferance = React.createRef()
351351
referance={inputReferance}
352352
placeholder='Type here...'
353353
multiline={true}
354+
value={inputValue}
354355
rightButtons={<Button color='white' backgroundColor='black' text='Send' />}
355356
/>
356357

@@ -383,7 +384,7 @@ inputClear()
383384
| maxlength | none | int | input or textarea maxlength |
384385
| onMaxLengthExceed | none | function | called when max length exceed |
385386
| autofocus | false | bool | input autofocus |
386-
387+
| value | none | string | input value |
387388
## Button Component
388389

389390
```javascript

src/Input/Input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ const Input: React.FC<IInputProps> = ({
8282
onKeyDown={props.onKeyDown}
8383
onKeyPress={props.onKeyPress}
8484
onKeyUp={props.onKeyUp}
85+
value={props.value}
8586
/>
8687
) : (
8788
<textarea
@@ -102,7 +103,7 @@ const Input: React.FC<IInputProps> = ({
102103
onKeyDown={props.onKeyDown}
103104
onKeyPress={props.onKeyPress}
104105
onKeyUp={props.onKeyUp}
105-
></textarea>
106+
>{props?.value ?? ""}</textarea>
106107
)}
107108
{props.rightButtons && <div className='rce-input-buttons'>{props.rightButtons}</div>}
108109
</div>

src/type.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ export interface IInputProps {
799799
placeholder?: string
800800
defaultValue?: string
801801
inputStyle?: Object
802+
value?: string
802803
onCopy?: React.ClipboardEventHandler
803804
onCut?: React.ClipboardEventHandler
804805
onPaste?: React.ClipboardEventHandler

0 commit comments

Comments
 (0)