Include a character map in your app using our React Character Map.
It provides a simple interface for users to select a character from a list of categorised characters.
npm install react-character-map
or
yarn add react-character-map
// Import the module into your react app
import {CharacterMap} from 'react-character-map';
// Use the element;
<CharacterMap onSelect={function(char,el){ console.log(char, el); }} />
The only property on the element is the onSelect
callback. This is fired when the user clicks on a character, and has two parameters;
onSelect(char, el)
char
is an Object of the character that has been selected, for instance;
{ "hex": "ćB;", "name": "BLACK SMILING FACE", "char": "☻" }
or
{ "char":"ø" }
The second parameter el
is the element that has been selected, this is an anchor.
<a data-hex="�D8;" data-entity="Ø" data-char="Ø" data-title="LATIN CAPITAL LETTER O WITH STROKE">Ø</a>
The package comes with very basic styling, it is recommended that you style it to match your app.