button

Function button 

Source
pub fn button<V: IntoView + 'static>(child: V) -> Button
๐Ÿ‘ŽDeprecated since 0.2.0: Use Button::new() instead
Expand description

Creates a new simple Button view with the default ButtonClass style.

ยงExamples

// Basic usage
let button1 = Button::new("Click me").action(move || println!("Button1 clicked!"));
let button2 = Button::new("Click me").action(move || println!("Button2 clicked!"));
// Apply styles for the button
let styled = Button::new("Click me")
    .action(|| println!("Styled button clicked!"))
    .style(|s| s
        .border(1.0)
        .border_radius(10.0)
        .padding(10.0)
        .background(css::YELLOW_GREEN)
        .color(css::DARK_GREEN)
        .cursor(CursorStyle::Pointer)
        .active(|s| s.color(css::WHITE).background(css::RED))
        .hover(|s| s.background(Color::from_rgb8(244, 67, 54)))
        .focus_visible(|s| s.border(2.).border_color(css::BLUE))
    );