form_button Widget

The user can tap a form_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 back button
    • When the list is empty, the button is disabled.

Example

screenshot screenshot

# Ruby
nav_page(title: "Form Button") {
  scroll {
    form(widgets: [
      form_button(text: "Button", actions: [rpc("/add_item"), pop]),
      form_button(
        text: "MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM",
        actions: [rpc("/add_item"), pop],
      ),
      form_button(
        text: "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM",
        actions: [rpc("/add_item"), pop],
      ),
      form_button(text: "Disabled", actions: []),
      form_button(
        text: "Start Aligned",
        actions: [rpc("/add_item"), pop],
        align: ALIGN_START,
        ),
      form_button(
        text: "Center Aligned",
        actions: [rpc("/add_item"), pop],
        align: ALIGN_CENTER,
      ),
      form_button(
        text: "End Aligned",
        actions: [rpc("/add_item"), pop],
        align: ALIGN_END,
      ),
    ])
  }
}
#![allow(unused)]
fn main() {
// Rust
nav_page(
    "Form Button",
    scroll(form((
        form_button("Button", [rpc("/add_item"), pop()]),
        form_button(
            "MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM MMMM",
            [rpc("/add_item"), pop()],
        ),
        form_button(
            "MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM",
            [rpc("/add_item"), pop()],
        ),
        form_button("Disabled", []),
        form_button("Start Aligned", [rpc("/add_item"), pop()]).with_align(HAlignment::Start),
        form_button("Center Aligned", [rpc("/add_item"), pop()]).with_align(HAlignment::Center),
        form_button("End Aligned", [rpc("/add_item"), pop()]).with_align(HAlignment::End),
    ))),
)
}