Skip to content

Form Group ​

Form label, caption, and other stuff.

Usage ​

Simple Usage ​

preview
vue
<template>
  <p-form-group label="First Name">
    <p-input />
  </p-form-group>
</template>

Advance Usage ​

preview
vue
<template>
  <p-form-group
    label="First Name"
    caption="This is caption"
    description="This is description"
    hint="This is hint"
    required>
    <p-input />
  </p-form-group>
</template>

Required Mode ​

Add little marker for required form using prop required.

preview
vue
<template>
  <p-form-group
    label="First Name"
    required>
    <p-input />
  </p-form-group>
</template>

Caption ​

Add sub-label using caption prop.

preview
vue
<template>
  <p-form-group
    label="First Name"
    caption="Lorem Ipsum dolor sitar">
    <p-input />
  </p-form-group>
</template>

Description ​

Add decription note below the form input using description prop.

preview
vue
<template>
  <p-form-group
    label="First Name"
    description="Lorem Ipsum dolor sitar">
    <p-input />
  </p-form-group>
</template>

Error Message ​

Error message from validation can be add in here using prop error. Note, it'll replace description message.

preview
vue
<template>
  <p-form-group
    label="First Name"
    description="Lorem Ipsum dolor sitar"
    error="Please fill this field">
    <p-input />
  </p-form-group>
</template>

With icon ​

Show error icon with prop error-icon. Note, it'll only show if prop error was provided too.

preview
vue
<template>
  <p-form-group
    label="First Name"
    description="Lorem Ipsum dolor sitar"
    error="Please fill this field"
    error-icon>
    <p-input />
  </p-form-group>
</template>

Hint tooltip ​

Easy add hint tooltip using prop hint.

preview
vue
<template>
  <p-form-group
    label="First Name"
    hint="Lorem Ipsum dolor sitar">
    <p-input />
  </p-form-group>
</template>

Horizontal Layout ​

preview
vue
<template>
  <p-form-group
    horizontal
    required
    label="First Name"
    description="This is description">
    <p-input />
  </p-form-group>
</template>

API ​

Props ​

PropsTypeDefaultDescription
labelString-Form group label
requiredBooleanfalseRequired flag
captionString-Sublabel caption
descriptionString-Description note
hintString-Tooltip hint
errorString-Error validation message
error-iconBooleanfalseShow error icon
horizontalBooleanfalseHorizontal layout

Slots ​

NameDescription
labelContent to used as label
captionContent to used as caption
descriptionContent to used as description
hintContent to used as hint
errorContent to used as error

Events ​

NameArgumentsDescription
There no event here

Released under the MIT License.