#images
1 messages · Page 1 of 1 (latest)
To install and use the <Picture /> component in Astro, follow these steps:
- Install the
@astrojs/imagepackage by running the following command in your project directory:
npm install @astrojs/image
- Import the
Picturecomponent in your.astroor.mdxfile:
---
import { Picture } from '@astrojs/image/components';
---
- Use the
<Picture />component in your Astro markup, providing the required attributes:src,widths,sizes,alt, andaspectRatio. You can also include optional properties as needed. For example:
<Picture
src="/path/to/your/image.jpg"
widths="[300, 600, 900]"
sizes="(max-width: 600px) 50vw, 100vw"
alt="A descriptive text for the image"
aspectRatio="16/9"
/>
For more information on using the <Picture /> component and its attributes, refer to the Astro’s Image Integration (https://docs.astro.build/en/guides/images#astros-image-integration) and Picture component documentation (https://docs.astro.build/en/guides/integrations-guide/image/#picture-).
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@bitter cradle kapa.ai is still learning and improving, please let us how it did by reacting below
I did that typescript is saying it cant find the module '<@&1055234544183287879>/image/components' or its corresponding type declarations.ts(2307)