Skip to content

Next.js: Move image configuration from FrameworkOptions to parameters#32639

Merged
valentinpalkovic merged 4 commits intostorybookjs:nextfrom
y-hsgw:fix/types-nextjs-image-params
Mar 11, 2026
Merged

Next.js: Move image configuration from FrameworkOptions to parameters#32639
valentinpalkovic merged 4 commits intostorybookjs:nextfrom
y-hsgw:fix/types-nextjs-image-params

Conversation

@y-hsgw
Copy link
Copy Markdown
Member

@y-hsgw y-hsgw commented Oct 4, 2025

Closes #32256

What I did

The image configuration was incorrectly defined under FrameworkOptions. According to the intended design, it should instead be placed in NextJsParameters.nextjs.image.

<ImageContext.Provider value={parameters.nextjs.image}>

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

  1. Started Storybook in the nextjs/default-ts sandbox using yarn storybook.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Refactor
    • Moved Next.js image configuration from framework options to per-story parameters. Use parameters.nextjs.image instead of the removed top-level option.
  • Documentation
    • Updated Next.js guide to reflect the new image parameter location and usage.
    • Clarified that the image parameter is passed to every instance of the Next.js Image component.
    • Removed references to the deprecated framework options entry.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 4, 2025

📝 Walkthrough

Walkthrough

Moved Next.js image configuration from framework-level options to per-story parameters. Updated TypeScript types to remove image from FrameworkOptions and add it under NextJsParameters.nextjs. Adjusted Next.js documentation to reflect the new parameter location and removed the previous builder options reference.

Changes

Cohort / File(s) Summary
Type definitions update
code/frameworks/nextjs/src/types.ts
Removed image?: Partial<NextImage.ImageProps> from FrameworkOptions. Added image?: Partial<NextImage.ImageProps> under NextJsParameters.nextjs.
Documentation update
docs/get-started/frameworks/nextjs.mdx
Moved image from framework.options to framework.parameters. Updated examples and descriptions; removed old builder option section and added parameter description.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
code/frameworks/nextjs/src/types.ts (1)

74-75: Add JSDoc comment for the image parameter.

The newly added image parameter lacks a JSDoc comment, while other parameters in the interface (appDirectory, navigation, router) include descriptive comments. Adding documentation improves code clarity and helps developers understand the parameter's purpose.

Apply this diff to add a JSDoc comment:

+    /**
+     * Global props to pass to every instance of next/image
+     * 
+     * @see https://nextjs.org/docs/pages/api-reference/components/image
+     */
     image?: Partial<NextImage.ImageProps>;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d4b085 and e25a02e.

📒 Files selected for processing (2)
  • code/frameworks/nextjs/src/types.ts (1 hunks)
  • docs/get-started/frameworks/nextjs.mdx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Adhere to ESLint and Prettier rules across all JS/TS source files

Files:

  • code/frameworks/nextjs/src/types.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Fix type errors and prefer precise typings instead of using any or suppressions, consistent with strict mode

Files:

  • code/frameworks/nextjs/src/types.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Danger JS
  • GitHub Check: Core Unit Tests, windows-latest
🔇 Additional comments (3)
code/frameworks/nextjs/src/types.ts (2)

20-23: Approve ImageDecorator update: uses parameters.nextjs.image instead of options.image, and no options.image references remain.


20-23: No remaining FrameworkOptions.image references
Search across code and docs found no FrameworkOptions.image; all image access now uses parameters.nextjs.image in the decorator components.

docs/get-started/frameworks/nextjs.mdx (1)

994-998: LGTM – no leftover framework.options.image references in docs.

@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Oct 4, 2025

View your CI Pipeline Execution ↗ for commit 465b79f

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 58s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-24 15:38:54 UTC

@shilman shilman changed the title Fix: Move image configuration from FrameworkOptions to NextJsParameters.nextjs.image Next.js: Move image configuration from FrameworkOptions to parameters Oct 6, 2025
@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot bot commented Oct 6, 2025

Package Benchmarks

Commit: e40b14c, ran on 11 March 2026 at 10:36:12 UTC

No significant changes detected, all good. 👏

@github-actions github-actions bot added the Stale label Oct 21, 2025
@y-hsgw
Copy link
Copy Markdown
Member Author

y-hsgw commented Nov 24, 2025

Hi @kylegach @jonniebigodes @valentinpalkovic , just a gentle reminder about this PR.
When you have a moment, could you please review it?
Thank you so much!

@github-actions github-actions bot added the Stale label Dec 14, 2025
@valentinpalkovic valentinpalkovic added this to the 11 milestone Mar 10, 2026
@github-actions github-actions bot removed the Stale label Mar 11, 2026
@valentinpalkovic valentinpalkovic removed this from the 11 milestone Mar 11, 2026
@valentinpalkovic valentinpalkovic self-requested a review March 11, 2026 10:15
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.

[Bug]: Storybook doesn’t apply global next/image props

5 participants