React component which automatically converts URLs, email addresses, phone numbers, Twitter handles and hashtags in a string to HTML anchors.
npm install react-autolinker-wrapper --save
import AutolinkerWrapper from 'react-autolinker-wrapper'
...
<AutolinkerWrapper
tagName="span"
text="Documentation at https://github.com/gvas/react-autolinker-wrapper"
options={{
newWindow: true,
sanitizeHtml: true,
stripPrefix: false,
}} />
See the Pen rpYWQR by Vas Gábor (@gvas) on CodePen.
- tagName: The wrapper element's tag name, default is
div
. - text: The text to autolink.
- options: The options to invoke Autolinker with.
Gregory Jacobs' Autolinker.js library.