> For the complete documentation index, see [llms.txt](https://docs.nosto.com/techdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nosto.com/techdocs/implementing-nosto/implement-search/using-search-templates-starter/customizations/product-image-configuration.md).

# Product Image Configuration

## Customizing Product Image Aspect Ratio

You can use CSS custom properties (variables) to define the aspect ratio for specific components. This is useful for components like the autocomplete dropdown where you might want a different aspect ratio than the main product grid.

The project defines a CSS custom property `--ns-aspect-ratio` for this purpose.

#### Example: Autocomplete Product Image

The product images within the autocomplete results use this CSS variable.

**File to inspect:** `src/components/Autocomplete/Item/Product.module.css`

```css
/* src/components/Autocomplete/Item/Product.module.css */
.image {
  height: auto;
  aspect-ratio: var(--ns-aspect-ratio);
  object-fit: contain;
  width: 100%;
}
```

You can override the value of `--ns-aspect-ratio` in your theme's CSS file or directly in the component's stylesheet to change the aspect ratio. The value is defined in `src/variable.css`.

**File to edit:** `src/variable.css`

```css
/* src/variable.css */
:root {
  /* ... other variables ... */

  --ns-aspect-ratio: 1; /* Default to square */
}
```

By changing `--ns-aspect-ratio` to `4 / 3`, for instance, any component using this variable will render images with a `4:3` aspect ratio.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nosto.com/techdocs/implementing-nosto/implement-search/using-search-templates-starter/customizations/product-image-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
