Skip to content

Forms

A guide to building forms with Shark UI components.

Picking a form library

For detailed guides with examples, validation, and field-type-specific patterns, see the linked pages above.

Field Context

Form components automatically integrate with Field through context. When nested inside a Field, they inherit disabled, invalid, required, and readOnly states automatically.

Also htmlFor and id are automatically handled by the Field component. Never use them directly.

Input states

Invalid

Pass the invalid prop to the Field component.

The FieldError is only visible when the invalid prop is true.

Required

Pass the required prop to the Field component.

Optionally, you can use the FieldRequiredIndicator to indicate that the field is required.