Adds a bottom navigation bar to your app.
An example of a navs array.
var navs = [
[ "Favorites", "favorites" ],
[ "Groups", "person" ],
[ "Folder", "folder" ]
]
### Properties
These are the setter and getter properties for the addBottomNavbar Component.
Example - Sample navs array.
var navs = [
[ "Favorites", "favorites" ],
[ "Groups", "person" ],
[ "Folder", "folder" ]
]
from native import cfg
navs = [
["Favorites", "favorites"],
["Groups", "person"],
["Folder", "folder"]
]
Example - Basic
class Main extends App
{
onStart()
{
this.main = ui.addLayout( "main", "Linear", "VCenter", 1, 1 )
this.main.setChildMargins( 0.01, 0.01, 0.01, 0.01 )
var navs = [
[ "Favorites", "favorites" ],
[ "Groups", "person" ],
[ "Folder", "folder" ]
]
this.bmn = ui.addBottomNavbar(this.main, navs, "", 1)
this.bmn.setOnChange( this.onChange )
}
onChange(text, index)
{
ui.showPopup( text )
}
}
from hybrid import ui
def OnStart():
main = ui.addLayout("main", "Linear", "VCenter", 1, 1)
main.setChildMargins(0.01, 0.01, 0.01, 0.01)
navs = [
["Favorites", "favorites"],
["Groups", "person"],
["Folder", "folder"]
]
bmn = ui.addBottomNavbar(main, navs, "", 1)
bmn.setOnChange(onChange)
def onChange(text, index):
ui.showPopup(text)
Example - Hide or show labels
class Main extends App
{
onStart()
{
this.main = ui.addLayout( "main", "Linear", "VCenter", 1, 1 )
this.main.setChildMargins( 0.01, 0.01, 0.01, 0.01 )
var navs = [
[ "Favorites", "favorites" ],
[ "Groups", "person" ],
[ "Folder", "folder" ]
]
this.bmn = ui.addBottomNavbar(this.main, navs, "", 1)
this.bmn.setOnChange( this.onChange )
this.btn = ui.addButton(this.main, "Show Labels")
this.btn.setOnTouch( this.showLabels )
this.btn1 = ui.addButton(this.main, "Hide Labels")
this.btn1.setOnTouch( this.hideLabels )
}
showLabels( )
{
this.bmn.showLabels()
}
hideLabels()
{
this.bmn.hideLabels()
}
onChange(text, index)
{
ui.showPopup( text )
}
}
from hybrid import ui
def OnStart():
global bmn
main = ui.addLayout("main", "Linear", "VCenter", 1, 1)
main.setChildMargins(0.01, 0.01, 0.01, 0.01)
navs = [
["Favorites", "favorites"],
["Groups", "person"],
["Folder", "folder"]
]
bmn = ui.addBottomNavbar(main, navs, "", 1)
bmn.setOnChange(onChange)
btn = ui.addButton(main, "Show Labels")
btn.setOnTouch(showLabels)
btn1 = ui.addButton(main, "Hide Labels")
btn1.setOnTouch(hideLabels)
def showLabels(event):
bmn.showLabels()
def hideLabels(event):
bmn.hideLabels()
def onChange(text, index):
ui.showPopup(text)
Example - Custom styles
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter", 1, 1)
var navs = [
[ "Favorites", "favorites" ],
[ "Groups", "person" ],
[ "Folder", "folder" ]
]
this.bmn = ui.addBottomNavbar(this.main, navs, "", 1)
this.bmn.labels = false
this.bmn.textColor = "#673ab7"
this.bmn.iconColor = "#673ab7"
this.bmn.iconSize = "2rem"
}
}
from hybrid import ui
def OnStart():
main = ui.addLayout("main", "Linear", "VCenter", 1, 1)
navs = [
["Favorites", "favorites"],
["Groups", "person"],
["Folder", "folder"]
]
bmn = ui.addBottomNavbar(main, navs, "", 1)
bmn.labels = False
bmn.textColor = "#673ab7"
bmn.iconColor = "#673ab7"
bmn.iconSize = "2rem"
Methods
The following methods are available on the BottomNavbar object:
Boolean: Values can be `true` or `false`.
Boolean: Values can be `true` or `false`
Boolean: Sets or returns whether the bottom navigation is disabled or enabled. All navigation actions must be disabled to return true. Otherwise, it will return false.
Boolean: Returns whether the control is visible or not.
Boolean: Sets or returns a boolean whether the labels are shown or hidden on active state.
Number: Fraction of the screen width. [0-1]
Number: Fraction of the screen height. [0-1]
Number: The index in which to add the action.
Number: The time in milliseconds.
Number: The z-index. A negative value behaves like `sendBackward` method.
Number: The index of the navigation action.
Number: The index of the navigation action to be remove
Number: The index of the bottom navigation action to be selected
Number: The z-index. A positve value behaves like `bringForward` method.
Number: Border-left thickness in pixels.
Number: Top-Left border radius in pixels.
Number: Top-Right border radius in pixels.
Number: Bottom-Left border radius in pixels.
Number: Bottom-Right border radius in pixels.
Number: The index of the navigation action to update
Number: The index to update
Number: Fraction of the parent width.
Number: Fraction of the parent height.
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: 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: Fraction of the parent height. [0-1]
Number: Returns the absolute height of the control in pixels.
Number: Returns the absolute distance of the control from the left in pixels.
Number: Returns the absolute distance of the control from the top in pixels.
Number: Returns the absolute width of the control in pixels.
Number: Sets or returns the border thickness in pixels.
Number: Sets or returns the corner radius in pixels.
Number: Sets or returns the height of the control as a fraction of the parent control.
Number: Sets or returns the icon font-size. You can also pass string values such as 1.2rem or 18px.
Number: Returns the distance of the control from the left.
Number: Sets or returns the opacity of the control.
Number: Sets or returns the angle of rotation in degrees.
Number: Sets or returns the size of the text within the control.
Number: Returns the distance of the control from the top.
Number: Sets or returns the current value of the BottomNavbar. This is the index of the corresponding selected action.
Number: Sets or returns the width of the control as a fraction of the parent control.
String: comma “,” separated: “one or a combination of the following: `Hidelabels`”
String: “The name of the navigation action”
String: “Material icon”
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 name of the bottom navigation action.”
String: “The mode of the measurements. Values can be `px` or `%`”
String: “The name of the navigation action to be remove.”
String: “The name to be set to active”
String: “Border color in hexadecimal form `#rrggbb`”
String: “Border-styles. Values can be `dotted` `dashed` `solid` `double` `groove` `ridge` `inset` and `outset`. Default is `solid`”
String: “Unit. Values are `px` `rem` or `%`.”
String: “`px` or `%`”
String: “The size thickness mode. Can be `px`”
String: “Unit of measurement. Can be `px` or `%` or any css unit of measurement.”
String: A hexadecimal color of the form #rrggbb
String: The path to your image file.
String: Sets or returns the border color. Color is in hexadecimal form #rrggbb
String: Sets or returns the border style. Values can be dotted, dashed, solid, double, groove, ridge, inset and outset. Default is solid.
String: Sets or returns the relative path to the font-family use.
String: Sets or returns the icon color. You can pass color in a hexadecimal format or rgb format.
String: Sets or returns the options of the control.
String: Sets or returns the color of the text.
String: Returns the type of the control.
String: Sets or returns the visibility of the control.
Object: The parent layout where to add the BottomNavbar
Object: The pointer event object.
Object: The click event object.
Object: Returns the parent layout control.
Object: Returns the position of the control. The returned object has left top right and bottom props.
List: An array whose elements are of the form `[ "Title", "Icon" ]`
List: The navigation actions array. See `navs` param above for format.
List: Sets or returns the navigation actions array. See navs params above for format.
List: 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.
List: Sets or returns the padding of the control. You can also pass a number to set equal padding for all sides.
function(
text,
index,
event
)
bmn.addItem
Adds a navigation action
bmn.animate
Animate the component
bmn.bringForward
Bring this component forward by a given z-index
bmn.clearSelection
Clears the selected navigation action
bmn.destroy
Destroy the component
bmn.getEnabled
Get the enabled state of a navigation action
bmn.getEnabledByName
Get the enabled state of the bottom navigation action by its name
bmn.getList
Returns the navigation actions list
bmn.getPosition
Returns the position of the component. The return object is of the form `{ left, top, right, bottom
bmn.gone
Destroy the component
bmn.hide
Hide the component
bmn.hideLabels
Hides the text label of the bottom navigation action
bmn.popItem
Removes the last navigation action
bmn.removeItemByIndex
Removes a navigation action by its given index
bmn.removeItemByName
Removes a navigation action by its given name
bmn.selectItem
Sets navigation action to active by its name. If you are providing a wrong name, no action will be active
bmn.selectItemByIndex
Sets a botttom navigation action to active by its index
bmn.sendBackward
Bring this component backward by a given z-index
bmn.setBorder
Sets the border line for the component container
bmn.setCornerRadius
Sets the corner radius of the component
bmn.setEnabled
Enable or disable a bottom navigation action. If you want to disable the component, use the disable property instead
bmn.setEnabledByName
Enabled or disable a bottom navigation action by its name
bmn.setIcon
Updates the icon of the given index
bmn.setItemByIndex
Updates a navigation action by its index
bmn.setList
Sets the navigation actions list
bmn.setMargins
Sets the margin of the component
bmn.setOnChange
Sets a callback function to execute when bottom navbar value changes
bmn.setOnContextMenu
Adds a callback function on right click
bmn.setOnTouch
Adds a callback handler when the component is touch
bmn.setPadding
Sets the padding component container
bmn.setPosition
Sets the position of the component relative to its parent dimensions
bmn.setScale
Sets the x and y scaling of the component
bmn.setSize
Sets the size of the component
bmn.shiftItem
Removes the first navigation action
bmn.show
Show the component
bmn.showLabels
Shows the text label of the bottom navigation action