Highlight all hashtags in text
npm install react-highlight-hashtagsreact-highlight-hashtags is component for React to check hashtags in text.
js
// using ES modules
import Hashtags from 'react-highlight-hashtags';
`
Basic usage
Render a component with ot without a text prop whose value is a valid text. The children prop should be a text.
`jsx
import React from 'react';
import Hashtags from 'react-highlight-hashtags';
class App extends React.Component {
render() {
return (
Hi, #highlight #hash tags
);
}
}
`
`jsx
import React from 'react';
import Hashtags from 'react-highlight-hashtags';
class App extends React.Component {
render() {
return (
);
}
}
`
props
There is only one optional props.
|prop|description|example|
|---|---|---|
|text|any text with or without #hashtags.||
|children|any text with or without #hashtags.||
style
If you are using bootstrap then mark tag will appear in yellow background.
`css
mark {
background:none;
color:rgb(250, 93, 58);
cursor:pointer;
}
`
About
react-highlight-hashtags` is developed and maintained by Krishna Kumar.