@neo4j-ndl/react
Version:
React implementation of Neo4j Design System
155 lines (113 loc) • 3.28 kB
Markdown
Import: `import { ClipboardButton } from '@neo4j-ndl/react'`
| Prop | Type | Required | Default | Description |
|------|------|----------|---------|-------------|
| `descriptionKbdProps` | `(KbdProps & { as?: ElementType<any, keyof IntrinsicElements>; } & BaseProps<ElementType<any, keyof IntrinsicElements>>)` | | | |
| `isDisabled` | `boolean` | | | |
| `size` | `'large' \| 'medium' \| 'small'` | | | |
| `textToCopy` | `string` | ✅ | | The text that should be set to users clipboard |
| `tooltipProps` | `Omit<TooltipProps, "children">` | | | |
| `type` | `'clean-icon-button' \| 'icon-button' \| 'outlined-button'` | | `clean-icon-button` | |
For more information of the `TooltipProps` type, see the Tooltip component documentation.
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return <ClipboardButton textToCopy="This is the text to copy" />;
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<ClipboardButton textToCopy="This is the text to copy" isDisabled={true} />
);
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<ClipboardButton
textToCopy="This is the text to copy"
descriptionKbdProps={{
keys: ['c'],
modifierKeys: ['ctrl', 'shift'],
}}
/>
);
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<ClipboardButton textToCopy="This is the text to copy" type="icon-button" />
);
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<ClipboardButton
type="outlined-button"
textToCopy="This is the text to copy"
/>
);
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<div className="n-flex n-gap-token-16">
<ClipboardButton textToCopy="This is the text to copy" size="small" />
<ClipboardButton textToCopy="This is the text to copy" size="medium" />
<ClipboardButton textToCopy="This is the text to copy" size="large" />
</div>
);
};
export default Component;
```
```tsx
import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
import { ClipboardButton } from '@neo4j-ndl/react';
const Component = () => {
return (
<ClipboardButton
textToCopy="This is the text to copy"
tooltipProps={{
hoverDelay: {
close: 100,
open: 100,
},
isInitialOpen: true,
placement: 'right',
type: 'simple',
}}
/>
);
};
export default Component;
```