pub trait ButtonStyle: 'static {
// Required method
fn make_body(
&self,
cfg: &ButtonStyleConfig,
ctx: &mut BuildContext<'_>,
) -> WidgetId;
// Provided method
fn label_text_role(&self, _variant: ButtonVariant) -> Option<TextRole> { ... }
}Expand description
Style protocol for Button. The active style owns all paint and
layering — it receives the label subtree pre-built and arranges
background, border, focus ring, padding, etc. around it.
'static (no Send + Sync) because the rest of teksilo-core is
already single-threaded (Signal uses Rc); enforcing thread
safety here would be inconsistent and pay no benefit.
Required Methods§
fn make_body( &self, cfg: &ButtonStyleConfig, ctx: &mut BuildContext<'_>, ) -> WidgetId
Provided Methods§
Sourcefn label_text_role(&self, _variant: ButtonVariant) -> Option<TextRole>
fn label_text_role(&self, _variant: ButtonVariant) -> Option<TextRole>
Optional per-variant override of the label/icon text role.
The Button picks its label color from its built-in
variant→role mapping (OnAccent for accent-filled variants,
Primary otherwise, Link for Link) before the style runs.
Returning Some(role) here lets a design-language style redirect
it — e.g. Material 3 paints text/outlined buttons in the accent
color (TextRole::Accent) rather than Primary.
Default None preserves the built-in mapping, so existing styles
(and the IntUI default) are unaffected. A per-call
Button::text_role(...) still wins over this.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".