Skip to content

Controlled and subscription-based forms, fields with state management using Vue's power ๐Ÿ™Œ

License

Notifications You must be signed in to change notification settings

alirezavalizade/vue-controlled-form-fields

Repository files navigation



๐Ÿ™Œ
vue-controlled-form-fields


NPM Version npm Build Status codecov code style: prettier Greenkeeper badge





yarn add vue-controlled-form-fields





vue-controlled-form-fields is a flexible and hight-performance state-managament tool for creating different level of forms.

<c-form :submit="onSubmit">
   <div slot-scope="{pristine, invalid}">
    <h2>Simple Default Input</h2>
    <div>
      <label>First Name</label>
      <field name="firstName" component="input" placeholder="First Name"/>
    </div>

    <h2>A Reusable Input Component</h2>
    <div>
      <label>Interests</label>
      <field name="interests">
        <InterestPicker/>
      </field>
    </div>

    <h2>Using slot-scope</h2>
    <field name="bio" :validate="[required]">
      <div slot-scope="{ input, events, meta }">
        <div>
          <label>Bio</label>
          <textarea v-bind="input" v-on="events" />
          <span v-if="meta.touched && meta.error">{{ meta.error }}</span>
        </div>
      </div>
    </field>

    <button type="submit" :disabled="pristine || invalid">Submit</button>
  </div>
</c-form>

About

Controlled and subscription-based forms, fields with state management using Vue's power ๐Ÿ™Œ

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •