Dev Helpers
← Back

Reading time estimate

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

Open this example in the interactive library

Live preview

Source code

// components/ReadingTimeEstimate.tsx

export default function ReadingTimeEstimate({
  text = "Studio notes from the harbour",
}: { text?: string } = {}) {
  const words = text.trim() ? text.trim().split(/\s+/).length : 0;
  return (
    <small>
      {Math.ceil(words / 200)} min read · {words} words
    </small>
  );
}