Components / Content Generation

AI Translation Panel

A translation panel with language detection, multi-language output, and side-by-side comparison view.

Live Preview — ai-translation-panel-01
English
Spanish

El futuro del desarrollo de software está profundamente integrado con grandes modelos de lenguaje.

Verified Translation1.2ms latency

Installation

Dependencies

Install the core libraries required for this component.

npm
npm install react lucide-react

Source Code

ai-translation-panel-01.tsx
"use client";

import React, { useState } from "react";
import { Languages, ArrowRight, Check, History } from "lucide-react";

export default function AITranslationPanel() {
    const [source, setSource] = useState("The future of software development is deeply integrated with large language models.");

    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-4xl mx-auto overflow-hidden">
            <div className="flex items-center justify-between px-6 py-4 border-b border-zinc-100 dark:border-zinc-800 bg-zinc-50/50 dark:bg-zinc-900/50">
                <div className="flex items-center gap-4">
                    <div className="flex items-center gap-2 px-3 py-1.5 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-xs font-bold text-zinc-600 dark:text-zinc-300">
                        English
                    </div>
                    <ArrowRight className="h-3 w-3 text-zinc-400" />
                    <div className="flex items-center gap-2 px-3 py-1.5 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 text-xs font-bold text-zinc-900 dark:text-zinc-100 ring-2 ring-blue-500/20">
                        Spanish
                        <Languages className="h-3 w-3 text-blue-500" />
                    </div>
                </div>
                <button className="text-zinc-400 hover:text-zinc-600 transition-colors">
                    <History className="h-4 w-4" />
                </button>
            </div>

            <div className="grid grid-cols-1 md:grid-cols-2 divide-y md:divide-y-0 md:divide-x divide-zinc-200 dark:divide-zinc-800">
                <div className="p-6">
                    <label className="text-[10px] font-black text-zinc-400 uppercase tracking-widest mb-4 block">Source Text</label>
                    <textarea
                        value={source}
                        onChange={(e) => setSource(e.target.value)}
                        className="w-full h-32 bg-transparent text-sm text-zinc-500 dark:text-zinc-400 focus:outline-none resize-none leading-relaxed"
                    />
                </div>
                <div className="p-6 bg-blue-50/20 dark:bg-blue-900/5">
                    <label className="text-[10px] font-black text-blue-500 uppercase tracking-widest mb-4 block">AI Translation</label>
                    <p className="text-sm font-medium text-zinc-900 dark:text-zinc-100 leading-relaxed min-h-[128px]">
                        El futuro del desarrollo de software está profundamente integrado con grandes modelos de lenguaje.
                    </p>
                    <div className="mt-4 flex items-center justify-between">
                        <span className="text-[10px] font-bold text-emerald-500 flex items-center gap-1.5">
                            <Check className="h-3 w-3" />
                            Verified Translation
                        </span>
                        <span className="text-[10px] text-zinc-400 font-mono">1.2ms latency</span>
                    </div>
                </div>
            </div>
        </div>
    );
}

Functional Logic

Internal functions used to handle component logic.

Function Parameters
AITranslationPanel() None

State Management

React state variables managed within this component.

Variable Initial Value
source "The future of software development is deeply integrated with large language models."

JSX Tags Usage

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

Tag Count Type Source
<ArrowRight> Library lucide-react
<Check> Library lucide-react
<History> Library lucide-react
<Languages> Library lucide-react
<button> Native Native HTML
<div> Native Native HTML
<label> Native Native HTML
<p> Native Native HTML
<span> Native Native HTML
<textarea> 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 Code Generator — A code generation interface with language selector, framework presets, and syntax-highlighted output.
  • AI Email Composer — An AI-powered email composer with tone adjustment, template selection, and subject line generation.