Copy Button
A button component that copies a specified text value to the clipboard when clicked.
HTML
Angular
React
Vue
< afp-copy-button value = " Copy Button" > </ afp-copy-button>
< afp-copy-button [value] = " ' Copy Button'" > </ afp-copy-button>
< AfpCopyButton value = " Copy Button" > </ AfpCopyButton>
< AfpCopyButton :value = " ' Copy Button'" > </ AfpCopyButton>
Show code
Edit
Examples #
Variants #
Use the variant attribute to set the button's semantic variant.
HTML
Angular
React
Vue
< div class = " afp-cluster" >
< afp-copy-button variant = " neutral" value = " Neutral" > </ afp-copy-button>
< afp-copy-button variant = " brand" value = " Brand" > </ afp-copy-button>
< afp-copy-button variant = " accent" value = " Accent" > </ afp-copy-button>
< afp-copy-button variant = " info" value = " Info" > </ afp-copy-button>
< afp-copy-button variant = " error" value = " Error" > </ afp-copy-button>
< afp-copy-button variant = " success" value = " Success" > </ afp-copy-button>
< afp-copy-button variant = " warning" value = " Warning" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [variant] = " ' neutral'" [value] = " ' Neutral'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' brand'" [value] = " ' Brand'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' accent'" [value] = " ' Accent'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' info'" [value] = " ' Info'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' error'" [value] = " ' Error'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' success'" [value] = " ' Success'" > </ afp-copy-button>
< afp-copy-button [variant] = " ' warning'" [value] = " ' Warning'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton variant = " neutral" value = " Neutral" > </ AfpCopyButton>
< AfpCopyButton variant = " brand" value = " Brand" > </ AfpCopyButton>
< AfpCopyButton variant = " accent" value = " Accent" > </ AfpCopyButton>
< AfpCopyButton variant = " info" value = " Info" > </ AfpCopyButton>
< AfpCopyButton variant = " error" value = " Error" > </ AfpCopyButton>
< AfpCopyButton variant = " success" value = " Success" > </ AfpCopyButton>
< AfpCopyButton variant = " warning" value = " Warning" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :variant = " ' neutral'" :value = " ' Neutral'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' brand'" :value = " ' Brand'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' accent'" :value = " ' Accent'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' info'" :value = " ' Info'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' error'" :value = " ' Error'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' success'" :value = " ' Success'" > </ AfpCopyButton>
< AfpCopyButton :variant = " ' warning'" :value = " ' Warning'" > </ AfpCopyButton>
</ div>
Show code
Edit
Appearance #
Use the appearance attribute to change the button's visual appearance.
HTML
Angular
React
Vue
< div class = " afp-stack" >
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " neutral" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " neutral" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " neutral" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " neutral" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " neutral" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " brand" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " brand" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " brand" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " brand" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " brand" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " accent" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " accent" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " accent" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " accent" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " accent" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " info" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " info" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " info" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " info" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " info" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " error" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " error" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " error" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " error" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " error" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " success" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " success" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " success" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " success" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " success" value = " Plain" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button appearance = " default" variant = " warning" value = " Default" > </ afp-copy-button>
< afp-copy-button appearance = " filled" variant = " warning" value = " Filled" > </ afp-copy-button>
< afp-copy-button appearance = " outlined" variant = " warning" value = " Outlined" > </ afp-copy-button>
< afp-copy-button appearance = " outlined-filled" variant = " warning" value = " Outlined filled" > </ afp-copy-button>
< afp-copy-button appearance = " plain" variant = " warning" value = " Plain" > </ afp-copy-button>
</ div>
</ div>
< div class = " afp-stack" >
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' neutral'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' neutral'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' neutral'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' neutral'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' neutral'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' brand'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' brand'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' brand'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' brand'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' brand'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' accent'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' accent'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' accent'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' accent'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' accent'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' info'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' info'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' info'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' info'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' info'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' error'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' error'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' error'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' error'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' error'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' success'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' success'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' success'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' success'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' success'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [appearance] = " ' default'" [variant] = " ' warning'" [value] = " ' Default'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' filled'" [variant] = " ' warning'" [value] = " ' Filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined'" [variant] = " ' warning'" [value] = " ' Outlined'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' outlined-filled'" [variant] = " ' warning'" [value] = " ' Outlined filled'" > </ afp-copy-button>
< afp-copy-button [appearance] = " ' plain'" [variant] = " ' warning'" [value] = " ' Plain'" > </ afp-copy-button>
</ div>
</ div>
< div class = " afp-stack" >
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " neutral" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " neutral" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " neutral" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " neutral" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " neutral" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " brand" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " brand" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " brand" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " brand" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " brand" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " accent" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " accent" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " accent" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " accent" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " accent" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " info" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " info" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " info" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " info" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " info" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " error" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " error" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " error" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " error" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " error" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " success" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " success" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " success" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " success" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " success" value = " Plain" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton appearance = " default" variant = " warning" value = " Default" > </ AfpCopyButton>
< AfpCopyButton appearance = " filled" variant = " warning" value = " Filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined" variant = " warning" value = " Outlined" > </ AfpCopyButton>
< AfpCopyButton appearance = " outlined-filled" variant = " warning" value = " Outlined filled" > </ AfpCopyButton>
< AfpCopyButton appearance = " plain" variant = " warning" value = " Plain" > </ AfpCopyButton>
</ div>
</ div>
< div class = " afp-stack" >
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' neutral'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' neutral'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' neutral'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' neutral'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' neutral'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' brand'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' brand'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' brand'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' brand'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' brand'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' accent'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' accent'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' accent'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' accent'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' accent'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' info'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' info'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' info'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' info'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' info'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' error'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' error'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' error'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' error'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' error'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' success'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' success'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' success'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' success'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' success'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :appearance = " ' default'" :variant = " ' warning'" :value = " ' Default'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' filled'" :variant = " ' warning'" :value = " ' Filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined'" :variant = " ' warning'" :value = " ' Outlined'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' outlined-filled'" :variant = " ' warning'" :value = " ' Outlined filled'" > </ AfpCopyButton>
< AfpCopyButton :appearance = " ' plain'" :variant = " ' warning'" :value = " ' Plain'" > </ AfpCopyButton>
</ div>
</ div>
Show code
Edit
Shapes #
Use the shape attribute to change the button's shape.
HTML
Angular
React
Vue
< div class = " afp-cluster" >
< afp-copy-button shape = " pill" value = " Pill" > </ afp-copy-button>
< afp-copy-button shape = " rounded" value = " Rounded" > </ afp-copy-button>
< afp-copy-button shape = " soft" value = " Soft" > </ afp-copy-button>
< afp-copy-button shape = " square" value = " Square" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< afp-copy-button [shape] = " ' pill'" [value] = " ' Pill'" > </ afp-copy-button>
< afp-copy-button [shape] = " ' rounded'" [value] = " ' Rounded'" > </ afp-copy-button>
< afp-copy-button [shape] = " ' soft'" [value] = " ' Soft'" > </ afp-copy-button>
< afp-copy-button [shape] = " ' square'" [value] = " ' Square'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton shape = " pill" value = " Pill" > </ AfpCopyButton>
< AfpCopyButton shape = " rounded" value = " Rounded" > </ AfpCopyButton>
< AfpCopyButton shape = " soft" value = " Soft" > </ AfpCopyButton>
< AfpCopyButton shape = " square" value = " Square" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster" >
< AfpCopyButton :shape = " ' pill'" :value = " ' Pill'" > </ AfpCopyButton>
< AfpCopyButton :shape = " ' rounded'" :value = " ' Rounded'" > </ AfpCopyButton>
< AfpCopyButton :shape = " ' soft'" :value = " ' Soft'" > </ AfpCopyButton>
< AfpCopyButton :shape = " ' square'" :value = " ' Square'" > </ AfpCopyButton>
</ div>
Show code
Edit
Sizes #
Use --afp-copy-button-size CSS variable to change a button's size.
HTML
Angular
React
Vue
< div class = " afp-cluster afp-align-center" >
< afp-copy-button value = " Custom size" style = " --afp-copy-button-size : 2rem" > </ afp-copy-button>
< afp-copy-button value = " Custom size" style = " --afp-copy-button-size : 2.5rem" > </ afp-copy-button>
< afp-copy-button value = " Custom size" style = " --afp-copy-button-size : 3rem" > </ afp-copy-button>
</ div>
< div class = " afp-cluster afp-align-center" >
< afp-copy-button [value] = " ' Custom size'" [style] = " ' --afp-copy-button-size: 2rem'" > </ afp-copy-button>
< afp-copy-button [value] = " ' Custom size'" [style] = " ' --afp-copy-button-size: 2.5rem'" > </ afp-copy-button>
< afp-copy-button [value] = " ' Custom size'" [style] = " ' --afp-copy-button-size: 3rem'" > </ afp-copy-button>
</ div>
< div class = " afp-cluster afp-align-center" >
< AfpCopyButton value = " Custom size" style = " --afp-copy-button-size : 2rem" > </ AfpCopyButton>
< AfpCopyButton value = " Custom size" style = " --afp-copy-button-size : 2.5rem" > </ AfpCopyButton>
< AfpCopyButton value = " Custom size" style = " --afp-copy-button-size : 3rem" > </ AfpCopyButton>
</ div>
< div class = " afp-cluster afp-align-center" >
< AfpCopyButton :value = " ' Custom size'" :style = " ' --afp-copy-button-size: 2rem'" > </ AfpCopyButton>
< AfpCopyButton :value = " ' Custom size'" :style = " ' --afp-copy-button-size: 2.5rem'" > </ AfpCopyButton>
< AfpCopyButton :value = " ' Custom size'" :style = " ' --afp-copy-button-size: 3rem'" > </ AfpCopyButton>
</ div>
Show code
Edit
Tooltip text #
Use the tooltip attribute to change the tooltip text.
HTML
Angular
React
Vue
< afp-copy-button value = " Custom tooltip text" tooltip = " Copy to clipboard" > </ afp-copy-button>
< afp-copy-button [value] = " ' Custom tooltip text'" [tooltip] = " ' Copy to clipboard'" > </ afp-copy-button>
< AfpCopyButton value = " Custom tooltip text" tooltip = " Copy to clipboard" > </ AfpCopyButton>
< AfpCopyButton :value = " ' Custom tooltip text'" :tooltip = " ' Copy to clipboard'" > </ AfpCopyButton>
Show code
Edit
Use the noTooltip (notooltip) attribute to disable the tooltip.
HTML
Angular
React
Vue
< afp-copy-button value = " No tooltip" notooltip > </ afp-copy-button>
< afp-copy-button [value] = " ' No tooltip'" notooltip > </ afp-copy-button>
< AfpCopyButton value = " No tooltip" notooltip > </ AfpCopyButton>
< AfpCopyButton :value = " ' No tooltip'" notooltip > </ AfpCopyButton>
Show code
Edit
Disabled #
Use the disabled attribute to disable the copy button.
HTML
Angular
React
Vue
< afp-copy-button value = " Disabled" disabled > </ afp-copy-button>
< afp-copy-button [value] = " ' Disabled'" disabled > </ afp-copy-button>
< AfpCopyButton value = " Disabled" disabled > </ AfpCopyButton>
< AfpCopyButton :value = " ' Disabled'" disabled > </ AfpCopyButton>
Show code
Edit
Duration #
Use the duration attribute to set how long the success state lasts (in milliseconds).
HTML
Angular
React
Vue
< afp-copy-button value = " Custom Duration" duration = " 500" > </ afp-copy-button>
< afp-copy-button [value] = " ' Custom Duration'" [duration] = 500> </ afp-copy-button>
< AfpCopyButton value = " Custom Duration" duration = " 500" > </ AfpCopyButton>
< AfpCopyButton :value = " ' Custom Duration'" :duration = 500> </ AfpCopyButton>
Show code
Edit
Custom Icons #
Use the icon and icon-success slots to provide custom icons for the copy and success states.
HTML
Angular
React
Vue
< afp-copy-button value = " Custom Icons" >
< afp-icon slot = " icon" name = " clipboard" > </ afp-icon>
< afp-icon slot = " icon-success" name = " clipboard-check" > </ afp-icon>
</ afp-copy-button>
< afp-copy-button [value] = " ' Custom Icons'" >
< afp-icon [slot] = " ' icon'" [name] = " ' clipboard'" > </ afp-icon>
< afp-icon [slot] = " ' icon-success'" [name] = " ' clipboard-check'" > </ afp-icon>
</ afp-copy-button>
< AfpCopyButton value = " Custom Icons" >
< AfpIcon slot = " icon" name = " clipboard" > </ AfpIcon>
< AfpIcon slot = " icon-success" name = " clipboard-check" > </ AfpIcon>
</ AfpCopyButton>
< AfpCopyButton :value = " ' Custom Icons'" >
< AfpIcon :slot = " ' icon'" :name = " ' clipboard'" > </ AfpIcon>
< AfpIcon :slot = " ' icon-success'" :name = " ' clipboard-check'" > </ AfpIcon>
</ AfpCopyButton>
Show code
Edit
Properties
Learn more about properties .
Name
Description
Reflects
tooltip
Tooltip text displayed on hover.
Type
string
Default 'Copy'
noTooltip
notooltip
If true, the tooltip is not displayed.
Type
boolean
Default false
value
The text value to be copied to the clipboard when the button is clicked.
duration
Duration in milliseconds for which the success state is shown after copying.
disabled
If true, the copy button is disabled.
open
Whether the tooltip is currently open.
Type
boolean
Default false
variant
Variant of the copy button.
Type
AfpVariant
Name
Description
The main call-to-action.
Less prominent than primary.
Secondary highlight for emphasis.
Used for destructive or critical actions.
Conveys general information.
Indicates a successful or positive action.
Communicates cautionary actions.
AfpVariant
Default AfpVariant.NEUTRAL
shape
Shape of the copy button.
Type
AfpShape
Name
Description
Makes the component circular.
Makes the component rounded.
Makes the component have soft edges.
Makes the component square.
AfpShape
Default AfpShape.ROUNDED
appearance
Appearance of the copy button.
Type
AfpAppearance
Name
Description
Highlighted, primary action (default).
Transparent background with a visible border.
Minimal, no border or background.
Solid background, no border.
Solid background with a visible border.
AfpAppearance
Default AfpAppearance.FILLED
Events
Learn more about events .
Name
Return
Description
afp-click
void
Emitted when the copy button is clicked.
afp-focus
void
Emitted when the copy button gains focus.
afp-blur
void
Emitted when the copy button loses focus.
Slots
Learn more about slots .
Name
Description
icon
Used to pass in a custom icon for the copy action.
icon-success
Used to pass in a custom icon for the success state after copying.
Internationalization
Learn more about internationalization .
Key
Description
Aria label for the copy button.
Text announced when the copy action is successful. Used for screen readers.
CSS Parts
Learn more about CSS Parts .
Name
Description
Selector
base
icon-wrapper
The wrapper for the copy icon.
icon
icon-success-wrapper
The wrapper for the success icon.
::part(icon-success-wrapper)
icon-success
tooltip
CSS Custom Properties
Name
Description
Default
--afp-copy-button-disabled-opacity
The opacity of the copy button when disabled.
0.5
--afp-copy-button-size
The size of the copy button.
--afp-size-s
Dependencies
The component automatically brings in the listed items, including any nested dependencies that may exist.
Importing
Using the bundle is the recommended method to include components. If you’d rather handle imports manually, you can use the code examples below.
import '@afp-design-system/core/dist/components/copy-button/copy-button.js' ;