DEV Community

Cover image for Layouts with Nuxt 3

Posted on


Layouts with Nuxt 3

In Nuxt.js, layouts are a way to define a common structure for the pages of your application. Essentially, a layout is a wrapper component that wraps around the content of a page. This allows you to define a consistent structure for your pages, such as a header, footer, and sidebars, and reuse this structure across multiple pages.

Layouts are defined as Vue.js components and are stored in the layouts directory of your Nuxt.js project. You can define as many layouts as you need, and each layout can be customized to meet the specific needs of your application.

To use a layout, you simply specify it in the layout property of your page component. You can also specify a layout dynamically based on the content of the page. For example, you could use a different layout for pages in the "admin" section of your application.

In addition to custom layouts, Nuxt.js also provides a default layout that includes components for displaying the content of the page, a loading indicator, and an error message if an error occurs while loading the page. You can customize the default layout by overriding its components or by providing your own layout entirely.

Guillaume Duhan

Top comments (0)

Head over to your dashboard

See your total reactions, views, and listings.