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.

Basic usage

v-model="123"

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

const code = ref()
</script>

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

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

NameDescriptionTypeRequiredDefault
styleThe style of the component.Native typeNoundefined
classThe class of the component.Native typeNoundefined
model-valueThe value of the component (v-model).TNoundefined
code-lengthThe length of the code.numberNo4
typeThe type of the input field."text" | "number"No'text'
accept-alphaWhether to accept alpha characters.booleanNofalse
requiredWhether the input is required.booleanNofalse
disabledWhether the input is disabled.booleanNofalse
errorWhether there is an error with the input.booleanNofalse
successWhether the input is successful.booleanNofalse
warningWhether there is a warning with the input.booleanNofalse
sizeThe size of the component.MazInputCodeSizeNo'md'
colorThe color of the component.MazColorNo'primary'
hintThe hint text to display below the input.stringNoundefined

Events

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