Skip to main content
Version: 1.0.3

Form

The Form component is a layout component that provides smart, responsive layouts for form fields with proper spacing and alignment. It handles multi-column layouts and label positioning automatically.

Installation

ignix add component form

Usage

Import the components:

import { Form, FormField, InputWrapper } from '@ignix-ui/form';

Basic Usage

function BasicForm() {
return (
<Form spacing="comfortable" maxWidth="readable">
<FormField>
<label htmlFor="username">Username</label>
<InputWrapper>
<input
id="username"
type="text"
placeholder="Enter username"
className="w-full px-3 py-2 border rounded-md"
/>
</InputWrapper>
</FormField>

<FormField>
<label htmlFor="password">Password</label>
<InputWrapper>
<input
id="password"
type="password"
placeholder="Enter password"
className="w-full px-3 py-2 border rounded-md"
/>
</InputWrapper>
</FormField>
</Form>
);
}

Props

Form

PropTypeDefaultDescription
columns{ desktop?: number; mobile?: number; tablet?: number; }-Grid config for screen sizes.
spacing"comfortable" | "compact" | "relaxed" | "tight""comfortable"Vertical spacing between fields.
labels"top" | "left" | "floating""top"Label positioning strategy.
width"narrow" | "normal" | "wide" | "full""normal"Base width of the form.
maxWidth"readable" | "content" | "prose" | "container" | "none""readable"Maximum width of the form.
classNamestring-Custom CSS classes.
childrenReact.ReactNode-Form content.

FormField

PropTypeDefaultDescription
classNamestring-Custom CSS classes.
childrenReact.ReactNode-Field content.

InputWrapper

PropTypeDefaultDescription
classNamestring-Custom CSS classes.
childrenReact.ReactNode-Input elements.