Closed tarngerine closed 1 year ago
It's not a tested/documented feature yet but the component does have an API similar to the previous version of the component and this includes a .clear()
method. I've made an example here:
Would this suit your needs? The API may change but a method to clear the input will always be included.
Custom input renderers are certainly a possibility, I haven't given it much thought yet but it's certainly possible.
less about custom input renderer, more about making it a controlled input :) but this will work for now. thanks!
I'm going to close this issue now. The input value can be get/set via the API and #36 adds the capability to provide a custom input component and therefore enable full control.
Because the Input component is providing
value
attribute, the default HTML behavior of an<input type="reset">
does not clear the<input type="text">
, since HTML input does not reset when a value attr is provided or set viasetAttribute
.We are able to reset the
selected
prop but we cannot reset the inputvalue
attr as there is no prop to do so.I can see a few ways here:
Input.tsx
to not usevalue
as a prop, but rather auseEffect
that sets the input value imperatively. This allows the standard HTML type="reset" to clear itinput
prop to<ReactTags>
that is passed toInput.tsx
'svalue
for a fully controlled inputThe latter is probably more reacty