glass_button

Function glass_button 

Source
pub fn glass_button(
    args: impl Into<GlassButtonArgs>,
    ripple_state: RippleState,
    child: impl FnOnce() + Send + Sync + 'static,
)
Expand description

§glass_button

Renders an interactive button with a customizable glass effect and ripple animation.

§Usage

Use as a primary action button where a modern, layered look is desired.

§Parameters

  • args — configures the button’s glass appearance and on_click handler; see GlassButtonArgs.
  • 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::{
    glass_button::{glass_button, GlassButtonArgs},
    ripple_state::RippleState,
    text::{text, TextArgsBuilder},
};

let ripple_state = RippleState::new();

glass_button(
    GlassButtonArgs {
        on_click: Some(Arc::new(|| println!("Button clicked!"))),
        tint_color: Color::new(0.2, 0.3, 0.8, 0.3),
        ..Default::default()
    },
    ripple_state,
    || text(TextArgsBuilder::default().text("Click Me".to_string()).build().expect("builder construction failed")),
);