@dpa-id-components/ui-autocomplete

0.2.1 • Public • Published

@dpa-id-components/ui-autocomplete

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

Installation

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

Usage

<!-- SomeComponent.vue using UiAutocomplete -->
<template>
  <ui-autocomplete
    v-model="value"
    label="Name"
    placeholder="Example: James"
    @input="handleEvent"
    @select="handleEvent"
  />
</template>

<script>
  import UiAutocomplete from "@dpa-id-components/ui-autocomplete";

  export default {
    components: {
      UiAutocomplete,
    },
    data() {
      return {
        value: "",
        options: ["James Bond", "James Cameron"],
      };
    },
    computed: {
      errorMessage() {
        if (this.value === "error") {
          return "Oops, an error occured...";
        }
        return "";
      },
    },
    methods: {
      handleEvent: console.log,
    },
  };
</script>

Demo

View a demo of <ui-autocomplete> on Storybook

API

Props

Name Type Default Description
label String "" Text for the input's label
placeholder String "" Text for the input's placeholder
value String "" The input's value
options String[] [] An array of possible values

Events

Name Type Description
input String Emitted when the internal value of the input changes
select String Emitted when an option is selected

Readme

Keywords

none

Package Sidebar

Install

npm i @dpa-id-components/ui-autocomplete

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

1.19 MB

Total Files

10

Last publish

Collaborators

  • goersch.juliane
  • martinherweg
  • borchert.manja
  • roessel.nico
  • karlbanke
  • hajo.cirksena.dpa
  • schubert.florian
  • michelle3105
  • arifpehlivan
  • dpa-connect-deployment
  • antje.sommer
  • mlnmln
  • kgierke
  • andrewbeng89
  • mridul_dpa