Dev Helpers
← Back

Font family comparison

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

Open this example in the interactive library

Live preview

Source code

// components/FontFamilyComparison.tsx

import type { ReactNode } from "react";

export default function FontFamilyComparison({
  children = "Preview text",
}: { children?: ReactNode } = {}) {
  return (
    <div>
      {["serif", "sans-serif", "monospace"].map((font) => (
        <p key={font} style={{ fontFamily: font }}>
          {font}: {children}
        </p>
      ))}
    </div>
  );
}