Dev HelpersOpen library
← Back

Rectangle diagonal

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

Open this example in the interactive library

Live preview

Source code

// components/RectangleDiagonal.tsx

export default function RectangleDiagonal({
  width = 12,
  height = 8,
}: { width?: number; height?: number } = {}) {
  return <p>Diagonal: {Math.hypot(width, height).toFixed(2)} units</p>;
}