import { Meta, Props, Preview, Story } from '@storybook/addon-docs/blocks';
import * as Stories from './Clipboard.stories.js';

<Meta title="APIs|Clipboard" />

# Clipboard

Clipboard gives you an interface for setting to the clipboard. (Getting
clipboard content is not currently supported on web.)

## Methods

### isAvailable()

Determines whether the browser environment supports Clipboard at all.

```js
if (Clipboard.isAvailable) {
  // you can use the Clipboard API
}
```

### setString(string)

Copies a string to the clipboard. On web, some browsers may not support copying
to the clipboard, therefore, this function returns a boolean to indicate if the
copy was successful.

```js
const wasSet = Clipboard.setString('add this to clipboard');
```

<Preview withSource='none'>
  <Story name="setString">
    <Stories.setString />
  </Story>
</Preview>

### getString()

Not properly supported on Web. Returns a `Promise` of an empty string.
