Skip to content

Stepper

A Stepper is a two-segment control that people use to increase or decrease an incremental value.

Component preview

Summary

Properties

Property Type Description
Minimum number? The minimum value the stepper can drop.
Maximum number? The maximum value the stepper can reach.
Step number? The increment to increase by on increase/decrease.
Fielded boolean? Whether the stepper should be attached to a editable field. Defaults to false.
Value number? The stepper's current value.

View all inherited from BaseComponent

View all inherited from ImageLabel

Methods

Method Signature Description
Increment () -> nil This increments the Value of the stepper by the given step number.
Decrement () -> nil This decrements the Value of the stepper by the given step number.

View all inherited from ImageLabel

Events

Event Signature Description
ValueChanged ((self: Stepper, value: number) -> unknown)? A Callback function that is triggered when the Value property has been modified.

View all inherited from ImageLabel

Types

type StepperProperties = ImageLabel & {
    Minimum: number?,
    Maximum: number?,
    Step: number?,
    Fielded: boolean?,
    Value: number?,
    ValueChanged: ((self: Stepper, value: number) -> unknown)?,
}

type Stepper = BaseComponent & Components & StepperProperties & {
    Increment: () -> nil,
    Decrement: () -> nil,
}

Function Signature

function(self, properties: StepperProperties): Stepper

Example

local stepper = row:Right():Stepper({
    Minimum = 0,
    Maximum = 5,
    Step = 0.1,
    Fielded = true,
    Value = 3,
    ValueChanged = function(self, value: number)
        print("Value changed:", value)
    end,
})

print(stepper:IsA("ImageLabel")) --> true
print(stepper.ClassName) --> "ImageLabel"
print(stepper.Type) --> "Stepper"

stepper:Increment() --> Value changed: 3.01
stepper.Value += 1 --> Value changed: 4.01