- A-Z
- Accordion
- Acronym
- Action
- Alert
- Breadcrumbs
- Button
- Card
- Checkboxes
- Confirmation
- Cookie banner
- Copy
- Date input
- Details
- Env
- Error summary
- Filter
- Footer
- Forms
- Group
- Header
- Help
- Hero
- Hr
- Input
- Leave site
- Notification
- Pagination
- Progress
- Radios
- Select
- Signage
- Skip link
- Status
- Steps
- Summary list
- Table
- Tabs
- Textarea
- Time input
Your web browser is out of date
Your web browser (the software you use to access the internet) is out of date. You need to update it or use a different web browser to ensure you can complete this form.
Copy
Copy text
Using ‘data-copy-element’
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Description |
|---|---|---|
| element | string | Required. The element selector to copy. Can be either a unique className (e.g. '.js-copy-1') or id (e.g. '#js-copy-1'). |
| copyHtml | boolean | What clicking on the button will copy. If true, the inner html of the element will be copied else it'll be the text within the element. Default values are false (boolean), true (boolean) or null. |
| content | string | HTML or Text that follows 'Copy' or 'Copied'. Default values are false (boolean) or null. Best practice is to have html with a 'sr-only' span that states what is being copied. See content. |
Options for content
| Name | Type | Description |
|---|---|---|
| html | string | Required. HTML for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
| text | string | Required. Text for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
Twig macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Description |
|---|---|---|
| element | string | Required. The element selector to copy. Can be either a unique className (e.g. '.js-copy-1') or id (e.g. '#js-copy-1'). |
| copyHtml | boolean | What clicking on the button will copy. If true, the inner html of the element will be copied else it'll be the text within the element. Default values are false (boolean), true (boolean) or null. |
| content | string | HTML or Text that follows 'Copy' or 'Copied'. Default values are false (boolean) or null. Best practice is to have html with a 'sr-only' span that states what is being copied. See content. |
Options for content
| Name | Type | Description |
|---|---|---|
| html | string | Required. HTML for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
| text | string | Required. Text for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
Copy HTML
Using ‘data-copy-html’
Nunjucks macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Description |
|---|---|---|
| element | string | Required. The element selector to copy. Can be either a unique className (e.g. '.js-copy-1') or id (e.g. '#js-copy-1'). |
| copyHtml | boolean | What clicking on the button will copy. If true, the inner html of the element will be copied else it'll be the text within the element. Default values are false (boolean), true (boolean) or null. |
| content | string | HTML or Text that follows 'Copy' or 'Copied'. Default values are false (boolean) or null. Best practice is to have html with a 'sr-only' span that states what is being copied. See content. |
Options for content
| Name | Type | Description |
|---|---|---|
| html | string | Required. HTML for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
| text | string | Required. Text for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
Twig macro options
Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
Some options are required for the macro to work; these are marked as "Required" in the option description.
If you're using Nunjucks macros in production with "html" options, or ones ending with "html", you must sanitise the HTML to protect against cross-site scripting exploits.
| Name | Type | Description |
|---|---|---|
| element | string | Required. The element selector to copy. Can be either a unique className (e.g. '.js-copy-1') or id (e.g. '#js-copy-1'). |
| copyHtml | boolean | What clicking on the button will copy. If true, the inner html of the element will be copied else it'll be the text within the element. Default values are false (boolean), true (boolean) or null. |
| content | string | HTML or Text that follows 'Copy' or 'Copied'. Default values are false (boolean) or null. Best practice is to have html with a 'sr-only' span that states what is being copied. See content. |
Options for content
| Name | Type | Description |
|---|---|---|
| html | string | Required. HTML for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
| text | string | Required. Text for the copy button. If 'html' is provided, the 'text' parameter will be ignored. |
WIP
-- When clicked, “Copy” turns into “Copied”:--
— until focus is lost from the button
— for 5 seconds
— aria-polite is read out to a screen reader as “Copied X”
-- No JS fallback = button does not show.
Status of development
The below criteria all need to be met for a component to be considered as fully developed for use within the ASP Digital Design System.
| Development criteria | Status |
|---|---|
| WCAG 2.2 compliant | Not started |
| WCAG 2.1 compliant | Completed |
| HTML / Nunjucks version | Completed |
| Figma version | Not started |
| M365 versions | Not started |
| Documentation | In progress |
Make a change to the Design System
Suggest an edit to this system, or any of the components in it, by submitting a Design System change request.
Published 9 January 2026
Last updated 15 January 2026