Dev Helpers
← Back

Contact email shortcut

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

Open this example in the interactive library

Live preview

Source code

// components/ContactEmailShortcut.tsx

export default function ContactEmailShortcut({
  name = "Mira Bell",
  role = "Editor",
}: { name?: string; role?: string } = {}) {
  const subject = encodeURIComponent("For " + name + " · " + role);
  return <a href={"mailto:?subject=" + subject}>Draft a message for {name}</a>;
}