Components / Content Generation

AI Email Composer

An AI-powered email composer with tone adjustment, template selection, and subject line generation.

Live Preview — ai-email-composer-01
Smart Draft
Subject:Partnership Proposal - AI Integration

Dear Team,

I hope this email finds you well. I'm reaching out to discuss a potential partnership regarding the integration of our new LLM stack into your existing workflow. Given your recent focus on scalability, I believe our solution could provide significant efficiency gains...

AI Enhanced

Installation

Dependencies

Install the core libraries required for this component.

npm
npm install react lucide-react

Source Code

ai-email-composer-01.tsx
"use client";

import React, { useState } from "react";
import { Mail, Send, Sparkles, Smile, Paperclip } from "lucide-react";

export default function AIEmailComposer() {
    const [tone, setTone] = useState("Professional");

    return (
        <div className="rounded-xl border border-zinc-200 dark:border-zinc-800 bg-white dark:bg-zinc-950 shadow-sm w-full max-w-2xl mx-auto overflow-hidden">
            <div className="px-6 py-4 flex items-center justify-between border-b border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-900/50">
                <div className="flex items-center gap-2">
                    <Mail className="h-4 w-4 text-blue-500" />
                    <span className="text-sm font-bold text-zinc-900 dark:text-zinc-100">Smart Draft</span>
                </div>
                <div className="flex items-center gap-2">
                    {["Professional", "Casual", "Urgent"].map(t => (
                        <button
                            key={t}
                            onClick={() => setTone(t)}
                            className={`px-3 py-1.5 rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all ${tone === t ? "bg-zinc-900 text-white shadow-sm" : "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300"
                                }`}
                        >
                            {t}
                        </button>
                    ))}
                </div>
            </div>

            <div className="p-6 space-y-4">
                <div className="flex items-center gap-4 py-2 border-b border-zinc-100 dark:border-zinc-800">
                    <span className="text-xs font-medium text-zinc-400 w-12 shrink-0">Subject:</span>
                    <span className="text-xs font-bold text-zinc-900 dark:text-zinc-100">Partnership Proposal - AI Integration</span>
                </div>

                <div className="relative min-h-[200px] py-4">
                    <p className="text-sm text-zinc-600 dark:text-zinc-400 leading-relaxed">
                        Dear Team,<br /><br />
                        I hope this email finds you well. I'm reaching out to discuss a potential partnership regarding the integration of our new LLM stack into your existing workflow. Given your recent focus on scalability, I believe our solution could provide significant efficiency gains...
                    </p>
                    <div className="absolute bottom-0 right-0 p-3 rounded-2xl bg-gradient-to-br from-blue-500/10 to-violet-500/10 flex items-center gap-2 border border-blue-500/10">
                        <Sparkles className="h-4 w-4 text-blue-500 lg:animate-bounce" />
                        <span className="text-[10px] font-black text-blue-600 uppercase tracking-widest">AI Enhanced</span>
                    </div>
                </div>
            </div>

            <div className="px-6 py-4 border-t border-zinc-100 dark:border-zinc-800 flex items-center justify-between">
                <div className="flex items-center gap-4">
                    <button className="text-zinc-400 hover:text-zinc-600 transition-colors">
                        <Smile className="h-5 w-5" />
                    </button>
                    <button className="text-zinc-400 hover:text-zinc-600 transition-colors">
                        <Paperclip className="h-5 w-5" />
                    </button>
                </div>
                <button className="flex items-center gap-2 px-6 py-2 rounded-xl bg-blue-600 text-white text-xs font-bold hover:bg-blue-700 transition-all shadow-lg shadow-blue-500/20">
                    Send Draft
                    <Send className="h-3.5 w-3.5" />
                </button>
            </div>
        </div>
    );
}

Functional Logic

Internal functions used to handle component logic.

Function Parameters
AIEmailComposer() None

State Management

React state variables managed within this component.

Variable Initial Value
tone "Professional"

JSX Tags Usage

Every JSX/HTML tag used in this component, with usage count and source.

Tag Count Type Source
<Mail> Library lucide-react
<Paperclip> Library lucide-react
<Send> Library lucide-react
<Smile> Library lucide-react
<Sparkles> Library lucide-react
<br> Native Native HTML
<button> Native Native HTML
<div> 10× Native Native HTML
<p> Native Native HTML
<span> Native Native HTML

Related Components

  • AI Text Generator — A text generation interface with tone selector, length control, and real-time AI-powered content creation.
  • AI Image Prompt Builder — A guided image prompt builder with style presets, aspect ratio selector, and negative prompt support.
  • AI Content Rewriter — A before/after content rewriter showing original text alongside AI-improved versions with diff highlighting.
  • AI Summarizer Card — A document summarization card with adjustable summary length, key points extraction, and bullet-point output.
  • AI Translation Panel — A translation panel with language detection, multi-language output, and side-by-side comparison view.
  • AI Code Generator — A code generation interface with language selector, framework presets, and syntax-highlighted output.