new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Nuxt · API · all subjects

composables/use-layout

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

useLayout composable signature

useLayout is a composable that returns a computed ref with the layout resolved for the current route. It is available from Nuxt version 4.5 onwards.

useLayout resolution chain

useLayout resolves the layout using the same chain as <NuxtLayout>: first the page's layout meta, then the appLayout set via route rules, then the 'default' layout.

useLayout behavior inside vs outside NuxtLayout

Within a rendered <NuxtLayout>, useLayout reflects the enclosing layout. Outside of one (for example in app.vue), it returns the layout that would be resolved for the current route.

useLayout vs route.meta.layout

Unlike reading route.meta.layout directly, useLayout accounts for a layout set through route rules and stays in sync as the route changes.

useLayout return type

useLayout returns a read-only computed ref that resolves to the layout name as a string, or false when the layout is disabled.

useLayout example usage

Example showing useLayout in app.vue: ```vue <script setup lang="ts"> const layout = useLayout() </script> <template> <div> <CommandPalette v-if="layout !== 'minimal'" /> <NuxtLayout> <NuxtPage /> </NuxtLayout> </div> </template> ``` The example conditionally renders a CommandPalette component based on the resolved layout name.

Give your agent this brain