A Stepper in mobile UI design is a navigation element that guides users through a multi-step process, typically used for forms or sequential tasks.
For Mobile option, an additional position options can be added Top, Static or Bottom and AutoSwipe to enable auto swiping.
To style step count text, pass Fraction, Dots or Progress options.
For vertical and mobile, you can add Layout type Linear or Absolute
Here are the methods available for Stepper Component.
Examples
Example - Basic stepper
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.main.setChildMargins(0, 0, 0, 0.02)
var steps = ["Step 1", "Step 2", "Step 3"]
this.stp = ui.addStepper(this.main, steps, "", 0.6)
this.btnBack = ui.addButton(this.main, "Back", "Raised,Primary")
this.btnBack.setOnTouch( this.back )
this.btnNext = ui.addButton(this.main, "Next", "Raised,Primary")
this.btnNext.setOnTouch( this.next )
}
next()
{
this.stp.nextStep()
}
back()
{
this.stp.previousStep()
}
}
from hybrid import ui
def OnStart():
global stp
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
main.setChildMargins(0, 0, 0, 0.02)
steps = ["Step 1", "Step 2", "Step 3"]
stp = ui.addStepper(main, steps, "", 0.6)
btnBack = ui.addButton(main, "Back", "Raised,Primary")
btnBack.setOnTouch(back)
btnNext = ui.addButton(main, "Next", "Raised,Primary")
btnNext.setOnTouch(next)
def next(event):
stp.nextStep()
def back(event):
stp.previousStep()
Example - Vertical stepper
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
var steps = ["Step 1", "Step 2", "Step 3"]
this.stp = ui.addStepper(this.main, steps, "Vertical", 0.5, 0.6)
var step1Lay = this.stp.getLayout( 0 )
step1Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step1Lay, "This is a text content on step 1")
var btnStep1Next = ui.addButton(step1Lay, "Next", "Raised,Primary")
btnStep1Next.setOnTouch( this.next )
var step2Lay = this.stp.getLayout( 1 )
step2Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step2Lay, "This is a text content on step 2")
var btnStep2Next = ui.addButton(step2Lay, "Next", "Raised,Primary")
btnStep2Next.setOnTouch( this.next )
var step3Lay = this.stp.getLayout( 2 )
step3Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step3Lay, "This is a text content on step 3")
var btnStep3Next = ui.addButton(step3Lay, "Next", "Raised,Primary")
btnStep3Next.setOnTouch( this.next )
}
next()
{
this.stp.nextStep()
}
back()
{
this.stp.previousStep()
}
}
from hybrid import ui
def OnStart():
global stp
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
steps = ["Step 1", "Step 2", "Step 3"]
stp = ui.addStepper(main, steps, "Vertical", 0.5, 0.6)
step1Lay = stp.getLayout(0)
step1Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step1Lay, "This is a text content on step 1")
btnStep1Next = ui.addButton(step1Lay, "Next", "Raised,Primary")
btnStep1Next.setOnTouch(next)
step2Lay = stp.getLayout(1)
step2Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step2Lay, "This is a text content on step 2")
btnStep2Next = ui.addButton(step2Lay, "Next", "Raised,Primary")
btnStep2Next.setOnTouch(next)
step3Lay = stp.getLayout(2)
step3Lay.setChildMargins(0, 0.005, 0, 0.005)
ui.addText(step3Lay, "This is a text content on step 3")
btnStep3Next = ui.addButton(step3Lay, "Next", "Raised,Primary")
btnStep3Next.setOnTouch(next)
def next(event):
stp.nextStep()
def back():
stp.previousStep()
Example - Mobile Stepper
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
var steps = ["Step 1", "Step 2", "Step 3"]
var img1 = "https://images.unsplash.com/photo-1537944434965-cf4679d1a598?auto=format&fit=crop&w=400&h=250&q=60"
var img2 = "https://images.unsplash.com/photo-1538032746644-0212e812a9e7?auto=format&fit=crop&w=400&h=250&q=60"
var img3 = "https://images.unsplash.com/photo-1537996194471-e657df975ab4?auto=format&fit=crop&w=400&h=250&q=80"
this.stp = ui.addStepper(this.main, steps, "mobile", 0.6, 0.7)
this.lay1 = this.stp.getLayout( 0 )
ui.addImage(this.lay1, img1, "", 1, 1)
this.lay2 = this.stp.getLayout( 1 )
ui.addImage(this.lay2, img2, "", 1, 1)
this.lay3 = this.stp.getLayout( 2 )
ui.addImage(this.lay3, img3, "", 1, 1)
this.stp.setOnChange( this.onChange )
}
onChange( index )
{
ui.showPopup( "Layout index " + index )
}
}
from hybrid import ui
def OnStart():
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
steps = ["Step 1", "Step 2", "Step 3"]
img1 = "https://images.unsplash.com/photo-1537944434965-cf4679d1a598?auto=format&fit=crop&w=400&h=250&q=60"
img2 = "https://images.unsplash.com/photo-1538032746644-0212e812a9e7?auto=format&fit=crop&w=400&h=250&q=60"
img3 = "https://images.unsplash.com/photo-1537996194471-e657df975ab4?auto=format&fit=crop&w=400&h=250&q=80"
stp = ui.addStepper(main, steps, "mobile", 0.6, 0.7)
lay1 = stp.getLayout(0)
ui.addImage(lay1, img1, "", 1, 1)
lay2 = stp.getLayout(1)
ui.addImage(lay2, img2, "", 1, 1)
lay3 = stp.getLayout(2)
ui.addImage(lay3, img3, "", 1, 1)
stp.setOnChange(onChange)
def onChange(index):
ui.showPopup("Layout index " + str(index))
Example - Autoswipe and Fraction Mobile Stepper
class Main extends App
{
onStart()
{
ui.setTheme("dark")
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
var steps = ["Step 1", "Step 2", "Step 3"]
var img1 = "https://images.unsplash.com/photo-1537944434965-cf4679d1a598?auto=format&fit=crop&w=400&h=250&q=60"
var img2 = "https://images.unsplash.com/photo-1538032746644-0212e812a9e7?auto=format&fit=crop&w=400&h=250&q=60"
var img3 = "https://images.unsplash.com/photo-1537996194471-e657df975ab4?auto=format&fit=crop&w=400&h=250&q=80"
this.stp = ui.addStepper(this.main, steps, "mobile,autoswipe,fraction", 0.6)
this.lay1 = this.stp.getLayout( 0 )
ui.addImage(this.lay1, img1, "", 1)
this.lay2 = this.stp.getLayout( 1 )
ui.addImage(this.lay2, img2, "", 1)
this.lay3 = this.stp.getLayout( 2 )
ui.addImage(this.lay3, img3, "", 1)
this.stp.setOnChange( this.onChange )
}
onChange( index )
{
ui.showPopup( "Layout index " + index )
}
}
from hybrid import ui
def OnStart():
ui.setTheme("dark")
main = ui.addLayout("main", "Linear", "VCenter,FillXY")
steps = ["Step 1", "Step 2", "Step 3"]
img1 = "https://images.unsplash.com/photo-1537944434965-cf4679d1a598?auto=format&fit=crop&w=400&h=250&q=60"
img2 = "https://images.unsplash.com/photo-1538032746644-0212e812a9e7?auto=format&fit=crop&w=400&h=250&q=60"
img3 = "https://images.unsplash.com/photo-1537996194471-e657df975ab4?auto=format&fit=crop&w=400&h=250&q=80"
stp = ui.addStepper(main, steps, "mobile,autoswipe,fraction", 0.6)
lay1 = stp.getLayout(0)
ui.addImage(lay1, img1, "", 1)
lay2 = stp.getLayout(1)
ui.addImage(lay2, img2, "", 1)
lay3
Properties
The following properties are available on the Stepper object:
Methods
The following methods are available on the Stepper object:
Number: Fraction of the parent width `[0-1]`.
Number: Fraction of the parent height `[0-1]`.
Number: The time in milliseconds.
Number: The z-index. A negative value behaves like `sendBackward` method.
Number: The index of the corresponing stepper layout
Number: The index of the step to remove.
Number: The z-index. A positve value behaves like `bringForward` method.
Number: Border-left thickness in pixels.
Number: Border-top thickness in pixels.
Number: Border-right thickness in pixels.
Number: Border-bottom thickness in pixels.
Number: Top-Left border radius.
Number: Top-Right border radius.
Number: Bottom-Right border radius.
Number: Bottom-Left border radius.
Number: Left margin. You can also pass string e.g. `12rem`
Number: Top margin. You can also pass string e.g. `12rem`
Number: Right margin. You can also pass string e.g. `12rem`
Number: Bottom margin. You can also pass string e.g. `12rem`
Number: Fraction of the component width.
Number: Fraction of the component height. [0-1]
Number: Fraction of the component width. [0-1]
Number: Fraction of the parent width. [0-1]
Number: Fraction of the parent height. [0-1]
Number: The x-scale of the component.Values less than `0` is smaller than the normal. While values greater than `1` is greater than the normal.
Number: The y-scale of the component. Values less than `1` is smaller than the normal. While vaues greater than `1` is greater than the normal.
Number: The index of the Stepper.
String: “A comma separated options.
`Vertical`”, “ `Horizontal`”, “ `Loop`”, “ `Mobile`”, “ `AlternativeLabel`.”
String: “The type of animation. Here are the available values
`bounce`”, “ `flash`”, “ `pulse`”, “ `rubberBand`”, “ `shakeX`”, “ `shakeY`”, “ `headShake`”, “ `swing`”, “ `tada`”, “ `wobble`”, “ `jello`”, “ `heartBeat`”, “
Back Entrances: `backInDown`”, “ `backInLeft`”, “ `backInRight`”, “ `backInUp`
Back Exits: `backOutDown`”, “ `backOutLeft`”, “ `backOutRight`”, “ `backOutUp`
Bouncing Entrances: `bounceIn`”, “ `bounceInDown`”, “ `bounceInLeft`”, “ `bounceInRight`”, “ `bounceInUp`
Bouncing exits: `bounceOut`”, “ `bounceOutDown`”, “ `bounceOutLeft`”, “ `bounceOutRight`”, “ `bounceOutUp`
Fading entrances: `fadeIn`”, “ `fadeInDown`”, “ `fadeInDownBig`”, “ `fadeInLeft`”, “ `fadeInLeftBig`”, “ `fadeInRight`”, “ `fadeInRightBig`”, “ `fadeInUp`”, “ `fadeInUpBig`”, “ `fadeInTopLeft`”, “ `fadeInTopRight`”, “ `fadeInBottomLeft`”, “ `fadeInBottomRight`
Fading exits: `fadeOut`”, “ `fadeOutDown`”, “ `fadeOutDownBig`”, “ `fadeOutLeft`”, “ `fadeOutLeftBig`”, “ `fadeOutRight`”, “ `fadeOutRightBig`”, “ `fadeOutUp`”, “ `fadeOutUpBig`”, “ `fadeOutTopLeft`”, “ `fadeOutTopRight`”, “ `fadeOutBottomRight`”, “ `fadeOutBottomLeft`
Flippers: `flip`”, “ `flipInX`”, “ `flipInY`”, “ `flipOutX`”, “ `flipOutY`
Lightspeed: `lightSpeedInRight`”, “ `lightSpeedInLeft`”, “ `lightSpeedOutRight`”, “ `lightSpeedOutLeft`
Rotating Entrances: `rotateIn`”, “ `rotateInDownLeft`”, “ `rotateInDownRight`”, “ `rotateInUpLeft`”, “ `rotateInUpRight`
Rotating Exits: `rotateOut`”, “ `rotateOutDownLeft`”, “ `rotateOutDownRight`”, “ `rotateOutUpLeft`”, “ `rotateOutUpRight`
Specials: `hinge`”, “ `jackInTheBox`”, “ `rollIn`”, “ `rollOut`
Zooming Entrances: `zoomIn`”, “ `zoomInDown`”, “ `zoomInLeft`”, “ `zoomInRight`”, “ `zoomInUp`
Zooming Exits: `zoomOut`”, “ `zoomOutDown`”, “ `zoomOutLeft`”, “ `zoomOutRight`”, “ `zoomOutUp`
Sliding Entrances: `slideInDown`”, “ `slideInLeft`”, “ `slideInRight`”, “ `slideInUp`
Sliding Exits: `slideOutDown`”, “ `slideOutLeft`”, “ `slideOutRight`”, “ `slideOutUp`”
String: “The mode of the measurements. Values can be `px` or `%`”
String: “Border color in hexadecimal format `#rrggbb`.”
String: “Border-styles. Values can be `dotted`”, “ `dashed`”, “ `solid`”, “ `double`”, “ `groove`”, “ `ridge`”, “ `inset` and `outset`. Default is `solid`”
String: “Unit of measurement. Values are `px` `rem` or `%`.”
String: “Unit of measurement.
`rem` for root em.
`px` for pixels
`%` relative to its parent dimension.
`v` relative to viewport dimension.”
String: “Unit of measurement.
`rem` for root em.
`px` for pixels
`%` relative to its parent dimensions
`v` relative to viewport dimensions.”
String: “Unit of measurment. Can be "px"”, “ "rem"”, “ "%"”, “ "v" for viewport width/height or any css supported unit.”
String: “The new title text.”
Object: The parent layout of the Stepper.
Object: The layout to check.
Object: The pointer event object.
List: An array of titles.
function()
stp.absHeight
Returns the absolute height of the control in pixels.
stp.absLeft
Returns the absolute distance of the control from the left in pixels.
stp.absTop
Returns the absolute distance of the control from the top in pixels.
stp.absWidth
Returns the absolute width of the control in pixels.
stp.activeStep
Sets or returns the active step.
stp.animate
Animate the component.
stp.backColor
A hexadecimal color of the form #rrggbb
stp.backImage
The path to your image file.
stp.border
Sets or returns the border thickness in pixels.
stp.borderColor
Sets or returns the border color. Color is in hexadecimal form #rrggbb
stp.borderStyle
Sets or returns the border style. Values can be dotted, dashed, solid, double, groove, ridge, inset and outset. Default is solid.
stp.bringForward
Bring this component forward by a given z-index.
stp.cornerRadius
Sets or returns the corner radius in pixels.
stp.destroy
Destroy the component.
stp.disabled
Sets or returns the disabled state of the control.
stp.el
Returns the html container element for the control.
stp.elevation
Sets or returns the elevation of the mobile stepper. Value ranges from 0 to 24.
stp.elStyle
Sets the style of the html container element.
stp.fontFile
Sets or returns the relative path to the font-family use.
stp.getLayout
Returns the layout of the corresponding step layout where you can add controls.
stp.getLayoutIndex
Get the index of the corresponding layout.
stp.getPosition
Returns the position of the component. The return object is of the form {left, top, right, bottom}
stp.gone
Destroy the component.
stp.height
Sets or returns the height of the control as a fraction of the parent control.
stp.hide
Hide the component.
stp.isVisible
Returns whether the control is visible or not.
stp.left
Returns the distance of the control from the left.
stp.margins
Sets or returns the margin of the control. Works on controls with Linear parent only. You can also pass a number to set equal margins for all sides.
stp.nextStep
Go to the next step.
stp.opacity
Sets or returns the opacity of the control.
stp.options
Sets or returns the options of the control.
stp.orientation
Sets or returns the orientation of the Stepper. Values can be Horizontal or Vertical.
stp.padding
Sets or returns the padding of the control. You can also pass a number to set equal padding for all sides.
stp.parent
Returns the parent layout control.
stp.position
Returns the position of the control. The returned object has left top right and bottom props.
stp.previousStep
Go to the previous step.
stp.removeStep
Removes a corresponding step by its index.
stp.rotation
Sets or returns the angle of rotation in degrees.
stp.sendBackward
Bring this component backward by a given z-index.
stp.setBorder
Sets the border line for the component container.
stp.setCornerRadius
Sets the corner radius of the component.
stp.setMargins
Sets the margin of the component.
stp.setOnChange
Adds a callback function to be called when the stepper has changed step.
stp.setOnComplete
Adds a callback function to be called when the stepper is complete. For mobile stepper, callback will be called upon showing the last step.
stp.setOnContextMenu
Adds a callback function on right click.
stp.setPadding
Sets the padding of the component's container.
stp.setPosition
Sets the position of the component relative to its parent dimensions.
stp.setScale
Sets the x and y scaling of the component. This will ignore the positioning and flow of controls in the layout.
stp.setSize
Sets the size of the component.
stp.setTitleText
Sets a new title for the corresponding step by its index.
stp.show
Show the component.
stp.textColor
Sets or returns the color of the text.
stp.textSize
Sets or returns the size of the text within the control.
stp.top
Returns the distance of the control from the top.
stp.type
Returns the type of the control.
stp.visibility
Sets or returns the visibility of the control.
stp.width
Sets or returns the width of the control as a fraction of the parent control.