Skip to main content

icon_button

Function icon_button 

Source
pub fn icon_button<S>(variant: ButtonVariant, label: impl Into<String>) -> El<S>
Expand description

A square button that shows only an icon, named by label.

The label is the accessible name, which a button whose only child is an icon has no other way to get, so this constructor takes it.

use hypersig::Signals;
use hypersig_ui::{ButtonVariant, icon_button};
use serde::{Deserialize, Serialize};

#[derive(Signals, Serialize, Deserialize)]
struct App {}

let more = icon_button::<App>(ButtonVariant::Ghost, "More actions").text("…");
assert!(more.render().contains(r#"aria-label="More actions""#));