The BottomSheet in Material Design is a UI component anchored at the screen bottom.
bts = ui.addBottomSheet(
title,
options )
→
ui object: BottomSheet
It's a good practice to avoid adding a notch when your bottomsheet has a title, or leftAction or rightAction
These are the methods available for the BottomSheet component.
Example - Basic
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet( "My title" );
var btn = ui.addButton(this.bts.layout, "Button", "Secondary");
btn.margins = [0, "1rem", 0, "1rem"];
}
btn_onTouch()
{
this.bts.show();
}
}
class Main extends App
onStart()
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet( "My title" )
btn = ui.addButton(this.bts.layout, "Button", "Secondary")
btn.margins = [0, "1rem", 0, "1rem"]
btn_onTouch()
this.bts.show()
Example - Bottomsheet with notch
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet("", "Notch");
var btn = ui.addButton(this.bts.layout, "Button", "Primary");
btn.margins = [0, "1rem", 0, "1rem"];
}
btn_onTouch()
{
this.bts.show();
}
}
class Main extends App
onStart()
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet("", "Notch")
btn = ui.addButton(this.bts.layout, "Button", "Primary")
btn.margins = [0, "1rem", 0, "1rem"]
btn_onTouch()
this.bts.show()
Example - Complete example
class Main extends App
{
onStart()
{
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet("", "HideOnAction,CloseAction,MoreAction,NoCancel");
this.bts.title = "My details"
this.bts.description = "This is a long description."
this.bts.setOnAction( this.onAction );
var btn = ui.addButton(this.bts.layout, "Button", "Primary");
btn.margins = [0, "1rem", 0, "1rem"];
}
btn_onTouch()
{
this.bts.show();
}
onAction(name, icon) {
ui.showPopup( name );
}
}
class Main extends App
onStart()
this.main = ui.addLayout("main", "Linear", "VCenter,FillXY")
this.btn = ui.addButton(this.main, "Show Bottom Sheet", "Primary")
this.btn.setOnTouch( this.btn_onTouch )
this.bts = ui.addBottomSheet("", "HideOnAction,CloseAction,MoreAction,NoCancel")
this.bts.title = "My details"
this.bts.description = "This is a long description."
this.bts.setOnAction( this.onAction )
btn = ui.addButton(this.bts.layout, "Button", "Primary")
btn.margins = [0, "1rem", 0, "1rem"]
btn_onTouch()
this.bts.show()
onAction(name, icon)
ui.showPopup( name )
Properties
The following properties are available on the BottomSheet object:
Methods
The following methods are available on the BottomSheet object: