page FormFieldcomponent { seo { title = "FormField component" description = "Reusable form field component." } view {
W WRNexusJS
forms component

FormField

Reusable form field component.

@wrnexus/ui 0.2.655 props1 slots0 events

Usage

Components are auto-discovered. Use the component directly in any .wrn view:

<FormField label="Field" help="help" error="error" required="false" />

Legacy mount name: data-component="FormField".

Props and attributes

PropTypeRequirementDefault
classstringOptional""
labelstringOptional"Field"
helpstringOptional""
errorstringOptional""
requiredbooleanOptionalfalse

Slots

  • default

Events

This component does not declare a custom event.

Source contract

Installed source: components/FormField.wrn

component FormField {
  props {
    class = ""
    label = "Field"
    help = ""
    error = ""
    required = false
  }
  view {
    <div class="space-y-2 {class}"><div class="text-sm font-semibold">{label}<span data-show="required" class="ml-1 text-red-500">*</span></div><slot /><p data-show="help && !error" class="text-sm text-slate-500">{help}</p><p data-show="error" role="alert" class="text-sm font-medium text-red-600">{error}</p></div>
  }
}
} }