Input

Demos

Size variants

Available size variants for the ui prop: large/small/tiny/micro.

<template>
<article>
  <div>
    <veui-input
      ui="large"
      value="Large"
    />
  </div>
  <div><veui-input value="Normal"/></div>
  <div>
    <veui-input
      ui="small"
      value="Small"
    />
  </div>
  <div>
    <veui-input
      ui="tiny"
      value="Tiny"
    />
  </div>
  <div>
    <veui-input
      ui="micro"
      value="Micro"
    />
  </div>
</article>
</template>

<script>
import { Input } from 'veui'

export default {
  components: {
    'veui-input': Input
  }
}
</script>

Read-only state

Use readonly prop to set an input to read-only state.

<template>
<article>
  <section>
    <veui-checkbox v-model="readonly">
      Read-only
    </veui-checkbox>
  </section>
  <section>
    <div>
      <veui-input
        :readonly="readonly"
        ui="large"
        value="Large"
      />
    </div>
    <div>
      <veui-input
        :readonly="readonly"
        value="Normal"
      />
    </div>
    <div>
      <veui-input
        :readonly="readonly"
        ui="small"
        value="Small"
      />
    </div>
    <div>
      <veui-input
        :readonly="readonly"
        ui="tiny"
        value="Tiny"
      />
    </div>
    <div>
      <veui-input
        :readonly="readonly"
        ui="micro"
        value="Micro"
      />
    </div>
  </section>
</article>
</template>

<script>
import { Input, Checkbox } from 'veui'

export default {
  components: {
    'veui-input': Input,
    'veui-checkbox': Checkbox
  },
  data () {
    return {
      readonly: true
    }
  }
}
</script>

Disabled state

Use disabled prop to set an input to disabled state.

<template>
<article>
  <section>
    <veui-checkbox v-model="disabled">
      Disabled
    </veui-checkbox>
  </section>
  <section>
    <div>
      <veui-input
        :disabled="disabled"
        ui="large"
        value="Large"
      />
    </div>
    <div>
      <veui-input
        :disabled="disabled"
        value="Normal"
      />
    </div>
    <div>
      <veui-input
        :disabled="disabled"
        ui="small"
        value="Small"
      />
    </div>
    <div>
      <veui-input
        :disabled="disabled"
        ui="tiny"
        value="Tiny"
      />
    </div>
    <div>
      <veui-input
        :disabled="disabled"
        ui="micro"
        value="Micro"
      />
    </div>
  </section>
</article>
</template>

<script>
import { Input, Checkbox } from 'veui'

export default {
  components: {
    'veui-input': Input,
    'veui-checkbox': Checkbox
  },
  data () {
    return {
      disabled: true
    }
  }
}
</script>

API

Props

NameTypeDefaultDescription
uistring-

Style variants.

ValueDescription
largeLarge input.
smallSmall input.
tinyTiny input.
microMicro input.
valuestring''

v-model

The value of the input.

disabledbooleanfalseWhether the input is disabled.
readonlybooleanfalseWhether the input is read-only.
typestring'text'

The type of the input. See the type attribute of HTML's native <input> element.

ValueDescription
textPlain text input.
passwordPassword input.
hiddenHidden input but holds a value to submit.
placeholderstring-The placeholder text of the input.
clearablebooleanfalseWhether to show a clear button.
compositionbooleanfalseWhether the input process should be aware of composition.
select-on-focusbooleanfalseWhether to select text content when focused.

Slots

NameDescription
beforeThe content before the input area inside the component.
afterThe content after the input area inside the component.

Slots will squeeze the width of the input area.

Events

NameDescription
change

Triggered when the input value is changed like the native change event. The callback parameter list is (value, event).

NameTypeDescription
valuestringThe value of the input.
eventEventNative change event object.
input

v-model

Triggered when inputting into the input. Affected by the composition prop. The callback parameter list is (value: string), where value is the current value of the input.

Additionally, Input exposes the following native events:

auxclick, click, contextmenu, dblclick, mousedown, mouseenter, mouseleave, mousemove, mouseover, mouseout, mouseup, select, wheel, keydown, keypress, keyup, focus, blur, focusin, focusout.

The callback parameter is the corresponding native event object for all events above.

Icons

NameDescription
removeRemove button.