Copy Button
Copies text to the clipboard and confirms with a check mark.
Installation
bash
shellui-native add copy-button
Platforms: MAUI · Avalonia. Also installs icon.
Usage
Basic
shellui-native add button
<Border StrokeShape="RoundRectangle 6" Padding="12,4,4,4" HorizontalOptions="Start">
<HorizontalStackLayout Spacing="8">
<Label Text="shellui-native add button" FontFamily="monospace" VerticalOptions="Center" />
<ui:CopyButton Text="shellui-native add button" Copied="OnCopied" />
</HorizontalStackLayout>
</Border><Border BorderThickness="1" BorderBrush="{DynamicResource ShellUIBorderBrush}" CornerRadius="6"
Padding="12,4,4,4" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="shellui-native add button" FontFamily="monospace" VerticalAlignment="Center" />
<ui:CopyButton Text="shellui-native add button" Copied="OnCopied" />
</StackPanel>
</Border>Not available on yet
Set Label for a button with text (Label="Copy link") instead of an icon-only one.
MAUI and Avalonia
MAUI copies with Clipboard.Default; Avalonia uses the window's clipboard, so the button does nothing until it is in a window.
API
| Property | Type | Default | Description |
|---|---|---|---|
Text |
string |
— | Text copied to the clipboard. |
Label |
string |
— | Button text; empty shows just the icon. |
| Event | Arguments | Description |
|---|---|---|
Copied |
— | The text was copied. |
| Method | Description |
|---|---|
CopyAsync() |
Copies Text to the clipboard, as a press would. |