button

Function button 

Source
pub fn button(
    args: impl Into<ButtonArgs>,
    ripple_state: RippleState,
    child: impl FnOnce(),
)
Expand description

§button

Provides a clickable button with customizable style and ripple feedback.

§Usage

Use to trigger an action when the user clicks or taps.

§Parameters

  • args — configures the button’s appearance and on_click handler; see ButtonArgs.
  • ripple_state — a clonable RippleState to manage the ripple animation.
  • child — a closure that renders the button’s content (e.g., text or an icon).

§Examples

use std::sync::Arc;
use tessera_ui::Color;
use tessera_ui_basic_components::{
    button::{button, ButtonArgsBuilder},
    ripple_state::RippleState,
    text::{text, TextArgsBuilder},
};

let ripple = RippleState::new();
let args = ButtonArgsBuilder::default()
    .on_click(Arc::new(|| {}))
    .build()
    .unwrap();

button(args, ripple, || {
    text(TextArgsBuilder::default().text("Click Me".to_string()).build().expect("builder construction failed"));
});