@@ -89,7 +89,7 @@ export interface ClipboardCopyProps extends Omit<React.HTMLProps<HTMLDivElement>
8989 /** A function that is triggered on changing the text. */
9090 onChange ?: ( event : React . FormEvent , text ?: string ) => void ;
9191 /** The text which is copied. */
92- children : string ;
92+ children : string | string [ ] ;
9393 /** Additional actions for inline clipboard copy. Should be wrapped with ClipboardCopyAction. */
9494 additionalActions ?: React . ReactNode ;
9595 /** Value to overwrite the randomly generated data-ouia-component-id.*/
@@ -103,7 +103,7 @@ class ClipboardCopy extends React.Component<ClipboardCopyProps, ClipboardCopySta
103103 timer = null as number ;
104104 constructor ( props : ClipboardCopyProps ) {
105105 super ( props ) ;
106- const text = Array . isArray ( this . props . children ) ? this . props . children . join ( '' ) : ( this . props . children as string ) ;
106+ const text = Array . isArray ( this . props . children ) ? this . props . children . join ( ' ' ) : ( this . props . children as string ) ;
107107 this . state = {
108108 text,
109109 expanded : this . props . isExpanded ,
@@ -134,7 +134,9 @@ class ClipboardCopy extends React.Component<ClipboardCopyProps, ClipboardCopySta
134134 // eslint-disable-next-line @typescript-eslint/no-unused-vars
135135 componentDidUpdate = ( prevProps : ClipboardCopyProps , prevState : ClipboardCopyState ) => {
136136 if ( prevProps . children !== this . props . children ) {
137- const newText = this . props . children as string ;
137+ const newText = Array . isArray ( this . props . children )
138+ ? this . props . children . join ( ' ' )
139+ : ( this . props . children as string ) ;
138140 this . setState ( { text : newText , textWhenExpanded : newText } ) ;
139141 }
140142 } ;
0 commit comments