Skip to Content

Form Fields

Field components from @/components/ui (vendored form builder). Resource 2.0 uses a subset of these when generating create/edit pages.

Shared Props

Every field accepts:

PropTypeDescription
accessorstringForm value key (required)
labelstringVisible label
placeholderstringPlaceholder text
helperTextstringHelp copy under the field
disabledbooleanDisable input
requiredbooleanRequired validation
tooltipstringExtra hint
validationValidationRuleCustom rules
classNamestringExtra classes

See Form API for TypeScript types.

FormInput

Text, email, password, url, tel, number. numeric forces a number input (Resource 2.0 uses this for Int / Float / Decimal).

<FormInput accessor="name" label="Name" required /> <FormInput accessor="email" label="Email" type="email" required /> <FormInput accessor="age" label="Age" numeric />

Resource 2.0 picks type="email" / type="password" from the Prisma field name.

FormTextarea

Multi-line text. Resource 2.0 uses this for Json.

<FormTextarea accessor="bio" label="Bio" rows={4} />

FormCheckbox / FormToggle

Booleans. Resource 2.0 maps Boolean → FormCheckbox.

<FormCheckbox accessor="published" label="Published" /> <FormToggle accessor="notifications" label="Notifications" />

FormSelect

Static or dynamic options. Resource 2.0 uses this for Prisma enums and belongsTo relations (options={userOptions}).

<FormSelect accessor="role" label="Role" options={[ { label: 'User', value: 'user' }, { label: 'Admin', value: 'admin' }, ]} />
PropTypeDescription
options{ label, value, disabled? }[]Choices
multiplebooleanMulti-select
searchablebooleanFilter options
clearablebooleanAllow empty
nativebooleanNative <select>

M2M relations are not create/edit FormSelects in 1.6.0 — they render as lists on the view page.

FormDatePicker / FormDateTimePicker

Resource 2.0 maps DateTime → FormDateTimePicker.

<FormDatePicker accessor="birthday" label="Birthday" /> <FormDateTimePicker accessor="publishedAt" label="Published at" />

Other Fields

These ship in the component library; shadpanel resource does not emit them automatically:

  • FormTagsInput — string lists
  • FormFileUpload — files
  • FormKeyValue — key/value pairs
  • FormMarkdownEditor / FormRichEditor — long content
<FormTagsInput accessor="tags" label="Tags" /> <FormFileUpload accessor="avatar" label="Avatar" accept="image/*" />

Resource 2.0 Mapping

Full table: shadpanel resource.

Next Steps

Last updated on