--- outline: deep --- # Fallthrough Attributes {#fallthrough-attributes} > This page assumes you've already read the [Components Basics](/guide/essentials/component-basics). Read that first if you are new to components. ## Attribute Inheritance {#attribute-inheritance} A "fallthrough attribute" is an attribute or `v-on` event listener that is passed to a component, but is not explicitly declared in the receiving component's [props](./props) or [emits](./events#declaring-emitted-events). Common examples of this include `class`, `style`, and `id` attributes. When a component renders a single root element, fallthrough attributes will be automatically added to the root element's attributes. For example, given a `` component with the following template: ```vue-html ``` And a parent using this component with: ```vue-html ``` The final rendered DOM would be: ```html ``` Here, `` did not declare `class` as an accepted prop. Therefore, `class` is treated as a fallthrough attribute and automatically added to ``'s root element. ### `class` and `style` Merging {#class-and-style-merging} If the child component's root element already has existing `class` or `style` attributes, it will be merged with the `class` and `style` values that are inherited from the parent. Suppose we change the template of `` in the previous example to: ```vue-html ``` Then the final rendered DOM would now become: ```html ``` ### `v-on` Listener Inheritance {#v-on-listener-inheritance} The same rule applies to `v-on` event listeners: ```vue-html ``` The `click` listener will be added to the root element of ``, i.e. the native ` ``` We want all fallthrough attributes like `class` and `v-on` listeners to be applied to the inner ` ``` Remember that [`v-bind` without an argument](/guide/essentials/template-syntax#dynamically-binding-multiple-attributes) binds all the properties of an object as attributes of the target element. ## Attribute Inheritance on Multiple Root Nodes {#attribute-inheritance-on-multiple-root-nodes} Unlike components with a single root node, components with multiple root nodes do not have an automatic attribute fallthrough behavior. If `$attrs` are not bound explicitly, a runtime warning will be issued. ```vue-html ``` If `` has the following multi-root template, there will be a warning because Vue cannot be sure where to apply the fallthrough attributes: ```vue-html
...
...
...
``` The warning will be suppressed if `$attrs` is explicitly bound: ```vue-html{2}
...
...
...
``` ## Accessing Fallthrough Attributes in JavaScript {#accessing-fallthrough-attributes-in-javascript}
If needed, you can access a component's fallthrough attributes in ` ``` If not using `