pub fn glass_button(
args: impl Into<GlassButtonArgs>,
ripple_state: Arc<RippleState>,
child: impl FnOnce() + Send + Sync + 'static,
)
Expand description
An interactive button with a fluid, glass-like background and a ripple effect on click.
This component combines a fluid_glass
background for advanced visual effects with a
ripple animation to provide clear user feedback. It is highly customizable, allowing
control over the glass appearance, layout, and interaction behavior.
§Arguments
args
- A struct that provides detailed configuration for the button’s appearance and behavior. SeeGlassButtonArgs
for more details.ripple_state
- The state manager for the ripple animation. It should be created once and shared across recompositions.child
- A closure that defines the content displayed inside the button, such as text or an icon.
§Example
use std::sync::Arc;
use tessera_ui::Color;
use tessera_ui_basic_components::{
glass_button::{glass_button, GlassButtonArgs},
ripple_state::RippleState,
text::text,
};
let ripple_state = Arc::new(RippleState::new());
glass_button(
GlassButtonArgs {
on_click: Some(Arc::new(|| { /* Handle click */ })),
tint_color: Color::new(0.3, 0.2, 0.5, 0.4),
..Default::default()
},
ripple_state,
|| text("Click Me".to_string()),
);
An interactive button with a fluid glass background and a ripple effect.
This component is a composite of fluid_glass
for the visuals and a transparent
surface
for interaction handling and the ripple animation.