mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
feat(web): support min and max value for number input type
This commit is contained in:
@@ -21,10 +21,16 @@ export const debugInput = () => {
|
|||||||
{ value: "option3", label: "Option 3" },
|
{ value: "option3", label: "Option 3" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{ type: "number", label: "Number counter", default: 12 },
|
{
|
||||||
|
type: "number",
|
||||||
|
label: "Number counter",
|
||||||
|
default: 12,
|
||||||
|
min: 3,
|
||||||
|
max: 10,
|
||||||
|
},
|
||||||
{ type: "slider", label: "Slide bar", min: 10, max: 50, step: 2 },
|
{ type: "slider", label: "Slide bar", min: 10, max: 50, step: 2 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
};
|
||||||
|
|||||||
@@ -24,7 +24,12 @@ const NumberField: React.FC<Props> = (props) => {
|
|||||||
return (
|
return (
|
||||||
<Box mb={3}>
|
<Box mb={3}>
|
||||||
<Text>{props.row.label}</Text>
|
<Text>{props.row.label}</Text>
|
||||||
<NumberInput onChange={(val: string) => props.handleChange(+val, props.index)} defaultValue={props.row.default}>
|
<NumberInput
|
||||||
|
onChange={(val: string) => props.handleChange(+val, props.index)}
|
||||||
|
defaultValue={props.row.default}
|
||||||
|
min={props.row.min}
|
||||||
|
max={props.row.max}
|
||||||
|
>
|
||||||
<NumberInputField placeholder={props.row.placeholder} />
|
<NumberInputField placeholder={props.row.placeholder} />
|
||||||
<NumberInputStepper>
|
<NumberInputStepper>
|
||||||
<NumberIncrementStepper />
|
<NumberIncrementStepper />
|
||||||
|
|||||||
Reference in New Issue
Block a user