The Form component provides a complete solution for creating forms with built-in validation, submission handling, and responsive layouts.
Example
Contact Form
Fill out this form to get in touch with our team.
<div style="max-width:600px"><div class="w-full "><div class=""><div class="mb-6"><h2 class="text-xl font-bold mb-2">Contact Form</h2><p>Fill out this form to get in touch with our team.</p></div><div class=""><form class="skin-form" noValidate=""><div class="space-y-4"><div class="w-full"><div class="space-y-1 wrapper group skin-form
}"><div class="flex justify-between items-center mx-2 "><div class="flex items-center space-x-2"><label class="text-body font-semi-bold" for="name">Your Name</label><span class="text-sm font-light soft" aria-hidden="true">Required</span></div></div><div class="input-field-wrapper"><input id="name" required="" aria-invalid="false" class="input-field skin-form !text-body placeholder:soft interactive " name="name"/></div><div class="input-helper-wrapper"></div></div></div><div class="w-full"><div class="space-y-1 wrapper group skin-form
}"><div class="flex justify-between items-center mx-2 "><div class="flex items-center space-x-2"><label class="text-body font-semi-bold" for="message">Your Message</label><span class="text-sm font-light soft" aria-hidden="true">Required</span></div></div><div class="input-field-wrapper"><div class="skin-form input-wrapper w-full"><textarea id="message" name="message" required="" aria-invalid="false" class="input-field !text-body placeholder:soft interactive "></textarea><svg class="resize-handle soft" viewBox="0 0 16 16" fill="currentColor"><path d="M12.9627 2L2 12.9843L3.01375 14L13.9764 3.01575L12.9627 2Z"></path><path d="M6.50295 12.9843L12.9862 6.48819L14 7.50394L7.5167 14L6.50295 12.9843Z"></path><path d="M11.0766 12.937L12.9862 11.0236L14 12.0394L12.0904 13.9528L11.0766 12.937Z"></path></svg></div></div><div class="input-helper-wrapper"></div></div></div></div><div class="mt-6 flex gap-4"><button class="interactive btn skin-primary-emphasised interactive " type="submit">Send Message</button></div></form></div></div></div></div>
<div style="max-width:600px"><div class="w-full "><div class=""><div class="mb-6"><h2 class="text-xl font-bold mb-2">Contact Form</h2><p>Fill out this form to get in touch with our team.</p></div><div class=""><form class="skin-form" noValidate=""><div class="space-y-4"><div class="w-full"><div class="space-y-1 wrapper group skin-form
}"><div class="flex justify-between items-center mx-2 "><div class="flex items-center space-x-2"><label class="text-body font-semi-bold" for="name">Your Name</label><span class="text-sm font-light soft" aria-hidden="true">Required</span></div></div><div class="input-field-wrapper"><input id="name" required="" aria-invalid="false" class="input-field skin-form !text-body placeholder:soft interactive " name="name"/></div><div class="input-helper-wrapper"></div></div></div><div class="w-full"><div class="space-y-1 wrapper group skin-form
}"><div class="flex justify-between items-center mx-2 "><div class="flex items-center space-x-2"><label class="text-body font-semi-bold" for="message">Your Message</label><span class="text-sm font-light soft" aria-hidden="true">Required</span></div></div><div class="input-field-wrapper"><div class="skin-form input-wrapper w-full"><textarea id="message" name="message" required="" aria-invalid="false" class="input-field !text-body placeholder:soft interactive "></textarea><svg class="resize-handle soft" viewBox="0 0 16 16" fill="currentColor"><path d="M12.9627 2L2 12.9843L3.01375 14L13.9764 3.01575L12.9627 2Z"></path><path d="M6.50295 12.9843L12.9862 6.48819L14 7.50394L7.5167 14L6.50295 12.9843Z"></path><path d="M11.0766 12.937L12.9862 11.0236L14 12.0394L12.0904 13.9528L11.0766 12.937Z"></path></svg></div></div><div class="input-helper-wrapper"></div></div></div></div><div class="mt-6 flex gap-4"><button class="interactive btn skin-primary-emphasised interactive " type="submit">Send Message</button></div></form></div></div></div></div>
Usage
import Form from "@altitude/ui/react/components/form";
import TextInputField from "@altitude/ui/react/components/fields/text-input-field";
import TextAreaField from "@altitude/ui/react/components/fields/text-area-field";
export default function ContactPage() {
const handleSubmit = (data) => {
console.log("Form submitted:", data);
description="Fill out this form to get in touch with our team."
submitText="Send Message"
submittedText="Message Sent Successfully!"
errorMessage="Name is required"
errorMessage="Please provide a message"
Props
| Prop | Type | Required | Description |
|---|
| title | string | Yes | Form title displayed at the top |
| description | string | No | Form description text |
| onSubmit | function | Yes | Handler function that receives form data |
| submitText | string | Yes | Text for the submit button |
| submittedText | string | No | Success message shown after form submission |
| children | ReactNode | No | Form field components |
| className | string | No | Additional CSS classes |
| splitLayout | boolean | No | Whether to use a split layout (title/description on left, form on right) |
Features
- Automatic form validation with error handling
- Support for various field types
- Responsive layout options
- Success state management
- Form state tracking (submitting, submitted)