> ## Documentation Index
> Fetch the complete documentation index at: https://weaverse.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Weaverse component configuration uses `settings`. `inspector` is deprecated; never generate it.
> Weaverse Hydrogen themes use React Router v7: import from `react-router`, never `react-router-dom` or `@remix-run/*`.
> Before using any code sample, read `@weaverse/hydrogen` in the project's `package.json`: 6.x and 5.x import from different entries and use different type names, so code for one does not build on the other.
> `@weaverse/hydrogen` 6 (Shopify Hydrogen 2026.10 and later, the version these docs show) imports from `@weaverse/hydrogen/react-router` and uses `Weaverse*` types such as `WeaverseComponentProps`, `WeaverseComponentLoaderArgs` and `WeaverseComponentSchema`; the root `@weaverse/hydrogen` entry only exports `createSchema()`, data helpers and types.
> `@weaverse/hydrogen` 5.x (Hydrogen 2026.4 and earlier) imports everything from `@weaverse/hydrogen` and uses `HydrogenComponentProps`, `ComponentLoaderArgs` and `HydrogenComponentSchema`. On a 5.x project, convert samples to these names. Upgrade to 6 only when asked (`npx @weaverse/cli@latest migrate v6`, plus the Hydrogen 2026.10 upgrade). Do not mix major versions.
> Next.js themes use `@weaverse/hydrogen` 6.2.0 or later: import client and shared code from `@weaverse/hydrogen/next` and server-only code from `@weaverse/hydrogen/next/server`. `@weaverse/next` is deprecated; never install or import it.
> For live project data (pages, theme settings, translations), use the Weaverse MCP server: https://weaverse.io/docs/developer-tools/weaverse-mcp

# Input Settings

> Every input type a Next.js section can expose in Weaverse Studio, what each one returns, and how to render it with @weaverse/hydrogen/next.

# Input Settings

An **input** is one control in the Studio settings panel. Merchants change it, and your component receives the value as a prop named after the input's `name`. Inputs live in a schema's `settings` groups; see [Component Schema](https://weaverse.io/docs/nextjs/component-schema.md).

Inputs fall into two groups:

* [Basic inputs](#basic-inputs) hold a value directly: text, numbers, colors, images.
* [Resource picker inputs](#resource-picker-inputs) select Shopify resources and return their `id` and `handle`. A loader fetches the rest.

## Anatomy

```ts theme={null}
type Input = {
  type: InputType
  name: string
  label?: string
  defaultValue?: string | number | boolean | Partial<WeaverseImage> | { [key: string]: any }
  placeholder?: string
  helpText?: string
  configs?: AdditionalInputConfigs
  condition?: string | ((data: any) => boolean)
  shouldRevalidate?: boolean
}
```

| Attribute | Type | Description | Required |
| - | - | - | - |
| `type` | `InputType` | The kind of control. | Yes |
| `name` | `string` | The prop the value is passed as. `title` becomes the `title` prop. | Yes, except `heading` |
| `label` | `string` | The label shown in Studio. | No |
| `defaultValue` | depends on `type` | The value a new instance starts with. The SDK also merges it under saved settings. | No |
| `placeholder` | `string` | Text shown while the input is empty. | No |
| `helpText` | `string` | Extra guidance below the input. HTML is allowed. | No |
| `configs` | object | Options for `select`, `toggle-group`, `range`, `image` and `video`. | Depends on `type` |
| `condition` | `function` | Shows the input only when it returns `true`. | No |
| `shouldRevalidate` | `boolean` | Re-runs the component's loader when the input changes. | No |

### `condition`

A function that receives the component's current settings and returns whether to show the input. Annotate `data` with your settings type:

```ts theme={null}
{
  type: 'text',
  name: 'buttonText',
  label: 'Button text',
  condition: (data: { showButton?: boolean }) => data.showButton === true,
}
```

The string form (`'showButton.eq.true'`) is deprecated.

### `helpText`

`helpText` accepts HTML, so it can carry links and emphasis:

```ts theme={null}
{
  type: 'toggle-group',
  name: 'loading',
  label: 'Image loading',
  helpText:
    'Learn more about <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading" target="_blank" rel="noopener noreferrer">image loading strategies</a>.',
  // ...
}
```

![Help text input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/help-text-input.webp?v=1743390826)

### `shouldRevalidate`

In a Next.js storefront, loaders live only in the server registry, so Studio can't tell which inputs a loader reads. Set `shouldRevalidate: true` on every input your loader depends on, resource pickers included. Studio then re-runs that one component's loader through your [revalidation route](https://weaverse.io/docs/nextjs/studio.md#per-item-revalidation) when the merchant changes the input. Without it, the settings update but `loaderData` stays stale until the page reloads.

## Basic Inputs

### `heading`

Adds a title inside a settings group to organize long lists. It holds no value and needs no `name`.

```ts theme={null}
{ type: 'heading', label: 'Content settings' }
```

![Heading input type example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/heading-input.png?v=1745227001)

### `text`

A single line of plain text, for headings, button labels and short messages.

**Returns** `string`.

```ts theme={null}
{
  type: 'text',
  name: 'heading',
  label: 'Heading',
  defaultValue: 'Testimonials',
  placeholder: 'Enter section heading',
}
```

![Text input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/text-input.webp?v=1743407119)

### `textarea`

Multi-line plain text, for descriptions, quotes and policies.

**Returns** `string`.

```ts theme={null}
{
  type: 'textarea',
  name: 'customerTestimonial',
  label: 'Customer testimonial',
  defaultValue: 'The shipping was fast, and the packaging was eco-friendly.',
  placeholder: 'Share a customer experience...',
}
```

![Textarea input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/text-area-input.webp?v=1743407119)

### `richtext`

A rich text editor that produces HTML. It includes AI-assisted writing.

**Returns** `string` (HTML).

```ts theme={null}
{
  type: 'richtext',
  name: 'promotionDetails',
  label: 'Promotion details',
  defaultValue: '<p>Enjoy <strong>limited-time</strong> savings this week.</p>',
}
```

![Rich text input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/rich-text-input.webp?v=1743407119)

Render the value as HTML in your component:

```tsx theme={null}
<div dangerouslySetInnerHTML={{ __html: promotionDetails ?? '' }} />
```

### `switch`

An on/off toggle.

**Returns** `boolean`.

```ts theme={null}
{
  type: 'switch',
  name: 'enableDiscount',
  label: 'Enable discount',
  defaultValue: true,
}
```

![Switch input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/switch-input.webp?v=1743407119)

### `range`

A slider for a number within a range.

**Returns** `number`.

```ts theme={null}
{
  type: 'range',
  name: 'discountPercentage',
  label: 'Discount percentage',
  defaultValue: 10,
  configs: { min: 5, max: 50, step: 1, unit: '%' },
}
```

![Range input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/range-input.webp?v=1743407874)

| `configs` | Type | Description | Required |
| - | - | - | - |
| `min` | `number` | Lowest value. | Yes |
| `max` | `number` | Highest value. | Yes |
| `step` | `number` | Interval between values. | Yes |
| `unit` | `string` | Unit shown next to the value, such as `px` or `%`. Display only. | No |

### `select`

A dropdown with one choice.

**Returns** `string`, the chosen option's `value`.

```ts theme={null}
{
  type: 'select',
  name: 'imageAspectRatio',
  label: 'Image aspect ratio',
  defaultValue: 'auto',
  configs: {
    options: [
      { value: 'auto', label: 'Adapt to image' },
      { value: '1/1', label: '1/1' },
      { value: '3/4', label: '3/4' },
      { value: '4/3', label: '4/3' },
    ],
  },
}
```

![Select input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/sellect-input.webp?v=1743407118)

| `configs` | Type | Description | Required |
| - | - | - | - |
| `options` | `{ value: string; label: string }[]` | The choices. Each `value` must be unique. | Yes |

### `toggle-group`

The same single choice as `select`, shown as a row of buttons. It suits short lists.

**Returns** `string`, the chosen option's `value`.

```ts theme={null}
{
  type: 'toggle-group',
  name: 'alignment',
  label: 'Alignment',
  defaultValue: 'center',
  configs: {
    options: [
      { value: 'left', label: 'Left' },
      { value: 'center', label: 'Center' },
      { value: 'right', label: 'Right' },
    ],
  },
}
```

![Toggle group text input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/toggle-group-input.webp?v=1743407874)

Options can show icons instead of text. The `label` then becomes the tooltip:

```ts theme={null}
{
  type: 'toggle-group',
  name: 'alignment',
  label: 'Alignment',
  defaultValue: 'center',
  configs: {
    options: [
      { value: 'left', label: 'Left', icon: 'align-left' },
      { value: 'center', label: 'Center', icon: 'align-center' },
      { value: 'right', label: 'Right', icon: 'align-right' },
    ],
  },
}
```

![Toggle group icon input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/toggle-group-icon-input.webp?v=1743407119)

| `configs.options[]` | Type | Description | Required |
| - | - | - | - |
| `value` | `string` | Unique value of the option. | Yes |
| `label` | `string` | Text of the option, or its tooltip when `icon` is set. | Yes |
| `icon` | `string` | A [Lucide](https://lucide.dev/) icon name, such as `mail-search`. | No |
| `weight` | `string` | Icon weight: `thin`, `light`, `regular`, `bold`, `fill` or `duotone`. | No |

Not every Lucide icon is available yet. Ask in the [Slack community](https://wvse.cc/weaverse-slack) if one you need is missing.

### `image`

Lets merchants pick or upload an image. It opens the Media Manager with the images from the [Files page](https://help.shopify.com/en/manual/shopify-admin/productivity-tools/file-uploads#upload-a-file) of the merchant's Shopify admin. Uploads are saved there too, and merchants can edit alt text and set a focal point.

**Returns** a `WeaverseImage`:

```ts theme={null}
type WeaverseImage = {
  id: string
  url: string
  altText: string
  width: number
  height: number
  previewSrc: string
  focalPoint?: { x: number; y: number } // 0 to 1, from the top-left corner
}
```

```ts theme={null}
{
  type: 'image',
  name: 'authorImage',
  label: 'Author image',
  defaultValue: {
    url: 'https://cdn.shopify.com/s/files/1/0669/0262/2504/files/linkedin-sales-solutions-pAtA8xe_iVM-unsplash.jpg?v=1697429747',
    altText: 'Man standing beside wall',
    width: 689,
    height: 1034,
  },
}
```

`defaultValue` can be a `WeaverseImage` object where only `url` is required, or the image URL as a string.

![Image input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/image-input.webp?v=1743407119)

#### Rendering with `next/image`

Pass the value's fields to `next/image`. Allow `cdn.shopify.com` in `images.remotePatterns` in `next.config`, since that is where Shopify serves the files.

```tsx theme={null}
'use client'

import type {
  WeaverseImage,
  WeaverseNextComponentProps,
} from '@weaverse/hydrogen/next'
import Image from 'next/image'

interface ImageBannerProps extends WeaverseNextComponentProps {
  // A URL-string `defaultValue` reaches the component unchanged
  image?: WeaverseImage | string
}

function ImageBanner({ image, ...rest }: ImageBannerProps) {
  let src = typeof image === 'string' ? image : image?.url
  let alt = typeof image === 'string' ? '' : (image?.altText ?? '')
  return (
    <section {...rest} className="relative aspect-video">
      {src && (
        <Image
          src={src}
          alt={alt}
          fill
          sizes="100vw"
          className="object-cover"
        />
      )}
    </section>
  )
}

export default ImageBanner

export { schema } from './schema'
```

The value can be missing or partial: a merchant can clear the input, and a `defaultValue` may have no `width` or `height`. Guard on `url`, and use `fill` (or check the dimensions) because `next/image` throws without real dimensions. Forward normalizes image values in one helper, [`lib/weaverse/image.ts`](https://github.com/Weaverse/forward/blob/main/src/lib/weaverse/image.ts), which returns `null` for anything unusable.

#### Focal point

Merchants can click **Change → Set focal point** to choose the part of the image to keep in view when a section crops it. The point is saved on the value as `focalPoint: { x, y }`, each from `0` to `1` measured from the top-left corner, and is absent when unset.

The SDK only stores the point. Apply it as `object-position` on images rendered with `object-fit: cover`:

```tsx theme={null}
let objectPosition = image.focalPoint
  ? `${image.focalPoint.x * 100}% ${image.focalPoint.y * 100}%`
  : undefined

<Image
  src={image.url}
  alt={image.altText ?? ''}
  fill
  className="object-cover"
  style={{ objectPosition }}
/>
```

Skip it for images that aren't cropped (`object-fit: contain`), where it would shift them off center.

#### Filtering the Media Manager gallery

A theme can hide files from the gallery so a picker offers only what belongs there. Set the store-wide rule as a `media` key on your theme schema, and override it per input through `configs`:

```ts theme={null}
// weaverse/theme-schema.ts
export let themeSchema: WeaverseNextThemeSchema = {
  info: { name: 'My Storefront', version: '1.0.0' },
  media: { excludeFilenamePrefixes: ['thumb_v'] },
  settings: [/* ... */],
}
```

```ts theme={null}
{
  type: 'image',
  name: 'heroImage',
  label: 'Hero image',
  configs: {
    excludeFilenamePrefixes: ['thumb_v'],
    excludeProductFiles: true,
  },
}
```

| Field | Effect |
| - | - |
| `excludeFilenamePrefixes` | Hides files whose name starts with any listed prefix. The wildcard is added for you, so pass `'thumb_v'`, not `'thumb_v*'`. |
| `excludeProductFiles` | Hides files used in products. This matches usage, not origin: a file uploaded to the Files page and later attached to a product is hidden too. |

An input's `configs` overrides the theme's value field by field:

* a missing key inherits the theme's value,
* a present array or boolean replaces it for this picker,
* `excludeFilenamePrefixes: []` shows every file, ignoring the theme's list.

Pickers opened outside an input schema (the SEO image field, the rich text editor and the Translation Manager) apply the theme's rules alone. A theme with no `media` key filters nothing.

### `video`

Lets merchants pick or upload a video from the Files page, the same way as `image`. It accepts the same `configs` for [filtering the gallery](#filtering-the-media-manager-gallery).

**Returns** a `WeaverseVideo`:

```ts theme={null}
type WeaverseVideo = {
  id: string
  url: string
  altText: string
  width: number
  height: number
  previewSrc: string
}
```

```ts theme={null}
{ type: 'video', name: 'video', label: 'Video' }
```

![Video input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/weaverse_video_input.png?v=1722415681)

```tsx theme={null}
{video?.url && (
  <video src={video.url} poster={video.previewSrc} autoPlay muted loop playsInline />
)}
```

### `color`

A color picker.

**Returns** `string`, a hex color (`#RRGGBB`, or `#RRGGBBAA` with alpha).

```ts theme={null}
{
  type: 'color',
  name: 'backgroundColor',
  label: 'Background color',
  defaultValue: '#FFFFFF',
}
```

![Color input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/color-input.webp?v=1743407119)

### `datepicker`

A date and time picker, for countdowns, events and promotions.

**Returns** `number`, a timestamp in milliseconds.

```ts theme={null}
{
  type: 'datepicker',
  name: 'startDate',
  label: 'Start date',
  defaultValue: '2024-01-01',
}
```

![Date picker input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/date-picker-input.webp?v=1743407119)

Format the timestamp for display:

```ts theme={null}
let date = new Date(startDate) // 1704067200000
date.toISOString().split('T')[0] // "2024-01-01"
date.toLocaleDateString('en-US', { month: 'long', day: 'numeric', year: 'numeric' }) // "January 1, 2024"
```

> [!TIP]
>
> The server and the browser can format a date differently (time zones, locales), which causes a hydration mismatch. Pass an explicit `timeZone` to `toLocaleDateString`, or format the date in the loader.

### `map-autocomplete`

> [!WARNING]
>
> Experimental. It may not work as expected.

A location field that suggests places as the merchant types.

**Returns** `string`, the selected place.

```ts theme={null}
{
  type: 'map-autocomplete',
  name: 'address',
  label: 'Business address',
  defaultValue: 'San Francisco, CA',
}
```

![Map autocomplete input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/map-input.webp?v=1743407119)

### `position`

Picks a content position on a 3×3 grid of arrows.

**Returns** `string`, one of `top left`, `top center`, `top right`, `center left`, `center center`, `center right`, `bottom left`, `bottom center` or `bottom right`.

```ts theme={null}
{
  type: 'position',
  name: 'contentPosition',
  label: 'Content position',
  defaultValue: 'center center',
}
```

![Position input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/weaverse_position_input.png?v=1722416367)

### `url`

A URL field with a link picker for pages in the store.

**Returns** `string`.

```ts theme={null}
{
  type: 'url',
  name: 'buttonLink',
  label: 'Button link',
  defaultValue: '/products',
}
```

![URL input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/url_input.png?v=1712823900)

Render internal paths with `next/link`. The picker returns Shopify-style paths (`/products/...`, `/collections/...`); if your routes differ, declare them in the theme schema's `routes` so Studio links to the right place. See [Theme routes](https://weaverse.io/docs/nextjs/studio.md#theme-routes).

## Resource Picker Inputs

Resource pickers let merchants search for and select Shopify resources. They return only the resource's `id` and `handle`:

```ts theme={null}
type WeaverseProduct = { id: number; handle: string } // same shape for collections, blogs and metaobjects
```

The full data comes from a loader. Give every resource picker `shouldRevalidate: true`, so the loader re-runs when the merchant changes the selection.

| Type | Returns | Type to import |
| - | - | - |
| `product` | One resource | `WeaverseProduct` |
| `product-list` | An array | `WeaverseProduct[]` |
| `collection` | One resource | `WeaverseCollection` |
| `collection-list` | An array | `WeaverseCollection[]` |
| `blog` | One resource | `WeaverseBlog` |
| `metaobject` | One resource | `WeaverseMetaObject` |

All of these types come from `@weaverse/hydrogen/next`.

### `product`

```ts theme={null}
{
  type: 'product',
  name: 'product',
  label: 'Featured product',
  shouldRevalidate: true,
}
```

![Product input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/product-input.webp?v=1743407119)

### `product-list`

```ts theme={null}
{
  type: 'product-list',
  name: 'products',
  label: 'Products',
  shouldRevalidate: true,
}
```

![Product list input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/product-list-input.webp?v=1743407119)

### `collection`

```ts theme={null}
{
  type: 'collection',
  name: 'collection',
  label: 'Collection',
  shouldRevalidate: true,
}
```

![Collection input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/collection-input.webp?v=1743407119)

### `collection-list`

```ts theme={null}
{
  type: 'collection-list',
  name: 'collections',
  label: 'Collections',
  shouldRevalidate: true,
}
```

![Collection list input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/collection-list-input.webp?v=1743407119)

### `blog`

```ts theme={null}
{
  type: 'blog',
  name: 'blog',
  label: 'Blog',
  shouldRevalidate: true,
}
```

![Blog input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/blog-input.webp?v=1743407119)

### `metaobject`

Selects a metaobject from the store.

```ts theme={null}
{
  type: 'metaobject',
  name: 'teamMember',
  label: 'Team member',
  shouldRevalidate: true,
}
```

![Metaobject input example](https://cdn.shopify.com/s/files/1/0838/0052/3057/files/weaverse_metaobject_input.png?v=1722477096)

### Fetching the Selected Resource

A loader reads the selection from `data` and queries the Storefront API. This one uses the `commerce.storefront` client you pass to the server client:

```ts theme={null}
// sections/single-product/loader.ts
import type {
  WeaverseNextComponentLoaderArgs,
  WeaverseProduct,
} from '@weaverse/hydrogen/next'

interface SingleProductData {
  product?: WeaverseProduct
}

export async function loader({ data, commerce }: WeaverseNextComponentLoaderArgs) {
  let { product } = data as SingleProductData
  if (!product?.handle) {
    return null
  }

  return commerce?.storefront?.query(PRODUCT_QUERY, {
    variables: { handle: product.handle },
  })
}
```

The component renders a placeholder until something is picked:

```tsx theme={null}
function SingleProduct({ loaderData, ...rest }: SingleProductProps) {
  if (!loaderData) {
    return <section {...rest}>Select a product in Studio</section>
  }
  // ...
}
```

Add the loader to the server registry, keyed by the component's `type`. [Data Fetching](https://weaverse.io/docs/nextjs/data-fetching.md) covers the loader arguments, the commerce context, querying in the request's market, and caching.

## Next Steps

> [card] [Component Schema](https://weaverse.io/docs/nextjs/component-schema.md)
>
> Groups, children, presets and availability.

> [card] [Creating Components](https://weaverse.io/docs/nextjs/creating-components.md)
>
> Write, register and type a component.

> [card] [Data Fetching](https://weaverse.io/docs/nextjs/data-fetching.md)
>
> Turn resource picker selections into data.

> [card] [Rendering Pages](https://weaverse.io/docs/nextjs/rendering-pages.md)
>
> Render Weaverse pages in App Router routes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.