diff --git a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.mdx b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.mdx
index e08401baf29..130db77acdc 100644
--- a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.mdx
+++ b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.mdx
@@ -5,7 +5,9 @@ import { ClipboardButton } from './ClipboardButton';
# ClipboardButton
-A wrapper for [clipboard.js](https://github.com/zenorocha/clipboard.js) library that allows copying text to clipboard. The text to be copied should be provided via `getText` prop.
+A control for allowing the user to copy text to their clipboard. Uses native APIs on modern browsers, falling back to the old `document.execCommand('copy')` API on other browsers. The text to be copied should be provided via `getText` prop.
+
+Commonly it is passed in the `addonAfter` prop on ``
# Usage
@@ -19,4 +21,17 @@ A wrapper for [clipboard.js](https://github.com/zenorocha/clipboard.js) library
```
+```jsx
+ shareUrl}>
+ Copy
+
+ }
+/>
+```
+
diff --git a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.story.internal.tsx b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.story.internal.tsx
index db7a783962f..035a82a7c9c 100644
--- a/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.story.internal.tsx
+++ b/packages/grafana-ui/src/components/ClipboardButton/ClipboardButton.story.internal.tsx
@@ -1,15 +1,16 @@
import { Story, Meta } from '@storybook/react';
-import React, { useState } from 'react';
+import React from 'react';
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
-import { Input } from '../Forms/Legacy/Input/Input';
+import { Field } from '../Forms/Field';
+import { Input } from '../Input/Input';
-import { ClipboardButton, Props } from './ClipboardButton';
+import { ClipboardButton as ClipboardButtonImpl, Props } from './ClipboardButton';
import mdx from './ClipboardButton.mdx';
export default {
title: 'Buttons/ClipboardButton',
- component: ClipboardButton,
+ component: ClipboardButtonImpl,
decorators: [withCenteredStory],
parameters: {
docs: {
@@ -26,29 +27,33 @@ interface StoryProps extends Partial {
buttonText: string;
}
-const Wrapper: Story = (args) => {
- const [copyMessage, setCopyMessage] = useState('');
- const clipboardCopyMessage = 'Value copied to clipboard';
+export const ClipboardButton: Story = (args) => {
+ const shareUrl = 'https://grafana.com/d/abcDEF-34t';
+
return (
-