This guide shows you how to render a product form that includes a list of available product variants.
## Requirements
- You've completed the [quickstart guide](/docs/storefronts/headless/hydrogen/getting-started).
- You've [set up a cart handler](/docs/storefronts/headless/hydrogen/cart/setup).
## Selecting Variants with Links
Many product pages include a form where options are submitted to the server when the user adds to the cart. The most basic product form enables customers to select from available variants. For example, variants might include product size and color.
In Hydrogen we recommend using a `Link` to select each variant. This automatically updates the URL when customers select a variant, which has the following benefits:
- Search engines can easily index each separate variant.
- Users can share and bookmark each separate variant.
- Variants can be prefetched on hover, which decreases the perceived load time.
## Query the Storefront API for Product Options
First, your product query needs to include product options. Do this by adding `options` with the `name` and `optionValues` properties:
```jsx?title: 'JavaScript', filename: 'routes/products.$handle.jsx'
export async function loader({ request, params }) {
const { product } = await context.storefront.query(PRODUCT_QUERY, {
variables: {
handle: params.productHandle,
},
});
return json({ product });
}
const PRODUCT_QUERY = `#graphql
query Product(
$handle: String!
) {
product(handle: $handle) {
id
title
vendor
handle
descriptionHtml
description
options {
name
optionValues {
name
}
}
media(first: 7) {
nodes {
...Media
}
}
seo {
description
title
}
}
}
`;
```
## VariantSelector component
Now that you've queried product options, you can use the `VariantSelector` component to render links for all product options:
```jsx?title: 'JavaScript', filename: 'routes/products.$handle.jsx'
import { VariantSelector } from "@shopify/hydrogen";
const ProductForm = ({ product }) => {
return (
{({ option }) => (
<>