Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ngoquocdat's avatar

Exclude Layout for specified components

Hi everyone, I have a question, I want to exclude the Login, Register components from default Layout. The rest of the components still use default Layout

So how I can do it in the component

There is my code

createInertiaApp({
    resolve: name => {
        const page = require(`./Pages/${name}`).default
        if (page.layout === undefined) {
            page.layout = Layout
        }
        return page
    },
    setup({el, App, props, plugin}) {
        createApp({render: () => h(App, props)})
            .use(plugin)
            .mount(el)
    },
})

Thanks

0 likes
5 replies
ngoquocdat's avatar

@tykus I already read the docs, but I don't know place to set layout = null

tykus's avatar
tykus
Best Answer
Level 104

@datlechin you set the layout property in the Page component itself:

// resources/js/Pages/Login.vue
export default {
    // ...
   layout: null
}
ngoquocdat's avatar

I have a solution to fix it, that is add !name.startsWith('Auth/') to app.js

Please or to participate in this conversation.