Skip to content

Commit e84d0d7

Browse files
committed
Add story example to illustrate resetting ReactCodeInput 40818419#69 40818419#129
1 parent 49b150e commit e84d0d7

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/ReactCodeInput.stories.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,16 @@ propVariantStories
117117
)
118118
.add('disabled', () =>
119119
<ReactCodeInput disabled={boolean('disabled', true)} />
120-
);
120+
)
121+
.add('reset', ResetForm);
122+
123+
function ResetForm() {
124+
const [value, setValue] = React.useState(null);
125+
126+
return (
127+
<React.Fragment>
128+
<ReactCodeInput onChange={() => setValue(null)} value={value} />
129+
<button style={{ ...inputStyle, width: 'auto', backgroundColor: 'lightgray' }} onClick={() => setValue('')}>Reset</button>
130+
</React.Fragment>
131+
)
132+
}

0 commit comments

Comments
 (0)