--- navigation.icon: IconDirectory title: "layouts" description: "Nuxt provides a layouts framework to extract common UI patterns into reusable layouts." head.title: "Layouts" --- # Layouts Directory Nuxt provides a customizable layouts framework you can use throughout your application, ideal for extracting common UI or code patterns into reusable layout components. Layouts are placed in the `layouts/` directory and will be automatically loaded via asynchronous import when used. Layouts are used by adding `` to your `app.vue`, and either setting a `layout` property as part of your page metadata (if you are using the `~/pages` integration), or by manually specifying it as a prop to ``. (**Note**: The layout name is normalized to kebab-case, so `someLayout` becomes `some-layout`.) If you only have a single layout in your application, we recommend using [app.vue](/guide/directory-structure/app) instead. ::alert{type=warning} Unlike other components, your layouts must have a single root element to allow Nuxt to apply transitions between layout changes - and this root element cannot be a ``. :: ## Enabling the Default Layout Add a `~/layouts/default.vue`: ```vue [layouts/default.vue] ``` In a layout file, the content of the layout will be loaded in the ``, rather than using a special component. If you use a `app.vue` you will also need to add ``: ```vue [app.vue] ``` ## Setting Another Layout ```bash -| layouts/ ---| default.vue ---| custom.vue ``` You can directly override the default layout like this: ```vue{}[app.vue] ``` Alternatively, you can override the default layout per-page like this: ::code-group ```vue{}[pages/index.vue] ``` ```vue{}[app.vue] ``` ```vue [layouts/custom.vue] ``` ```vue [layouts/default.vue] ``` :: ::alert{type=info} Learn more about [defining page meta](/guide/directory-structure/pages#page-metadata). :: ## Changing the Layout Dynamically You can also use a ref or computed property for your layout. ```vue ``` ::LinkExample{link="/examples/routing/layouts"} :: ## Overriding a Layout on a Per-page Basis If you are using the `~/pages` integration, you can take full control by setting `layout: false` and then using the `` component within the page. ::code-group ```vue [pages/index.vue] ``` ```vue [layouts/custom.vue] ``` :: ::alert{type=warning} If you use `` within your pages, make sure it is not the root element (or disable layout/page transitions). ::