Skip to content

Form ​

Use bo-form as the form element and bo-form-field to group a label, description, control, and error.

Usage ​

Use your work address.

Not submitted
<bo-form @submit.prevent="submitted = true">
  <bo-form-field v-slot="{ id, ariaDescribedBy, ariaInvalid }" label="Email" description="Use your work address." required>
    <bo-input :id="id" :aria-described-by="ariaDescribedBy" :aria-invalid="ariaInvalid" v-model="email" type="email" />
  </bo-form-field>
  <bo-button class="mt-4" type="submit">Save</bo-button>
</bo-form>

Error state ​

Pass the validation message to error on the field.

<bo-form-field v-slot="{ id, ariaDescribedBy, ariaInvalid }" label="Password" error="Use at least 8 characters." required>
  <bo-input :id="id" :aria-described-by="ariaDescribedBy" :aria-invalid="ariaInvalid" type="password" />
</bo-form-field>

API ​

Component / prop / event / slotTypeDefaultDescription
BoFormcomponent-Native form wrapper.
id / dataTestIdstringautogeneratedForm attributes.
ariaLabelstring-Accessible form name.
novalidatebooleanfalseDisables the browser's native validation UI.
submit(event: SubmitEvent) event-Emitted on submit.
reset(event: Event) event-Emitted when the form resets.
defaultslot-Form fields and actions.
BoFormFieldcomponent-Groups field content and its messages.
id / dataTestIdstringautogeneratedField attributes and generated control prefix.
label / description / errorstring-Field label, supporting text, and validation message.
required / disabledbooleanfalseField state flags.
defaultscoped slot{ id, ariaDescribedBy, ariaInvalid }Bind these values to the field control.

Released under the MIT License.