Skip to content

feat(nuxt): allow setting layout props in definePageMeta#34262

Merged
danielroe merged 7 commits intonuxt:mainfrom
KazariEX:feat/page-meta-layout-props
Feb 24, 2026
Merged

feat(nuxt): allow setting layout props in definePageMeta#34262
danielroe merged 7 commits intonuxt:mainfrom
KazariEX:feat/page-meta-layout-props

Conversation

@KazariEX
Copy link
Copy Markdown
Member

@KazariEX KazariEX commented Feb 6, 2026

🔗 Linked issue

resolve #34241, redo #34258

📚 Description

The API will look like:

definePageMeta({
  layout: {
    name: "center",
    props: {
      foo: "bar",
    },
  },
});

@KazariEX KazariEX requested a review from danielroe as a code owner February 6, 2026 18:55
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 6, 2026

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@34262

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@34262

nuxt

npm i https://pkg.pr.new/nuxt@34262

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@34262

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@34262

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@34262

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@34262

commit: cc92d73

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ec8e66 and cc92d73.

📒 Files selected for processing (2)
  • packages/nuxt/src/pages/module.ts
  • test/basic.test.ts

Walkthrough

This pull request adds support for object-form layout metadata in pages: PageMeta.layout now accepts an object with optional name and props. The definePageMeta AST transform was updated to extract layout.name into layout and layout.props into layoutProps, removing the original object literal. Public typings for NuxtLayouts were reformatted to remove trailing commas. Tests and fixtures were added to verify layout object handling and layout props propagation.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main feature: allowing layout props to be set in definePageMeta.
Description check ✅ Passed The PR description is directly related to the changeset, providing a clear example of the new API syntax for setting layout props.
Linked Issues check ✅ Passed The PR implementation fulfils the requirements from issue #34241 by enabling declarative layout prop configuration via definePageMeta with the specified object syntax.
Out of Scope Changes check ✅ Passed All code changes are directly scoped to implementing the layout props feature: type augmentation, transformation logic, and comprehensive test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 6, 2026

Merging this PR will not alter performance

✅ 21 untouched benchmarks


Comparing KazariEX:feat/page-meta-layout-props (cc92d73) with main (a0d35f9)

Open in CodSpeed

@KazariEX KazariEX changed the title feat(nuxt): allow set layout props in definePageMeta feat(nuxt): allow setting layout props in definePageMeta Feb 6, 2026
@danielroe danielroe enabled auto-merge February 24, 2026 12:39
@danielroe danielroe added this pull request to the merge queue Feb 24, 2026
Merged via the queue into nuxt:main with commit 7b49d0c Feb 24, 2026
56 checks passed
@KazariEX KazariEX deleted the feat/page-meta-layout-props branch February 24, 2026 13:37
@github-actions github-actions bot mentioned this pull request Feb 24, 2026
This was referenced Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow in definePageMeta pass props to layout

2 participants