pub struct ButtonElement {
pub label: String,
pub url: Option<String>,
pub action: Option<String>,
pub set: Option<Map<String, Value>>,
pub color: Option<ColorValue>,
pub background_color: Option<ColorValue>,
pub font_size: Option<f64>,
pub text_alignment: Option<TextAlignment>,
pub variant: Option<ButtonVariant>,
pub system_name: Option<String>,
pub disabled: Option<bool>,
pub style: ElementStyle,
}Expand description
Tappable button that opens a URL or emits widget-action.
Fields§
§label: StringButton label text.
url: Option<String>Deep link URL to open the app (used when no action is set).
action: Option<String>Action identifier — emits a widget-action Tauri event when tapped.
set: Option<Map<String, Value>>Local state written on tap, in-process (no app needed): {"done": "$toggle"}.
"$toggle" flips a boolean (missing → true), "$inc" / "$dec" add / subtract 1
(missing → 0 first), null removes the key (the default shows again), any other
JSON is stored as is. With action too, the action is sent after the write.
color: Option<ColorValue>Label text color.
background_color: Option<ColorValue>Button background color.
font_size: Option<f64>Label font size in points.
text_alignment: Option<TextAlignment>Label text alignment.
variant: Option<ButtonVariant>Visual style (bordered, prominent, plain, outline). Unset keeps each
platform’s classic button look; set it for the same look everywhere.
system_name: Option<String>Icon (SF Symbol name; Material / emoji elsewhere) before the label.
disabled: Option<bool>Draw dimmed and ignore taps.
style: ElementStyleShared visual style (padding, background, frame, …).
Trait Implementations§
Source§impl Clone for ButtonElement
impl Clone for ButtonElement
Source§impl Debug for ButtonElement
impl Debug for ButtonElement
Source§impl Default for ButtonElement
impl Default for ButtonElement
Source§impl<'de> Deserialize<'de> for ButtonElement
impl<'de> Deserialize<'de> for ButtonElement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<ButtonElement> for WidgetElement
impl From<ButtonElement> for WidgetElement
Source§fn from(value: ButtonElement) -> Self
fn from(value: ButtonElement) -> Self
Source§impl JsonSchema for ButtonElement
Available on crate feature schema only.
impl JsonSchema for ButtonElement
schema only.Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more