Vue · Attributes

VUE0030Disable inheritAttrs when binding $attrs

Flags single-root components that forward `v-bind="$attrs"` to an inner element while Vue still applies the same attrs to the root.

Why it happens

With inheritAttrs left on, fallthrough attrs land on the component root and on the element that binds $attrs, so classes and ids are duplicated and bubbling listeners such as @click run twice.

Fix

Add defineOptions({ inheritAttrs: false }) so attrs reach only the element that binds $attrs.

Example

Turn off attribute inheritance when forwarding $attrs

Before

<template>
  <label class="field">
    <input v-bind="$attrs">
  </label>
</template>

After

<script setup lang="ts">
defineOptions({ inheritAttrs: false })
</script>

<template>
  <label class="field">
    <input v-bind="$attrs">
  </label>
</template>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm vite-doctor . --framework vue --rules vue/attrs/no-duplicate-attr-inheritance
Copyright © 2026