> ## 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

# Types

> TypeScript interfaces and types for Weaverse Hydrogen development.

# Types

> **Agent note:** On `SchemaType` (alias `WeaverseComponentSchema`), `inspector` and `enabledOn` are deprecated. Generate `settings` instead of `inspector`. Do not add `enabledOn` to new components, except `enabledOn.groups` with `'body'` or `'*'` on a component that is used both as a top-level section and as a child.

This page summarizes the primary public types exported by `@weaverse/hydrogen` (import them from `@weaverse/hydrogen/react-router`) and `@weaverse/schema`.

## Component Types

### `WeaverseComponent`

A component definition registered with Weaverse. The default export can be a forwarded-ref component or a function component.

```typescript theme={null}
type WeaverseComponent<T extends WeaverseComponentProps = any> = {
  default:
    | ForwardRefExoticComponent<T>
    | ((props: T) => React.JSX.Element)
  schema: WeaverseComponentSchema
  loader?: (args: WeaverseComponentLoaderArgs) => Promise<unknown>
}
```

### `WeaverseComponentProps`

```typescript theme={null}
interface WeaverseComponentProps<L = any> extends WeaverseElement {
  children?: React.JSX.Element[]
  className?: string
  loaderData?: L
}
```

### `WeaverseComponentSchema`

`WeaverseComponentSchema` is the current public alias for `SchemaType`. The type itself is not deprecated; only `inspector` and `enabledOn` are deprecated.

```typescript theme={null}
type WeaverseComponentSchema = SchemaType

interface SchemaType {
  title: string
  type: string
  label?(data: Record<string, any>): string | null | undefined
  childTypes?: string[]
  settings?: InspectorGroup[]
  /** @deprecated Use settings. */
  inspector?: InspectorGroup[]
  presets?: {
    children?: ComponentPresets[]
    [key: string]: any
  }
  limit?: number
  enabled?: Resolvable<boolean, ComponentAvailabilityContext>
  /** @deprecated Use enabled. */
  enabledOn?: {
    pages?: PageType[]
    groups?: Array<'*' | ComponentGroup>
  }
}
```

`label` is optional and available in `@weaverse/schema` 0.17.0+ / `@weaverse/hydrogen` 5.22.0+. The method signature accepts callbacks explicitly annotated with the component's props type, such as `label: (data: HeadingProps) => data.content`; without an annotation, `data` is `Record<string, any>`. It returns synchronous plain text for the Studio outline, not a replacement for the static `title`. See [`label`](https://weaverse.io/docs/development-guide/component-schema#label) for the example, preview-language behavior and fallback rules.

Use `createSchema()` to type-check an object against `SchemaType` and enable development-time diagnostics:

```tsx theme={null}
import { createSchema } from '@weaverse/hydrogen/react-router'

export const schema = createSchema({
  type: 'hero-banner',
  title: 'Hero Banner',
  settings: [],
})
```

`createSchema()` returns the original schema immediately. Outside production it asynchronously lazy-loads Zod and logs validation issues as warnings; validation and import failures do not throw through the call. Production builds skip this validation path.

### `WeaverseComponentData`

```typescript theme={null}
interface WeaverseComponentData extends ElementData {
  id: string
  type: string
  children?: { id: string }[]
  data?: Record<
    string,
    ComponentDataValue | Record<string, unknown>
  >
  createdAt?: string
  updatedAt?: string
  deletedAt?: string
}
```

## Inspector Types

The public types retain “Inspector” in their names for compatibility, but new schemas should use the `settings` property.

### `InspectorGroup`

```typescript theme={null}
interface InspectorGroup {
  group: string
  inputs: (BasicInput | HeadingInput)[]
}
```

### `BasicInput`

```typescript theme={null}
interface BasicInput {
  type: InputType
  name: string
  label?: string
  placeholder?: string
  helpText?: string
  configs?: ConfigsProps
  defaultValue?: unknown
  shouldRevalidate?: boolean
  sensitive?: boolean
  condition?: string | Function
}
```

String conditions remain supported but are deprecated; prefer a function.

### `HeadingInput`

```typescript theme={null}
interface HeadingInput {
  type: 'heading'
  label: string
  [key: string]: unknown
}
```

## Loader Types

### `WeaverseComponentLoaderArgs`

```typescript theme={null}
type WeaverseComponentLoaderArgs<T = any, _E = any> = {
  data: T
  weaverse: WeaverseClient
}
```

### `RouteLoaderArgs`

```typescript theme={null}
interface RouteLoaderArgs extends LoaderFunctionArgs {
  context: WeaverseRouteAppLoadContext
}
```

`WeaverseRouteAppLoadContext` includes the Hydrogen context and a `weaverse: WeaverseClient` property.

### `WeaverseLoaderData`

```typescript theme={null}
type WeaverseLoaderData = {
  configs: Omit<WeaverseProjectConfigs, 'publicEnv'> & {
    requestInfo: WeaverseLoaderRequestInfo
  }
  page: WeaversePageData
  project: WeaverseProjectType
  pageAssignment?: WeaversePageAssignment
}
```

## Theme Types

### `WeaverseThemeSettings`

```typescript theme={null}
type WeaverseThemeSettings = {
  [key: string]: any
}
```

### `WeaverseThemeSchema`

```typescript theme={null}
type WeaverseThemeSchema = {
  info: {
    name: string
    version: string
    author: string
    authorProfilePhoto: string
    documentationUrl: string
    supportUrl: string
  }
  /** @deprecated Use settings. */
  inspector?: InspectorGroup[]
  /** Store-wide Media Manager filtering. Not merchant-editable. */
  media?: {
    excludeFilenamePrefixes?: string[]
    excludeProductFiles?: boolean
  }
  settings?: InspectorGroup[]
  routes?: ThemeRoutes
  i18n?: {
    urlStructure: 'url-path' | 'subdomain' | 'top-level-domain'
    defaultLocale: WeaverseI18n
    shopLocales: WeaverseI18n[]
    staticContent?: Record<string, unknown>
    translation?: boolean
  }
}
```

`media` sets what the Media Manager gallery hides for every picker in the theme. It is a sibling of
`settings` rather than an entry inside it, because `settings` renders as merchant-editable controls and
these rules are meant to be fixed by the theme author. An `image` or `video` input can override them for
its own picker — see [Filtering the Media Manager gallery](https://weaverse.io/docs/development-guide/input-settings.md#filtering-the-media-manager-gallery).

`routes` declares URL patterns that Studio uses for page navigation and URL picking. It is available as a typed field in `@weaverse/hydrogen` 5.23.0+ and on `WeaverseNextThemeSchema` in `@weaverse/hydrogen/next` (`@weaverse/hydrogen` 6.0.0+). See [Declare Theme Routes for Studio](https://weaverse.io/docs/features/custom-routing.md#declare-theme-routes-for-studio) for configuration, the Forward example, and fallback behavior.

### `ThemeRoutes` and `ThemeRoutePageType`

Exported by `@weaverse/schema` 0.18.0+. `@weaverse/hydrogen` 6 doesn't re-export them from any entry, including `@weaverse/hydrogen/next`; import them from `@weaverse/schema`:

```typescript theme={null}
type ThemeRoutePageType = Exclude<PageType, '*' | 'CUSTOM'>
type ThemeRoutes = Partial<Record<ThemeRoutePageType, string>>
```

Each optional entry maps a supported [page type](#page-types) to an absolute path with static segments and whole `:handle` or `:blog` segments. `CUSTOM` pages carry their own path; `*` is not a route key. TypeScript checks the keys, while pattern values remain strings. See the guide's [supported keys and patterns](https://weaverse.io/docs/features/custom-routing.md#supported-keys-and-patterns) for the grammar and parameter meanings.

## Page Types

```typescript theme={null}
type PageType =
  | '*'
  | 'INDEX'
  | 'PRODUCT'
  | 'ALL_PRODUCTS'
  | 'COLLECTION'
  | 'COLLECTION_LIST'
  | 'PAGE'
  | 'BLOG'
  | 'ARTICLE'
  | 'CUSTOM'
```

## Component Availability

The canonical types are exported by `@weaverse/schema`. `@weaverse/hydrogen` 6 re-exports only `createSchema`, `SchemaType`, `BasicInput`, `InspectorGroup` and `PageType` from it:

```typescript theme={null}
interface ComponentAvailabilityContext {
  group: 'body' | 'header' | 'footer'
  page: {
    id: string
    type: PageType
    handle: string
    locale: string
  }
}

type ComponentGroup = 'body' | 'header' | 'footer'

type Resolvable<T, Context> =
  | T
  | ((context: Context) => T)
```

Use `enabled` for static or synchronous conditional availability:

```typescript theme={null}
const schema = createSchema({
  type: 'product-details',
  title: 'Product details',
  enabled: ({ page, group }) =>
    page.type === 'PRODUCT' && group === 'body',
})
```

`enabledOn` remains supported for backward compatibility but is deprecated. Avoid relying on undocumented behavior for thrown errors, promises, RPC serialization, or existing instances; these semantics are not part of the public SDK contract.

`enabled` controls insertion availability only. A type listed in any component's `childTypes` appears in the root **Add Section** picker only when its `enabledOn.groups` contains `'body'` or `'*'`, even if `enabled` returns `true`. Keep that field on dual-use components during migration; see [Standalone and Nested Components](https://weaverse.io/docs/development-guide/component-schema.md#standalone-and-nested-components).

## Internationalization

```typescript theme={null}
type WeaverseI18n = I18nConfig & { // `I18nConfig` from `@shopify/hydrogen`
  label?: string
  pathPrefix?: string
  [key: string]: any
}
```

## Usage Example

```tsx theme={null}
import type { Ref } from 'react'
import { Cache, gql } from '@shopify/hydrogen'
import {
  createSchema,
  type WeaverseComponentLoaderArgs,
  type WeaverseComponentProps,
} from '@weaverse/hydrogen/react-router'

type Product = {
  id: string
  title: string
}

type HeroLoaderData = {
  featuredProducts: Product[]
}

type HeroBannerProps = WeaverseComponentProps<HeroLoaderData> & {
  heading: string
  subheading?: string
  ref?: Ref<HTMLElement>
}

function HeroBanner({
  heading,
  subheading,
  loaderData,
  ref,
  ...rest
}: HeroBannerProps) {
  return (
    <section ref={ref} {...rest}>
      <h1>{heading}</h1>
      {subheading && <p>{subheading}</p>}
      {loaderData?.featuredProducts.map((product) => (
        <div key={product.id}>{product.title}</div>
      ))}
    </section>
  )
}

const schema = createSchema({
  type: 'hero-banner',
  title: 'Hero Banner',
  settings: [
    {
      group: 'Content',
      inputs: [
        {
          type: 'text',
          name: 'heading',
          label: 'Heading',
          defaultValue: 'Welcome to our store',
        },
      ],
    },
  ],
})

const FEATURED_PRODUCTS_QUERY = gql(`
  query featuredProducts($country: CountryCode, $language: LanguageCode)
  @inContext(country: $country, language: $language) {
    products(first: 4) { nodes { id title } }
  }
`)

async function loader({
  weaverse,
}: WeaverseComponentLoaderArgs): Promise<HeroLoaderData> {
  const { data } = await weaverse.storefront.graphql(FEATURED_PRODUCTS_QUERY, {
    cache: Cache.short(),
  })

  return {
    featuredProducts: data?.products.nodes ?? [],
  }
}

export default HeroBanner
export { loader, schema }
```

## Type Extensions

A Hydrogen app augments its load context and environment in `env.d.ts`. Hydrogen 2026.10 has no `HydrogenEnv`, so `Env` extends the SDK's `WeaverseEnv`, and the context type comes from the app's own `createAppContext()` (see the [v6 migration guide](https://weaverse.io/docs/migration-advanced/v6-migration.md#step-4-build-the-app-context-yourself)):

```typescript theme={null}
import type { WeaverseEnv } from '@weaverse/hydrogen/react-router'
import type { AppContext } from './app/.server/context' // includes `weaverse: WeaverseClient`

declare module 'react-router' {
  interface AppLoadContext extends AppContext {}
  interface RouterContextProvider extends AppContext {}
}

declare global {
  interface Env extends WeaverseEnv {
    SESSION_SECRET: string
    PUBLIC_STORE_DOMAIN: string
    WEAVERSE_PROJECT_ID: string
    WEAVERSE_HOST?: string
    WEAVERSE_API_KEY?: string
  }
}
```

## Related

* [WeaverseHydrogenRoot](https://weaverse.io/docs/api-reference/weaverse-root.md) - Render Weaverse loader data
* [WeaverseClient](https://weaverse.io/docs/api-reference/weaverse-client.md) - Fetch Weaverse content


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