Skip to content

MazInputCode

This component creates a customizable input code field with features like dynamic code length, alpha character support, and styling based on states (error, success, warning). The code handles input events, keydown actions, and pasting. Overall, it offers a responsive and visually appealing solution for entering verification codes.

INFO

Before you have to import the global css files in your project, follow instructions in Getting Started

Basic usage

v-model="123"

vue
<template>
  <MazInputCode v-model="code" />
</template>

<script lang="ts" setup>
  import MazInputCode from 'maz-ui/components/MazInputCode'

  const code = ref()
</script>

Size

html
<MazInputCode v-model="code" size="mini" />
<MazInputCode v-model="code" size="xs" />
<MazInputCode v-model="code" size="sm" />
<MazInputCode v-model="code" size="lg" />
<MazInputCode v-model="code" size="xl" />

Disabled

html
<MazInputCode v-model="code" disabled />

Props & Event

Props

Prop nameDescriptionTypeValuesDefault
styleThe style of the component.TSIndexedAccessType-undefined
classThe class of the component.TSIndexedAccessType-undefined
modelValueThe value of the component (v-model).T-undefined
codeLengthThe length of the code.number-4
typeThe type of the input field.union-'text'
acceptAlphaWhether to accept alpha characters.boolean-false
requiredWhether the input is required.boolean-false
disabledWhether the input is disabled.boolean-false
errorWhether there is an error with the input.boolean-false
successWhether the input is successful.boolean-false
warningWhether there is a warning with the input.boolean-false
sizeThe size of the component.Size-'md'
colorThe color of the component.Color-'primary'
hintThe hint text to display below the input.string-

Events

Event namePropertiesDescription
update:model-valuevalue mixed - The new value of the model.Update the model value.
completedEmitted when all inputs are set.