Component Options

Learn about component options, in-DOM templates, and export defaults in Vue.

We'll cover the following

Components accept all the same options that we can use when defining a root component. There’s one important difference, though. A component that’s not used as the application’s root is not mounted directly into the DOM. So we need to provide either a template option or a render() function.

In-DOM template

The template property can be either a DOM selector or markup. If the string starts with a # , Vue will treat it as a selector and look for a matching element in the DOM. If it finds one, it’ll use its contents as the template.

Here’s an in-DOM template:

Get hands-on with 1200+ tech skills courses.