StudioComponents icon indicating copy to clipboard operation
StudioComponents copied to clipboard

Add a Numerical Input

Open u-train opened this issue 3 years ago • 1 comments

Mirror of Studio's numerical input. image

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?

u-train avatar Jun 01 '22 22:06 u-train

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.

sircfenner avatar Jun 14 '22 15:06 sircfenner

See NumericInput in v1.x

sircfenner avatar Apr 30 '24 22:04 sircfenner