-
Notifications
You must be signed in to change notification settings - Fork 26.1k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for feedback: Image Component ‘Raw’ layout #35493
Comments
Hi, I am using Next with Typescript and it seems that layout="raw" causes an error because Typescript doesn't recognize "raw", as I am trying to position the Image as relative. in VSCode : |
You'll need to update to Next.js 12.1.1 or newer: |
Seems to be working well with TypeScript here.
The image component desperately needs a way to define art direction. That is, to be able to provide different images at different breakpoints. i.e, something that matches the following:
I've tried all layout modes. The problem stems from the fact that the developer has very limited control over the generated srcsets. Either you use I think that it should be possible to allow for the user to supply alternative
The documentation lacks a demo, instead there is a link to "Demo Background Image" which is a bit confusing since it doesn't seem to be using |
Take a look how Imgix handles picture tag for art direction https://reactjsexample.com/react-component-to-display-imgix-images/. Something like this is desperately needed in nextjs.
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Starting with version 12.1.1-canary.11, I’ve added experimental support for a new image component mode layout mode called
“raw”
. This mode removes the spacers and styling associated with next/image’s responsive behavior, rendering a “raw” image element with no styling. The component still requires height and width information in order to prevent layout shift, and will pass those attributes to the underlying image unless you also provide asizes
attribute, which indicates that the image is expected to behave responsively.I have also enabled the use of the
style
attribute in all image modes to pass style properties directly to the underlying image element. Be aware that in layout modes other than”raw”
, any styling required for that layout mode will take precedence over provided styling, if there’s a conflict.I would like to gather feedback on the new
”raw”
layout mode before we move it out of experimental. I encourage anyone who’s had trouble getting thenext/image
component styled the way they want to try the experimental”raw”
layout and tell me how it worked.See this section in the documentation for how to enable the experimental layout mode.
Here’s an example template for responses, though any feedback is appreciated:
next/image
?”raw”
layout mode solve your problem? - If not, what changes would allow it to solve the problem?The text was updated successfully, but these errors were encountered: