Skip to content
Razor catalogue

On this page

@addTagHelper *, Webority.Ui.Razor

Button form

The default copy button names what it copies, and its label can say the action in the page's own words.

Default button
Show code
<app-copy-button text="api-key-123" />
Custom labels
Show code
<app-copy-button text="https://invite.example.com/abc123" label="Copy link" copied-label="Link copied!" />

Variants

Copy buttons take the same tone and fill as AppButton, so a copy action matches the page's colour scheme.

Fills in a row
Show code
<app-copy-button text="x" variant="Ghost" label="Ghost" />
<app-copy-button text="x" variant="Outline" label="Outline" />
<app-copy-button text="x" variant="Soft" label="Soft" />
<app-copy-button text="x" tone="Neutral" variant="Solid" label="Neutral" />
Each tone in every fill
Show code
@foreach (var t in tones)
{
    <div class="d-flex flex-wrap align-items-center gap-2 w-100">
        @foreach (var f in fills)
        {
            <app-copy-button text="x" tone="@t" variant="@f" label="@f" />
        }
    </div>
}

Sizes

Use sm in dense tables, md by default and lg where the copy action is the main thing on the screen.

Small, medium and large
Show code
<app-copy-button text="x" size="Sm" label="Small" />
<app-copy-button text="x" size="Md" label="Medium" />
<app-copy-button text="x" size="Lg" label="Large" />

Icon-only form

An icon-only copy button suits a row or code block, and keeps its label as the accessible name.

Icon-only copy button
Show code
<app-copy-button text="user-id-456" label="Copy ID" copied-label="ID copied" icon-only="true" />

Every option

Every value of every prop, one cell each.

tone: all six

tone="primary" (default)
tone="success"
tone="warning"
tone="danger"
tone="info"
tone="neutral"

variant: all six

variant="solid"
variant="soft"
variant="outline"
variant="ghost" (default)
variant="link"
variant="glass"

size: button form

size="sm"
size="md" (default)
size="lg"

iconOnly

icon-only="false" (default)
icon-only="true"
icon-only="true" size="lg"

text

text="https://invite.example.com/abc123"

labels & className

custom label + copied-label
class="analytics-copy"

onCopied

onCopied={fn} (React only) runs after a successful copy

tooltip

tooltip not set (default)
tooltip="Copy this key"

tooltipPlacement

tooltip-placement="auto" (default)
tooltip-placement="top"
tooltip-placement="bottom"
tooltip-placement="start"
tooltip-placement="end"

Guidance

What to do, and what to avoid.

Use it when

  • A user needs to copy an API key, token, ID, link, or other reference to the clipboard.
  • You want visual feedback: the icon and label swap for 2 seconds to confirm the copy.
  • The copied text is sensitive (token, key) and you want a compact, accessible button.

Reach for something else when

  • You are copying large amounts of data or structured content. → A download link or a manual selection + native copy.
  • The text to copy changes dynamically and you cannot react to it. → A static link or a form with a dedicated copy action.

Reference

Try every prop, read the full list, and check keyboard and screen reader behaviour.

sm md lg
primary success warning danger info neutral
solid soft outline ghost link glass
(auto) top bottom start end
React, generated from the controls
<AppCopyButton text="api-key-123" onCopied={fn} />
Razor, the same props
<app-copy-button text="api-key-123" />

9 props. The 5 most used come first.

Used on most screens 5 props

PropTypeDefaultDescription
textdefault required string required The text to copy.
labeldefault Copy string Copy Button label.
sizedefault md sm | md | lg md Button size.
tonedefault primary primary | success | warning | danger | info | neutral primary Semantic colour.
variantdefault ghost solid | soft | outline | ghost | link | glass ghost Button variant.

Less common 4 props

PropTypeDefaultDescription
copied-labeldefault Copied string Copied Label shown after a successful copy.
icon-onlydefault false bool false Render as an icon-only button (like AppActionIcon); label becomes aria-label.
tooltipdefault - string - A collision-aware hover and focus tooltip (via AppTooltip) that flips to stay on screen.
tooltip-placementdefault auto auto | top | bottom | start | end auto Preferred tooltip side; auto picks the side with the most room.

Screen reader

3 notes
  • In the button form the label swaps from the Copy label to the Copied label, and the button has aria-live polite so the change is announced.
  • In the icon-only form the current label is the accessible name of the action icon.
  • A clipboard that denies the copy changes nothing and raises no error.