Buttons are an experimental element that may change in the future, may completely go away, and may not work the same between iOS and Android. They also have a tendency to not work before the SmartApp has been installed. There isn’t documentation for them because they are not fully supported yet.
That being said, if you want to try them at your own risk…BEHOLD!!!
def buttonsPage() {
dynamicPage(name: "buttonsPage", title: "Every 'button' type") {
section("buttons") {
buttons(name: "buttons", title: "required:false, multiple:false", required: false, multiple: false, buttons: [
[label: "foo", action: "foo"],
[label: "bar", action: "bar"]
])
buttons(name: "buttonsRequired", title: "required:true", required: true, multiple: false, buttons: [
[label: "foo", action: "foo"],
[label: "bar", action: "bar"]
])
buttons(name: "buttonsMultiple", title: "multiple:true", required: false, multiple: true, buttons: [
[label: "foo", action: "foo"],
[label: "bar", action: "bar"]
])
}
section("Colored Buttons") {
buttons(name: "buttonsColoredSpecial", title: "special strings", description: "SmartThings highly recommends using these colors", buttons: [
[label: "complete", action: "bar", backgroundColor: "complete"],
[label: "required", action: "bar", backgroundColor: "required"]
])
buttons(name: "buttonsColoredHex", title: "hex values work", buttons: [
[label: "bg: #000dff", action: "foo", backgroundColor: "#000dff"],
[label: "fg: #ffac00", action: "foo", color: "#ffac00"],
[label: "both fg and bg", action: "foo", color: "#ffac00", backgroundColor: "#000dff"]
])
buttons(name: "buttonsColoredString", title: "strings work too", buttons: [
[label: "green", action: "foo", backgroundColor: "green"],
[label: "red", action: "foo", backgroundColor: "red"],
[label: "both fg and bg", action: "foo", color: "red", backgroundColor: "green"]
])
}
}
}
Make sure you create a method that corresponds to your button.action like so:
def foo(params) {
log.debug "foo($params)"
}