Skip to content

Commit 6f12545

Browse files
feat(eui): add tooltipProps prop to EuiCopy
1 parent be04a2c commit 6f12545

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • packages/eui/src/components/copy

packages/eui/src/components/copy/copy.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import { CommonProps } from '../common';
1111
import { copyToClipboard } from '../../services';
1212
import { EuiToolTip, EuiToolTipProps } from '../tool_tip';
1313

14-
export interface EuiCopyProps
15-
extends CommonProps,
16-
Partial<Omit<EuiToolTipProps, 'children'>> {
14+
export interface EuiCopyProps extends CommonProps {
1715
/**
1816
* Text that will be copied to clipboard when copy function is executed.
1917
*/
@@ -32,6 +30,10 @@ export interface EuiCopyProps
3230
* Use your own logic to create the component that users interact with when triggering copy.
3331
*/
3432
children(copy: () => void): ReactElement;
33+
/**
34+
* Optional props to pass to the EuiToolTip component.
35+
*/
36+
tooltipProps?: Partial<EuiToolTipProps>;
3537
}
3638

3739
interface EuiCopyState {
@@ -67,16 +69,15 @@ export class EuiCopy extends Component<EuiCopyProps, EuiCopyState> {
6769
};
6870

6971
render() {
70-
const { children, textToCopy, beforeMessage, afterMessage, ...rest } =
71-
this.props;
72+
const { children, tooltipProps } = this.props;
7273

7374
return (
7475
// See `src/components/tool_tip/tool_tip.js` for explanation of below eslint-disable
7576
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
7677
<EuiToolTip
7778
content={this.state.tooltipText}
7879
onMouseOut={this.resetTooltipText}
79-
{...rest}
80+
{...tooltipProps}
8081
>
8182
{children(this.copy)}
8283
</EuiToolTip>

0 commit comments

Comments
 (0)