Skip to content

Commit

Permalink
Add story example to illustrate resetting ReactCodeInput 40818419#69 4…
Browse files Browse the repository at this point in the history
  • Loading branch information
acusti committed Oct 15, 2021
1 parent 49b150e commit e84d0d7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/ReactCodeInput.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,16 @@ propVariantStories
)
.add('disabled', () =>
<ReactCodeInput disabled={boolean('disabled', true)} />
);
)
.add('reset', ResetForm);

function ResetForm() {
const [value, setValue] = React.useState(null);

return (
<React.Fragment>
<ReactCodeInput onChange={() => setValue(null)} value={value} />
<button style={{ ...inputStyle, width: 'auto', backgroundColor: 'lightgray' }} onClick={() => setValue('')}>Reset</button>
</React.Fragment>
)
}

0 comments on commit e84d0d7

Please sign in to comment.