button Widget

The user can tap a button widget to perform a list of actions.

Attributes:

  • text: "My Button"
    • Required
    • Text to display on the button
    • Must contain a non-whitespace symbol
  • actions: [action]
    • A list of actions to perform when the user taps the button
    • When the list is empty, the button is disabled.

Example

screenshot screenshot

# Ruby
button(text: "Button", actions: [rpc("/add_item"), pop])
#![allow(unused)]
fn main() {
// Rust
button("Button", [rpc("/add_item"), pop()])
}

Many Words

screenshot

# Ruby
button(
  text: "MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM",
  actions: [rpc("/add_item"), pop]),
)

Long Word

screenshot

# Ruby
button(
  text: "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM",
  actions: [rpc("/add_item"), pop]),
)

Disabled

screenshot screenshot

# Ruby
button(text: "Disabled Button", actions: [])
#![allow(unused)]
fn main() {
// Rust
button("Disabled Button", [])
}