LogoLogo
GitHub repository
GitHub repository
    Documentation
  • Overview
  • Getting Started
  • Guides


  • Hooks

  • Components


    • AsyncButton
    • AsyncIconButton
    • CodeBlock
    • CopyButton
    • Enumeration
    • ExampleCard
    • Icon
    • InlineCode
    • Logo
    • PageLoadingIndicator
    • PageOverview
    • Paragraph
    • QuoteBlock
    • SmartImage
    • SmartLink
    • StyleLink

SmartImage

An image component with more features and better defaults that next/image.
This should be used instead of next/image and <img> in all cases.
Notably, if you configured a basePath other than the root in next.config.js, this component will automatically prepend it to the src prop.

Props

The same as next/image component, as well as:
  • disableStrictCLS: Disables the Next.js CLS error. Particularly, this means you can not pass width and height even if the import is not static, and the component will behave like a normal <img> would. Note that this is frowned upon as it causes cumulative layout shift.
    Hawaii missile warning meme

Examples

Image without given width

Logo
Note: this text will shift its position as soon as the image loads.

1 <Stack>
2 <SmartImage
3 disableStrictCLS
4 src="/logo.png"
5 alt="Logo"
6 />
7 <Paragraph box>
8 Note: this text will shift its position as soon as the image loads.
9 </Paragraph>
10</Stack>
1 <Stack>
2 <SmartImage
3 disableStrictCLS
4 src="/logo.png"
5 alt="Logo"
6 />
7 <Paragraph box>
8 Note: this text will shift its position as soon as the image loads.
9 </Paragraph>
10</Stack>

See also


LogoLogo