# Use inheritAttrs: false for Wrapper Components
## Rule
When building wrapper components where attributes should be applied to an inner element instead of the root element, always set `inheritAttrs: false` and explicitly bind `$attrs` to the target element.
## Why This Matters
- By default, Vue applies all non-prop attributes to the root element
- Wrapper components often have a non-semantic root (div wrapper, label wrapper)
- Attributes like `id`, `aria-*`, `data-*`, and event listeners should target the functional element
- Without `inheritAttrs: false`, accessibility and functionality can break
## Bad Code
```vue
-->
```
## Good Code
```vue
```
## Setting inheritAttrs in Different Syntaxes
### Script Setup (Vue 3.3+)
```vue
```
### Script Setup (Before Vue 3.3)
```vue
```
### Options API
```vue
```
## Common Wrapper Component Patterns
### Form Input Wrapper
```vue
{{ error }}
```
### Button with Icon Wrapper
```vue
```
### Link Wrapper Component
```vue
```
## When NOT to Use inheritAttrs: false
- Simple components with a single semantic root element
- Components where the root element should receive all attributes
- Components that don't wrap other functional elements
```vue
```
## References
- [Fallthrough Attributes - Disabling Attribute Inheritance](https://vuejs.org/guide/components/attrs.html#disabling-attribute-inheritance)
- [Build Advanced Components in Vue 3 using $attrs](https://www.thisdot.co/blog/build-advanced-components-in-vue-3-using-usdattrs)