@br-validators/vue

Vue 3 composables for Brazilian document validators — delegates to @br-validators/core
9,803 8
Install
npm install @br-validators/vue@1.10.0
Latest Version:1.10.0
Vue:3
License:MIT
Last Updated:Oct 22, 2026
Links: GitHub  ·  npm
Maintainer: br-validators

@br-validators/vue

npm MIT GitHub release

Vue 3 composables that delegate validation and formatting to @br-validators/core v1.10.0.

Install

pnpm add @br-validators/vue @br-validators/core vue

Peer dependencies: vue ^3.5.0, @br-validators/core

Generic composable

<script setup lang="ts">
import { useBrValidator } from '@br-validators/vue';

const cpf = useBrValidator('cpf');
</script>

<template>
  <input v-model="cpf.value" />
  <p v-if="cpf.error">{{ cpf.error }}</p>
  <p v-else-if="cpf.isValid">Formatted: {{ cpf.formatted }}</p>
</template>

Named composables (v1)

Composable Core delegate
useCpf() validateCpf / formatCpf
useCnpj() validateCnpj / formatCnpj
useCep() validateCep / formatCep
useTelefone() validateTelefone / formatTelefone
usePix() validatePixKey / formatPixKey
useInscricaoEstadual({ uf }) validateInscricaoEstadual / formatInscricaoEstadual

Each composable exposes reactive value, error, formatted, isValid, and validate().

Inscrição Estadual with UF ref

import { ref } from 'vue';
import { useInscricaoEstadual } from '@br-validators/vue';

const uf = ref<'SP' | 'RJ'>('SP');
const ie = useInscricaoEstadual({ uf });

PIX type constraint

import { usePix } from '@br-validators/vue';

const pix = usePix({ pixType: 'email' });

Invalid values surface the same message string returned by core validate*.

Official algorithm sources: docs/OFFICIAL-SOURCES.md.

License

MIT

Related Packages

campos-br

Componentes Vue 3 e funções puras para formulários brasileiros: CPF, CNPJ (inclu...

366 0
vuetify-mask

Mask components to vuetify 2

36,482 29
vuetify-mask-with-slots

Vuetify 2 text-field masks with working slots (money, percent, CPF/CNPJ/CEP, dat...

9,897 0
vueuse-temporals

Date related composables for atmosphere-ui

1,676 1
oop-validator

A versatile and robust validation library for any UI framework.

5,938 4

Version History

Version Released Vue License
1.10.0 ^3.5.0 MIT
1.9.0 ^3.5.0 MIT
1.8.3 ^3.5.0 MIT
1.8.2 ^3.5.0 MIT
1.8.1 ^3.5.0 MIT
Pre-releases (47)
Version Released Vue License
1.10.0-data.46 ^3.5.0 MIT
1.10.0-data.45 ^3.5.0 MIT
1.10.0-data.44 ^3.5.0 MIT
1.10.0-data.43 ^3.5.0 MIT
1.10.0-data.42 ^3.5.0 MIT