Function dioxus_material::Button

source ·
pub fn Button<'a>(cx: Scope<'a, ButtonProps<'a>>) -> Element<'a>
Expand description

Filled button component.

Buttons let people take action and make choices with one tap.

material.io

Panics

This component requires access to a Theme.

Examples

use dioxus::prelude::*;
use dioxus_material::{Button, Theme};

fn app(cx: Scope) -> Element {
   render!(Theme {
        Button { onpress: |_| log::info!("clicked!"), "Click me!" } }
   )
}

Props

For details, see the props struct definition.

  • onpress : EventHandler<'a, Event<MouseData>>

    Handler for button press events.

  • children : Element<'a>

    Label child element.

  • background_color : Option<&'a str>

    Background color of the container (optional).

  • border_radius : Option<&'a str>

    Border radius of the container (optional).

  • height : Option<&'a str>

    Height of the container (optional).