Form

Complete form example showcasing all Data Entry components with proper layout and accessibility

Form

Build complete, accessible forms using DuskMoonUI’s Data Entry components. This page demonstrates all 17 form components working together in a realistic “User Profile” form context.

Quick Start

A minimal form example to get started:

Minimal Form


Complete Form Demo

The following sections demonstrate all Data Entry components organized into a comprehensive User Profile form.

Section 1: Personal Information

Personal Information

Personal Information
Type to search countries
January 2024
Su
Mo
Tu
We
Th
Fr
Sa

Section 2: Contact Details

Contact Details

Contact Details
We'll never share your email
Max 500 characters

Section 3: Preferences

Preferences

Preferences
Design
Technology
Design
Music
Sports
Travel
Select multiple interests
Engineering
Frontend
Backend
DevOps
Design
Marketing
Select your location

Section 4: Settings

Settings

Settings
Email Notifications
Contact Preference
Dark Mode
Enable dark theme across the app
0% 100%

Section 5: Feedback

Feedback

Feedback
Select 1-5 stars

Section 6: Scheduling

Scheduling

Scheduling
When should we send daily digests?

Section 7: Security

Security

Security
Enter the code from your authenticator app
Set a 4-digit PIN for quick access

Section 8: Attachments

Attachments

Attachments

Click to upload or drag and drop

PNG, JPG up to 5MB

Upload a profile picture

Form Actions

Form Actions


Form Layout Patterns

Responsive Grid Layout

Use CSS Grid or Flexbox utilities for responsive form layouts:

Responsive Grid

Fieldset Grouping

Use <fieldset> and <legend> for semantic section grouping:

Fieldset Pattern

Account Settings

Required vs Optional Fields

Field Indicators


Form States

Error State

Error State

Please enter a valid email address

Success State

Success State

Username is available!

Disabled State

Disabled State

This field is locked

API Reference

Form Group Classes

ClassDescription
.form-groupContainer for label, input, and helper text
.form-group-errorError state styling for the group
.form-group-successSuccess state styling for the group
.form-group-warningWarning state styling for the group

Label Classes

ClassDescription
.form-labelBase label styling
.form-label-requiredAdds asterisk indicator
.form-label-optionalMuted “(optional)” text
.form-label-smSmall label size
.form-label-lgLarge label size

Helper Text Classes

ClassDescription
.helper-textBase helper text styling
.helper-text-errorError message styling
.helper-text-successSuccess message styling
.helper-text-warningWarning message styling

Input State Classes

ClassDescription
.input-errorRed border for errors
.input-successGreen border for valid
.input-warningOrange border for warnings

Accessibility Guidelines

  • Always use <label> elements with for attribute linking to input id
  • Mark required fields with aria-required="true" and visual indicator
  • Use aria-describedby to link inputs to helper text
  • Use aria-invalid="true" for fields with validation errors
  • Group related checkboxes/radios in <fieldset> with <legend>
  • Ensure sufficient color contrast for all form states