Open this example in the interactive library
Live preview
Source code
// components/GraphemeClusterCounter.tsx
export default function GraphemeClusterCounter({
text = "Copper studio",
}: { text?: string } = {}) {
const segments = [
...new Intl.Segmenter(undefined, { granularity: "grapheme" }).segment(text),
];
return <output>{segments.length} visible characters</output>;
}
