A beautiful neumorphic input field with embossed styling, smooth focus transitions, and tactile visual feedback for form interactions.
"use client";
import { motion } from "motion/react";
import { Search } from "lucide-react";
import { useState } from "react";
export default function NeumorphInput() {
const [isFocused, setIsFocused] = useState(false);
return (
<div className="flex items-center justify-center">
<motion.div
initial={{ opacity: 0, y: 10 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.4, ease: [0.23, 1, 0.32, 1] }}
className="relative flex items-center rounded-full px-4 py-3 w-75 bg-[#1e1e1e] border border-zinc-800/50"
style={{
boxShadow: isFocused
? "inset 4px 4px 8px #0a0a0a, inset -4px -4px 8px #2a2a2a, 0 0 0 2px rgba(161, 161, 170, 0.15)"
: "inset 4px 4px 8px #0a0a0a, inset -4px -4px 8px #2a2a2a, 0 4px 12px rgba(0, 0, 0, 0.3)",
transition: "box-shadow 0.25s ease",
}}
>
<motion.div
animate={{ scale: isFocused ? 1.15 : 1, opacity: isFocused ? 1 : 0.5 }}
transition={{ duration: 0.2, ease: "easeOut" }}
>
<Search className="w-4 h-4 text-zinc-400 mr-3 shrink-0" />
</motion.div>
<input
type="text"
placeholder="Search..."
onFocus={() => setIsFocused(true)}
onBlur={() => setIsFocused(false)}
className="w-full bg-transparent text-zinc-100 placeholder-zinc-500 outline-none text-sm font-medium"
/>
</motion.div>
</div>
);
}