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.

Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started

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 ​

NameDescriptionTypeRequiredDefaultPossible values
model-valuev-model The value of the component (v-model).TNo--
code-lengthThe length of the code.numberNo4-
typeThe type of the input field."number" | "text"No"text"'number' | '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."primary" | "secondary" | "accent" | "info" | "success" | "warning" | "destructive" | "contrast" | "transparent"No"primary"'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'destructive' | 'contrast' | 'transparent'
hintThe hint text to display below the input.stringNo--

Events ​

Event namePayloadDescription
update:model-valuevalue?: T | undefinedUpdate the model value.
completedvalue: voidEmitted when all inputs are set.