CopyButton view
A button that copies caller-supplied text and confirms what happened.
A view survives a frame. Hold it in an Entity with cx.new(..) and reach it with .update(..).
use gpui_kit::controls::CopyButton;
Construct
new(ident: impl Into<Ident>, _window: &mut Window, cx: &mut Context<Self>) -> SelfOptions
Chain onto the value.
text(text: impl Into<SharedString>) -> Self
label(label: impl Into<SharedString>) -> Self
glyph_only(name: impl Into<SharedString>) -> Self
variant(variant: ButtonVariant) -> Self
copier(copier: impl Fn(&str, &mut App) -> Result<(), SharedString> + 'static) -> Self
confirmation(confirmation: Duration) -> SelfCommands
Need a Context, so they need a view.
set_text(text: impl Into<SharedString>, cx: &mut Context<Self>)
set_disabled(disabled: bool, cx: &mut Context<Self>)
copy(cx: &mut Context<Self>)Queries
Only answer; they change nothing.
state() -> &CopyStateRendered by
Each of these compiles and is captured by the gate, so the code behind them is verified rather than written.