Pular para o conteúdo principal

Image

Used to display images. It supports properties such as src, alt, width, height, and responsive sources for different screen sizes.

Image

Usage

Example
import type { NubeSDK } from "@tiendanube/nube-sdk-types";
import { Image, Box } from "@tiendanube/nube-sdk-jsx";

function MyComponent() {
return (
<Box direction="col" gap={16}>
{/* Basic image */}
<Image
src="https://app-insti-cdn.nuvemshop.com.br/site/dist/images/widgets/closing-cta/image-3.webp"
alt="Nuvemshop Logo"
/>
</Box>
);
}

export function App(nube: NubeSDK) {
nube.send("ui:slot:set", () => ({
ui: {
slots: {
after_line_items: <MyComponent />,
},
},
}));
}

Properties

PropertyTypeRequiredDescription
srcstringYesURL of the image to display. Must use "https://".
altstringYesAlternative text for the image, used for accessibility.
sourcesImageSource[]NoArray of alternative image sources with optional media queries.
widthSizeNoWidth of the image (e.g., "100px", "50%", "auto", 100).
heightSizeNoHeight of the image (same format as width).
idstringNoOptional unique identifier for the component.
styleStyleSheetNoCustom styles for the image.

ImageSource

PropertyTypeRequiredDescription
srcstringYesThe alternative image source URL (https only).
mediastringNoOptional media query to match this source.