2.2.0 • Published 5 years ago

vue-form-components v2.2.0

Weekly downloads
37
License
MIT
Repository
github
Last release
5 years ago

Vue Form Components

Build Status npm version npm

This package provides easy form wrappers for Vue2, based upon the Bootstrap v4 CSS Framework.

There are a variety of components that this package provides. These are:

  • Standard Input Box
  • Text Area
  • Select List
  • Toggle Switch
  • File Browser

Installation

You can install this package by running the following command: npm install --save vue-form-components or yarn add vue-form-components

You can then import this package into your project.

Import VueFormComponents from 'vue-form-components'

Usage

I recommend when using this package to declare the components as global components. This can be done one of the following ways:

Import VueFormComponents from 'vue-form-components';
Vue.component('input-box', VueFormComponents.InputBox);

Standard Input Box

This component is designed to save time and repetition by not having to duplicate form groups. The name for this component is InputBox. This component can be used in conjunction with the v-model directive. Below is an example of how you might use the component:

<input-box name="email" type="email" label="Your Email" helper="Please enter your email address" v-model="email"></input-box>

Addons

With the Standard input box component, you can also use input group addons. This can be done by simply adding slots.

SlotDescription
leftAddonA standard input group addon on the left side of the input field
rightAddonA standard input group addon on the right side of the input field
leftButtonAn input group button on the left side of the input field
rightButtonAn input group button on the right side of the input

For example, if I wanted to create an input box, with an addon on the right hand side, I could do the following:

<input-box v-model="model" name="email_address" label="Email Address">
    <div slot="rightAddon">@example.com</div>
</input-box>

Alternatively, for a button on the right hand side, I could do the following:

<input-box v-model="model" name="email_address" label="Email Address">
    <button slot="rightButton" class="btn btn-default">Search</button>
</input-box>
PropTypeDefaultRequiredDescription
nameStringYesThe input name for the field
labelStringNoThe label for the input
helperStringNoHelper text
invalidBooleanfalseNoWhether or not to show a validation error
errorMessageStringNoThe error message to show
placeholderStringNoA placeholder for the input
inlineBooleanfalseNoShow the label next to the input
typeStringtextNoThe HTML input type
requiredBooleanfalseNoMark the field as required
readonlyBooleanfalseNoMark the field as readonly
smallBooleanfalseNoShow a small input
largeBooleanfalseNoShow a large input
plainTextBooleanfalseNoShow a plain text input
metaUnderLabelBooleanfalseNoShow the meta details under the label instead of the input

Toggle Switch

This component displays a nice alternative to a standard checkbox. The name for this component is ToggleSwitch. This component can be used in conjunction with the v-model directive.

PropTypeDefaultRequiredDescription
nameStringYesThe checkbox name
labelStringNoThe label for the checkbox
labelsBooleanfalseNoShow yes / no labels on the switch
helperStringNoHelper text
idStringNoThe id for the checkbox
stackedBooleanfalseNoShow the label above the switch component
labelColumnStringcol-sm-2NoThe bootstrap column for the label
inputColumnStringcol-sm-10NoThe bootstrap column for the input

Text Area

This component generates a textarea within a bootstrap form group. The name for this component is TextArea. This component can be used in conjunction with the v-model directive.

PropTypeDefaultRequiredDescription
nameStringYesThe textarea name
labelStringNoThe label for the textarea
helperStringNoHelper text
showErrorBooleanfalseNoWhether or not to show a validation error
errorMessageStringNoThe error message to show
stackedBooleanfalseNoShow the label above the textarea
requiredBooleanfalseNoMark the field as required
idStringNoThe id for the html input

Select List

This component generates a select input within a bootstrap form group. The name for this component is SelectList. This component can be used in conjunction with the v-model directive.

Addons

With the Select List component, you can also use input group addons. This can be done by simply adding slots.

SlotDescription
leftAddonAn addon on the left side of the input field
rightAddonAn addon on the right side of the input field
leftBtnAn input group button on the left side of the input field
rightBtnAn input group button on the right side of the input
PropTypeDefaultRequiredDescription
nameStringYesThe select list name
labelStringNoThe label for the select list
optionsArrayYesThe options to choose from
keyNameStringidNoThe name of the key for the value in the options
labelNameStringlabelNoThe name of the key for the label in the options
helperStringNoHelper text
showErrorBooleanfalseNoWhether or not to show a validation error
errorMessageStringNoThe error message to show
stackedBooleanfalseNoShow the label above the textarea
requiredBooleanfalseNoMark the field as required

More docs coming soon

2.2.0

5 years ago

2.1.0

6 years ago

2.0.2

6 years ago

1.4.7

6 years ago

1.4.6

6 years ago

1.4.5

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

2.0.1

7 years ago

2.0.0-beta-7

7 years ago

2.0.0-beta-6

7 years ago

2.0.0-beta

7 years ago

2.0.0-beta.5

7 years ago

2.0.0-beta.4

7 years ago

2.0.0-beta.3

7 years ago

2.0.0-beta.1

7 years ago

2.0.0

7 years ago

1.3.9

7 years ago

1.3.8

7 years ago

1.3.7

7 years ago

1.3.6

7 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.22

7 years ago

1.1.21

7 years ago

1.1.20

7 years ago

1.1.19

7 years ago

1.1.18

7 years ago

1.1.17

7 years ago

1.1.17-beta.3

7 years ago

1.1.17-beta.2

7 years ago

1.1.17-beta.1

7 years ago

1.1.16

7 years ago

1.1.15

7 years ago

1.1.14

7 years ago

1.1.13

7 years ago

1.1.12

7 years ago

1.1.12-alpha.6

7 years ago

1.1.12-alpha.5

7 years ago

1.1.12-alpha.4

7 years ago

1.1.12-alpha.3

7 years ago

1.1.12-alpha.2

7 years ago

1.1.12-alpha.1

7 years ago

1.1.11

7 years ago

1.1.10

7 years ago

1.1.9

7 years ago

1.1.8

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

1.0.0

7 years ago