Contact Form
Contact details beside a validated form that you connect to your own backend.
Installation
npx shadcn@latest add @venusui/contact-01Run this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Files added to your project
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/floating-label-input.tsxfrom floating-label-input@/components/contact-01.tsx
Also adds the shadcn button component if your project doesn't have it yet.
Usage
The code behind the preview above.
contact-01-demo.tsx
import { Contact01 } from "@/components/contact-01"
// No onSubmit here, so submitting shows that the form isn't connected yet.
// In your app, pass a handler that calls a Server Action or API route.
export default function Contact01Demo() {
return <Contact01 />
}
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| onSubmit | (data: { name: string; email: string; message: string }) => Promise<void> | void | — | Sends the message, e.g. by calling a Server Action. Throw to show an error. Without it, submitting explains the form isn’t connected. |
Only the prop above.
Requirements
- shadcn
buttonand VenusUIfloating-label-input. The CLI installs both. lucide-react, React 19 and Tailwind CSS v4.
Customization
- Connect it:
<Contact01 onSubmit={sendMessage} />, wheresendMessageis a Server Action that emails you or stores the message. - Validate again on the server; the browser’s
requiredandtype="email"checks are only a convenience. - Replace the email address, chat hours and location with your own.
Accessibility
- Every field has a visible label. Required fields use native validation messages.
- The result (sending, sent, error) is announced through a status region.
Troubleshooting
- Submitting says the form isn’t connected.
- Pass an
onSubmithandler. The block never pretends to send a message it didn’t send. - Spam submissions.
- Add a honeypot field or a CAPTCHA, and rate-limit your Server Action.
Unknown registry "@venusui"- Your shadcn CLI couldn’t find the namespace in the shadcn registry index. Use the latest CLI (
npx shadcn@latest), install by URL, or register it with its address:npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json. No components.json found- Run
npx shadcn@latest initin your project first.