Skip to content

Commit 2ceef64

Browse files
committed
docs: add splitter emoji example
1 parent 2c76368 commit 2ceef64

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,23 @@ This function will be called when the typing animation finishes. It will be call
125125

126126
`Typist` will use this to get tokens from strings. It may be useful when you want to split your string in different way. For example, you can use [grapheme-splitter](https://github.com/orling/grapheme-splitter) to split string if your string contains emoji.
127127

128+
```tsx
129+
import GraphemeSplitter from 'grapheme-splitter';
130+
131+
const splitter = (str: string) => {
132+
return new GraphemeSplitter().splitGraphemes(str);
133+
};
134+
135+
const App = () => {
136+
return (
137+
<Typist splitter={splitter}>
138+
😎🗑🥵⚠😀👍✌👨‍👨‍👧‍👦📏💡🚀🎂😓🎈💕😘
139+
<Typist.Backspace count={16} />
140+
</Typist>
141+
);
142+
};
143+
```
144+
128145
#### `cursor`
129146

130147
Will be inserted after the last typed token.

0 commit comments

Comments
 (0)