React component that switches between a "text view" and an "input view" after a click.
Run yarn add react-text-to-input
or npm install react-text-to-input
import TextToInput from "react-text-to-input";
<TextToInput
value={this.state.value}
onChange={this.onChange}
/>
By default, the div
element in "the view mode" has minHeight
set to 20px to prevent the element turning not clickable when value
is empty.
Property | Type | Required |
---|---|---|
value | string | yes |
onChange | (value: string) => void | yes |
textClassName | string | no |
inputClassName | string | no |
textStyle | React.CSSProperties | no |
inputStyle | React.CSSProperties | no |
inputProps | React.HTMLProps | no |
cd example/
yarn start