PyBlade/ui
Menu⌄
DocsComponentsField

Field

A form field: label, control, description and error, wired to @error.

depends on input4 files

Installation

pyblade-ui add field

Usage

The tags <pb-ui.field> <pb-ui.field-label> <pb-ui.field-description> <pb-ui.field-error> are available in all your templates.

<pb-ui.field :errors="form.errors" name="email">
  <pb-ui.field-label for="email">Email</pb-ui.field-label>
  <pb-ui.input id="email" name="email" type="email" />
  <pb-ui.field-description>We never share it.</pb-ui.field-description>
  <pb-ui.field-error :errors="form.errors" name="email" />
</pb-ui.field>

Examples

With an error

Horizontal

With form errors (@error)

Props

<pb-ui.field>
PropDefault
orientation'vertical'
invalidFalse
errorsNone
name''
<pb-ui.field-error>
PropDefault
errorsNone
name''

Any other attribute (class, id, x-on:click, hx-post…) is passed to the root element; your Tailwind classes win over the component's.