Skip to content

Princezhm/react-format-text

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-format-text

React component for formatting newlines and links. See the live demo.

npm install react-format-text

Usage

Newlines are converted to <br> elements and words looking like URLs are replaced with appropriate <a> elements. By default all absolute links have target set to _blank and rel to noopener noreferrer. It's possible to override this by passing the target and rel property to the component.

var React = require('react');
var Text = require('react-format-text');

var App = React.createClass({
	render: function() {
		return <Text>{'Hello\nhttp://example.com'}</Text>;
	}
});

About

Simple link and newline text formatting for react

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%