How to use the @wordpress/element.forwardRef function in @wordpress/element

To help you get started, we’ve selected a few @wordpress/element examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / packages / components / src / external-link / index.js View on Github external
const classes = classnames( 'components-external-link', className );
	return (
		<a rel="{" href="{"> { /* eslint-disable-line react/jsx-no-target-blank */ }
			{ children }
			<span>
				{
					/* translators: accessibility text */
					__( '(opens in a new tab)' )
				}
			</span>
			
		</a>
	);
}

export default forwardRef( ExternalLink );
github WordPress / gutenberg / packages / components / src / navigable-container / container.js View on Github external
'forwardedRef',
				] ) }
			&gt;
				{ children }
			
		);
		/* eslint-enable jsx-a11y/no-static-element-interactions */
	}
}

const forwardedNavigableContainer = ( props, ref ) =&gt; {
	return ;
};
forwardedNavigableContainer.displayName = 'NavigableContainer';

export default forwardRef( forwardedNavigableContainer );
github WordPress / gutenberg / packages / components / src / navigable-container / tabbable.js View on Github external
return eventToOffset( evt );
		}
	};

	return (
		
	);
}

export default forwardRef( TabbableContainer );
github ampproject / amp-wp / assets / src / edit-story / components / canvas / draggablePage.js View on Github external
);
}

const DraggablePage = forwardRef( DraggablePageWithRef );

export default DraggablePage;
github htmlburger / carbon-fields / packages / core / fields / complex / tabs.js View on Github external
<span>
											{ index + 1 }
										</span>
									)
							}
						
					);
				} ) }
			

			{ children }
		
	);
}

export default forwardRef( ComplexTabs );
github WordPress / gutenberg / packages / server-side-render / src / index.js View on Github external
return urlQueryArgs;
			}
			return {
				post_id: currentPostId,
				...urlQueryArgs,
			};
		}, [ currentPostId, urlQueryArgs ] );

		return (
			
		);
	}
);

if ( window &amp;&amp; window.wp &amp;&amp; window.wp.components ) {
	window.wp.components.ServerSideRender = forwardRef( ( props, ref ) =&gt; {
		deprecated( 'wp.components.ServerSideRender', {
			alternative: 'wp.serverSideRender',
		} );
		return (
			
		);
	} );
}

export default ExportedServerSideRender;
github WordPress / gutenberg / packages / block-editor / src / components / plain-text / index.js View on Github external
/**
 * WordPress dependencies
 */
import { forwardRef } from '@wordpress/element';

/**
 * External dependencies
 */
import TextareaAutosize from 'react-autosize-textarea';
import classnames from 'classnames';

/**
 * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/plain-text/README.md
 */
const PlainText = forwardRef( ( { onChange, className, ...props }, ref ) =&gt; {
	return (
		 onChange( event.target.value ) }
			{ ...props }
		/&gt;
	);
} );

export default PlainText;
github WordPress / gutenberg / packages / components / src / button / deprecated.js View on Github external
alternative: 'wp.components.Button',
	} );

	return (
		<button label="{" size="">
	);
}

export default forwardRef( IconButton );
</button>