Skip to main content

ButtonLabelExt

Trait ButtonLabelExt 

Source
pub trait ButtonLabelExt {
    // Required method
    fn text_label(self, label: impl Into<SharedString>) -> Self;
}
Expand description

Adds a text label with the theme’s leading rather than a one-em line box.

This composes the upstream button’s child slot: sizes, colors, focus, activation, icons, and disabled states remain owned by gpui-component. The label inherits the button’s font size and the theme’s body-text leading.

Required Methods§

Source

fn text_label(self, label: impl Into<SharedString>) -> Self

Sets the visible text and accessible name. Use instead of Button::label.

A later accessibility_label call can supply a different spoken name. A long label still ends in an ellipsis; descenders and accents keep the theme’s line-height clearance. Call once per button.

use gpui_ai::ButtonLabelExt as _;
use gpui_component::button::Button;

let button = Button::new("apply").text_label("Apply changes");

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ButtonLabelExt for Button

Source§

fn text_label(self, label: impl Into<SharedString>) -> Self

Implementors§