# Fallthrough Attributes Overwrite Explicit Attributes in Vue 3
## Rule
In Vue 3, fallthrough attributes overwrite explicitly set attributes on the root element (except `class` and `style` which are merged). This is a breaking change from Vue 2. To preserve explicit attribute values, use `inheritAttrs: false` and manually bind `$attrs` before the explicit attribute.
## Why This Matters
- Silent behavior change from Vue 2 to Vue 3
- Can cause unexpected attribute values in migrated codebases
- Only `class` and `style` merge intelligently; other attributes are overwritten
- Affects component composition patterns and wrapper components
## Bad Code
```vue
```
### Another common case with data attributes
```vue
```
## Good Code
### Option 1: Control attribute order with inheritAttrs: false
```vue
```
### Option 2: Exclude specific attrs from fallthrough
```vue
```
### Option 3: For wrapper components, declare as prop
```vue
```
## Class and Style Are Special
Unlike other attributes, `class` and `style` merge rather than overwrite:
```vue
```
## Vue 2 to Vue 3 Migration Checklist
When migrating components that rely on attribute precedence:
1. Identify components that set explicit attributes on root elements
2. Check if parent components pass the same attributes
3. If explicit values should take precedence:
- Add `inheritAttrs: false`
- Use `v-bind="$attrs"` before explicit attributes
## References
- [Fallthrough Attributes](https://vuejs.org/guide/components/attrs.html)
- [Vue 3 Migration Guide - Attribute Coercion Behavior](https://v3-migration.vuejs.org/breaking-changes/)
- [Vue Fallthrough Attributes behaviour changes from Vue 2 to Vue 3](https://lukes.tips/posts/vue-3-fallthough-attributes-changes/)