0.8.1 • Published 1 year ago

@dpa-id-components/ui-input v0.8.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

@dpa-id-components/ui-input

UiInput Vue 2.x input component based on the dpa Design Kit

Installation

yarn add @dpa-id-components/ui-input

Usage

<!-- SomeComponent.vue using UiInput -->
<template>
  <ui-input
    v-model="value"
    :label="label"
    :type="type"
    :placeholder="placeholder"
    :error-message="errorMessage"
    :is-invalid="errorMessage"
    @input="handleEvent"
    @focus="handleEvent"
    @blue="handleEvent"
    @keyup="handleEvent"
  />
</template>

<script>
  import UiInput from "@dpa-id-components/ui-input";

  export default {
    components: {
      UiInput,
    },
    data() {
      return {
        value: "",
        type:"text",
        label: "Input Label",
        placeholder: "Type something...",
      };
    },
    computed: {
      errorMessage() {
        if (this.value === "error") {
          return "Oops, an error occured...";
        }
        return "";
      },
    },
    methods: {
      handleEvent: console.log,
    },
  };
</script>

Demo

View a demo of <ui-input> on Storybook

API

Props

NameTypeDefaultDescription
autocompleteString"on"Sets the autocomplete attribute
autofocusBooleanfalseFocuses the input on mount if true
chevronBooleanfalseWhether to append a chevron icon
errorMessageString""Text to display as an error message
isInvalidBooleanfalseTo flag if the value is invalid
labelString""Text for the input's label
placeholderString""Text for the input's placeholder
readonlyBooleanfalseSets the readonly attribute
valueString""The input's value
typeString"text"The input's type can either be text or datetime-local
minString""If the type is set to datetime-local, min represents the minimum date time e.g. 2018-06-07T00:00
maxString""If the type is set to datetime-local, max represents the maximum date time e.g. 2018-06-14T00:00
isDateTimePickerBoolean"false"To be set to true if input is of type datetime-local to keep picked date and time value selected.

Events

NameTypeDescription
blurBlurEventEmitted when the input loses focus
focusFocusEventEmitted when the input is focused
keyupKeyboardEventEmitted when a key is lifted
inputStringEmitted when the internal value of the input changes
0.8.1

1 year ago

0.8.0

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.0

2 years ago

0.5.2

2 years ago

0.5.1

2 years ago

0.4.2

2 years ago

0.4.0

2 years ago

0.3.9

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.5

3 years ago

0.1.6

3 years ago

0.1.4

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago