formgradientintermediate
Gradient Form
A contact form card with a gradient header and clean input styling.
Preview
Contact Us
We'd love to hear from you.
<div class="max-w-md mx-auto rounded-2xl overflow-hidden shadow-xl">
<div class="bg-gradient-to-r from-violet-600 to-indigo-600 px-8 py-6">
<h2 class="text-xl font-bold text-white">Contact Us</h2>
<p class="text-violet-200 text-sm">We'd love to hear from you.</p>
</div>
<form class="bg-white px-8 py-6 space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
<input type="text" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-transparent" placeholder="John Doe" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-transparent" placeholder="john@example.com" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Message</label>
<textarea rows="3" class="w-full px-4 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-violet-500 focus:border-transparent resize-none" placeholder="Your message..."></textarea>
</div>
<button type="submit" class="w-full py-3 bg-gradient-to-r from-violet-600 to-indigo-600 text-white font-semibold rounded-lg hover:shadow-lg transition-shadow">Send Message</button>
</form>
</div>Color Breakdown
Header Start
from-violet-600
#7c3aed
Header End
to-indigo-600
#4f46e5
Header Text
text-white
#ffffff
Subtitle
text-violet-200
#ddd6fe
Input Border
border-gray-300
#d1d5db
Focus Ring
focus:ring-violet-500
#8b5cf6
Dark Mode Variant
Add these Tailwind classes for a dark mode adaptation of this recipe.
dark:bg-gray-800 dark:border-gray-600 dark:text-whiteUse Cases
Contact pagesSupport ticket formsFeedback forms
Browser Support
All modern browsers.
Related Recipes
Build Your Own Color Recipe
Use our Tailwind CSS tools to experiment with colors, gradients, and component styles.
Explore ToolsFrequently Asked Questions
How do I add form validation styling?▼
Use the invalid: modifier for red borders and error messages, e.g. invalid:border-red-500 and show an error span conditionally.