react-jsonschema-form
react-jsonschema-form copied to clipboard
Why custom UpDownWidget not working for number field?
Prerequisites
- [X] I have read the documentation
What theme are you using?
core
What is your question?
I though a number-typed field would be a UpDownWidget by default, but it seems not. Is it a bug or expected?
Can you please provide an example of this... Bonus points if it is done within our playground
I was using rjsf with Mantine, with code like below:
export function Form({ config }: { config: graphql.Form }) {
return (
<RJSF
widgets={{ UpDownWidget }}
schema={config.schema as any}
uiSchema={config.uiSchema as any}
validator={validator}
/>
);
}
function UpDownWidget(props: WidgetProps) {
return (
<NumberInput
name={props.name}
label={props.label}
required={props.required}
description={props.schema.description}
min={props.schema.minimum}
max={props.schema.maximum}
error={props.rawErrors}
/>
);
}
I would expect a number typed field (like age in playground) would be an UpDownWidget. But I actually had to specify it in uischema with "ui:widget": "updown" to make it happen.