Dev Helpers
← Back

Inline abbreviation builder

Import and render <InlineAbbreviationBuilder /> in a React project.

Open this example in the interactive library

Live preview

Source code

// components/InlineAbbreviationBuilder.tsx

export default function InlineAbbreviationBuilder({
  text = "Copper studio",
}: { text?: string } = {}) {
  const letters = text
    .split(/\s+/)
    .map((w) => w[0])
    .join("")
    .toUpperCase();
  return (
    <p>
      <abbr title={text}>{letters}</abbr> ({text})
    </p>
  );
}