$attrs $attrs Collection
Last updated: 2026-10-22
$attrs $attrs Collection
$attrs gathers attributes the parent passed that props did not declare — forward them precisely with inheritAttrs: false.
| Group | Options: Composition & Misc |
|---|---|
| Kind | Option |
| Scope | Component |
| Vue Version | 3.0+ |
| SSR Support | Yes |
📝 Syntax
export default {
inheritAttrs: false,
template: "<input v-bind=\"$attrs\">"
}
⚙️ Arguments
| value | No arguments; includes class, style and listeners |
|---|
Returns:A readonly object
▶ Example
Edit the code below and see the live result:
Output:
The input carries placeholder and type; the label reads 'Email'.
💡 Key Points
⚠️ Warning $attrs is readonly — writes warn and do nothing.
ℹ️ Note It includes listeners, so v-bind="$attrs" forwards events too.
💡 Tip The Composition API equivalent is useAttrs().
🏷️ Related Composition & Misc
💡 Related Cases
More case studies coming soon.
📚 Related Tutorials
❓ FAQ
Q How does it split with props?
A Declared props go to props; everything else lands here.
Q Are class and style included?
A Yes, and they merge rather than replace.
Q Why do attributes sometimes disappear?
A Multi-root templates without a manual bind drop them.