Skip to content

Form Input Component ​

Overview ​

The <form-input> component provides a standardized input field for forms in the Qelos template ecosystem. It wraps the Element Plus input components with additional functionality and styling consistent with the Qelos design system.

This component includes enhanced user experience features such as validation, input masking, tooltips, animations, and responsive design to create intuitive and user-friendly forms.

Usage ​

html
<form-input
  label="Username"
  v-model="username"
  placeholder="Enter your username"
  required
></form-input>

Props ​

Basic Props ​

PropTypeDefaultDescription
titleString-The label for the input field
labelString-Additional label text (shown in parentheses)
modelValueAny-The value of the input (use with v-model)
placeholderString-Placeholder text when input is empty
requiredBooleanfalseWhether the field is required
disabledBooleanfalseWhether the input is disabled
typeString'text'Input type (text, textarea, password, number, select, switch, color, file, upload, icon, etc.)
clearableBooleantrueWhether the input can be cleared
sizeString'large'Size of the input (large, default, small)
loadingBooleanfalseWhether the input is in loading state

Validation Props ​

PropTypeDefaultDescription
rulesObject/Array-Validation rules object or array of rule objects
validationTriggerString'blur'When to trigger validation (blur, change)
showValidationSuccessBooleanfalseWhether to show success indicator when validation passes
validationSuccessMessageString'Valid input'Custom message to show when validation passes
validateOnMountBooleanfalseWhether to validate the input when component mounts

Help and Guidance Props ​

PropTypeDefaultDescription
helpTextString-Help text shown below the input
descriptionString-Additional description text
tooltipString-Tooltip text shown in popover when clicking the info icon
tooltipSimpleString-Tooltip text shown on hover of info icon
tooltipEffectString'light'Tooltip effect (light, dark)
helpContentString-Rich HTML content for help popover
helpPopoverWidthNumber300Width of the help popover in pixels

Text Input Props ​

PropTypeDefaultDescription
maxlengthNumber-Maximum length of text input
showCharCountBooleanfalseWhether to show character counter
showPasswordToggleBooleantrueFor password fields, whether to show the toggle button

Number Input Props ​

PropTypeDefaultDescription
minNumber-Minimum value
maxNumber-Maximum value
stepNumber1Step increment
precisionNumber-Decimal precision

Select Props ​

PropTypeDefaultDescription
optionsArray-Options for select dropdown
optionValueString-Property name for option value
optionLabelString-Property name for option label
selectOptionsObject{}Additional options for el-select

Input Masking Props ​

PropTypeDefaultDescription
maskString-Custom mask pattern (e.g., '###-##-####' for SSN)
maskHintString-Hint text shown in the input to indicate format
maskPlaceholderString'_'Character used for unfilled mask positions
maskPreserveBooleanfalseWhether to preserve mask characters in the value
maskPresetString-Predefined mask type (phone, date, time, credit-card, etc.)

Icon and Decoration Props ​

PropTypeDefaultDescription
prefixIconString-Icon component name to show as prefix
suffixIconString-Icon component name to show as suffix
prependString-Text to prepend to input
appendString-Text to append to input

Events ​

EventParametersDescription
update:modelValue(value: any)Emitted when the input value changes
input(event)Native input event
change(event)Native change event
focus(event: FocusEvent)Emitted when the input is focused
blur(event: FocusEvent)Emitted when the input loses focus
validate(isValid: boolean)Emitted after validation with result

Slots ​

SlotDescription
preContent to insert before the input
prefixContent for input prefix area
suffixContent for input suffix area
prependContent to prepend to input
appendContent to append to input
optionsCustom options for select input
defaultAdditional content after the input

Examples ​

Basic Usage ​

html
<form-input
  title="Email"
  v-model="email"
  placeholder="Enter your email"
  required
></form-input>

With Validation ​

html
<form-input
  title="Email Address"
  v-model="email"
  type="email"
  placeholder="Enter your email"
  :rules="{
    required: true,
    pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
    message: 'Please enter a valid email address'
  }"
  helpText="We'll never share your email with anyone else."
></form-input>

With Rich Help Content ​

html
<form-input
  title="API Key"
  v-model="apiKey"
  :helpContent="`<h4>Where to find your API Key</h4>
  <p>You can find your API key in your account settings:</p>
  <ol>
    <li>Log in to your account</li>
    <li>Go to Settings > API</li>
    <li>Click 'Generate New Key'</li>
  </ol>`"
  helpText="Enter the API key provided by the service"
></form-input>

With Input Masking ​

html
<form-input
  title="Phone Number"
  v-model="phoneNumber"
  mask="+1 (###) ###-####"
  maskHint="Format: +1 (555) 555-5555"
  placeholder="Enter phone number"
></form-input>

Using Mask Presets ​

html
<form-input
  title="Credit Card"
  v-model="creditCard"
  maskPreset="credit-card"
  maskHint="Format: XXXX XXXX XXXX XXXX"
></form-input>

With Icons ​

html
<form-input
  title="Search"
  v-model="search"
  prefixIcon="Search"
  placeholder="Search..."
  clearable
></form-input>

Number Input with Min/Max ​

html
<form-input
  title="Quantity"
  v-model="quantity"
  type="number"
  :min="1"
  :max="100"
  :step="1"
></form-input>

Password with Toggle ​

html
<form-input
  title="Password"
  v-model="password"
  type="password"
  showPasswordToggle
  :rules="{ required: true, min: 8 }"
  helpText="Password must be at least 8 characters long"
></form-input>

Text Input with Character Counter ​

html
<form-input
  title="Bio"
  v-model="bio"
  type="textarea"
  :maxlength="200"
  showCharCount
  placeholder="Tell us about yourself"
></form-input>

Select with Options ​

html
<form-input
  title="Country"
  v-model="country"
  type="select"
  :options="countries"
  optionValue="code"
  optionLabel="name"
  placeholder="Select a country"
></form-input>

Form Group Component ​

The FormGroup component is designed to work with FormInput to group related fields together.

Basic Usage ​

html
<form-group label="Contact Information" direction="row">
  <form-input v-model="firstName" title="First Name" />
  <form-input v-model="lastName" title="Last Name" />
  <form-input v-model="email" title="Email" type="email" />
</form-group>

Props ​

PropTypeDefaultDescription
labelString-Group label
tooltipString-Tooltip for the group
helpTextString-Help text for the group
directionString'row'Layout direction (row, column)
labelPositionString'top'Label position (top, side)
borderedBooleanfalseWhether to show a border around the group
compactBooleanfalseWhether to use compact spacing
idString-ID for the group

Example with Form Group ​

html
<form-group label="Shipping Address" tooltip="Where should we ship your order?" bordered>
  <form-input v-model="address.street" title="Street Address" />
  <form-group direction="row">
    <form-input v-model="address.city" title="City" />
    <form-input v-model="address.state" title="State" type="select" :options="states" />
    <form-input v-model="address.zip" title="ZIP Code" mask="#####" />
  </form-group>
</form-group>

© Velocitech LTD. All rights reserved.

Build SaaS Products Without Limits.