StudioComponents
StudioComponents copied to clipboard
Add a Numerical Input
Mirror of Studio's numerical input.

API:
Roact.createElement(StudioComponents.NumericalInput, {
Value = self.state.value,
UseSlider = false,
MinimumValue = 0,
MaximumValue = 100,
Interval = 1,
OnChanged = function(newValue)
self:setState({ value = newValue })
end,
-- ...
-- The rest of the API matches with TextInput (Disabled, LayoutOrder, etc).
})
It does not take any children. Opinions?
Looks like a useful component with a sensible API.
Important that we can:
- disable it
- specify the width of the 'number entry' portion when there is a slider present, which would be important when e.g. the field needs to accommodate large numbers
Nice to have:
- choose the side (left/right) that the slider appears on, if present
- 'hot text' (dragging the input area left or right to change the value, as seen here)
More to think about:
- can we incorporate the solution in https://github.com/sircfenner/StudioComponents/pull/13 here to allow customizing this optiona slider? does it matter?
I expect this component could use TextInput and leverage https://github.com/sircfenner/StudioComponents/issues/10.
See NumericInput in v1.x