Skip to main content

Component Schema

A component’s schema links your code to Weaverse Studio. It sets the name merchants see, the settings they can edit, which components can be nested inside it, and on which pages it can be added.

Where the Schema Lives

In a Next.js storefront, put each schema in its own module and re-export it from the component:
Both registries need the schema. The client registry imports the component module (and gets the schema through the re-export); the server registry imports schema.ts directly, next to the loader. So the schema module must stay server-safe: no 'use client', no hooks, no imports of client components. Type-only imports are fine. See Creating Components.

The createSchema() Function

createSchema() takes a schema object and returns it unchanged:
  • Type checking. It accepts the public SchemaType, so TypeScript checks your schema and autocompletes its properties.
  • Development diagnostics. Outside production, it validates the schema asynchronously and logs issues as warnings. Warnings never throw or stop a build.
  • No production cost. Production builds skip the validation code.
You can also annotate the object with SchemaType instead. It is the same contract without the development diagnostics:

Anatomy

Essential Properties

title and type

title is the name merchants see in the Page Outline and the Add Section menu. Keep it short (one to three words), in plain language. Page outline type is the component’s unique identifier. Weaverse stores it on every saved instance and uses it to find the component in your registries, so:
  • use kebab-case (hero-banner, featured-products),
  • keep it unique across the theme, and
  • don’t rename it once merchants have used the component: saved instances keep the old type and no longer match.
The client and server registries pair a schema with its component and loader by type, so a loader keyed under a different string never runs.

label

The optional label callback helps merchants tell repeated elements apart in the Page Outline. Studio keeps the title and appends the returned text as a muted suffix: Heading – Summer sale. The Add Section menu still shows title alone. This is Forward’s heading schema, trimmed. It annotates data with the component’s props type, imported as a type only:
  • Per instance. One callback applies to every instance, each with its own current data.
  • Preview language. Data includes current edits and the translations for the preview’s content language, and labels update as either changes.
  • Plain text, synchronously. Return a string, null or undefined. Don’t return JSX, HTML or a Promise, and don’t cause side effects. Blank results, thrown errors and async results show the title alone.
  • Display only. The label is computed in the storefront preview and never saved to your content.

settings

settings lists the controls merchants get in the Studio settings panel, as groups of inputs:
  • group is the group’s label, such as “Content”, “Layout” or “Style”.
  • inputs are the controls. Each input’s name is the prop your component receives.
Each input’s defaultValue seeds a new instance, and the SDK merges the defaults under saved settings before your component and its loader see them. Keep group names and their order consistent across components so merchants learn them once. Input Settings lists every input type and what it returns.

Component Relationships

childTypes

childTypes lists the component types merchants can add inside this one. Without it, the component accepts no children. Render the children through the children prop:
Every type you list must be registered.

Standalone and Nested Components

Listing a type in any registered component’s childTypes makes Studio treat that type as child-only: it disappears from the root Add Section picker, even when enabled returns true. To use a component both as a section and nested inside a parent, keep the parent’s childTypes and the child’s type, and add enabledOn.groups with '*' or 'body' to the child:
sections/feature-list/schema.ts
sections/feature-card/schema.ts
  • Studio evaluates body placement only today, so ['*'] and ['body'] both make the component eligible for Add Section. Use ['*'] when the component had no groups before, so the opt-in adds no restriction.
  • Every other rule must still pass, including enabled and enabledOn.pages.
  • The nested picker is unaffected.
Keep this enabledOn field on dual-use components even after moving other availability rules to enabled.

presets

presets sets the settings and children a component starts with when a merchant adds it:
This is Forward’s featured-products preset. It adds two section-content children, each with its own nested elements, so a new section is ready to use:
Don’t hardcode product or collection handles in presets: they differ from store to store. Leave resource pickers empty and render a placeholder until the merchant picks one, as Forward’s featured-products does.

Availability and Placement

limit

limit caps how many instances can exist in the parent (or on the page, for top-level sections). When the limit is reached, Studio disables the component in the Add menu.

enabled

enabled controls whether the component can be inserted on the current page. Use a boolean for a simple switch, or a synchronous callback that inspects the page:
The callback receives:
The callback runs in the storefront preview, from the client registry, whenever Studio sets up or refreshes its page context. page.type and page.handle come from the route identity your route reports; see Report the route identity. The callback must be pure and return a boolean right away. Returning anything else, returning a Promise or throwing makes the component unavailable for new insertion without breaking Studio. Existing instances stay visible and editable.
Studio evaluates insertion for the body group today. header and footer are reserved for future placement surfaces.

enabledOn (deprecated)

enabledOn is the older way to restrict availability. It still works, and when a schema has both, both rules must pass. For new rules, use enabled:
Keep enabledOn.groups on a component that is listed in another component’s childTypes and must still appear as a section. enabled does not replace that opt-in. See Standalone and Nested Components.
Until Weaverse/builder#3454 ships, Studio’s Page sections grouping in the Add Section menu still reads enabledOn.pages, so a page-specific section that uses only enabled is listed with the general sections. Availability is the same either way.

Conditional Inputs

An input’s condition shows it only when the condition matches. Use a function, which receives the component’s current data. condition isn’t typed per component, so annotate data yourself (strict TypeScript otherwise reports an implicit any):
Conditions can combine several fields:
The string form (condition: 'showButton.eq.true') is deprecated. Use functions for new components.

Re-running Loaders

shouldRevalidate: true on an input re-runs the component’s loader when a merchant changes that input in Studio. Set it on every input your loader reads, resource pickers included:
In a Next.js storefront, loaders live only in the server registry, so Studio can’t see that a component has one. Without the flag, changing the input updates the settings but keeps the old loaderData. The re-run goes through your revalidation route; see Per-item revalidation.

Heading Inputs

A heading input adds a title inside a settings group. It holds no data:

Sharing Inputs Between Schemas

Inputs are plain data, so you can define common ones once and reuse them. Forward declares its layout inputs in one module and spreads them into every section:
Keep shared input modules server-safe too, since schemas import them.

Complete Example

Migrating from inspector

inspector is the old name for settings. Rename it:
A schema with only inspector still works and logs a deprecation warning.
settings does not replace inspector. When a schema has both, the SDK concatenates them (settings first), so a group copied into settings without deleting it from inspector shows up twice in Studio. Delete each inspector group as you move it.

Troubleshooting

  • Validation warnings in the console. In development, createSchema() logs warnings for missing fields, unknown input types or malformed configs. Fix them; they don’t stop the build.
  • Duplicate type. Each type must be unique across the theme.
  • Child component not offered. Its type isn’t in the parent’s childTypes, or it isn’t in the client registry.
  • Component missing from Add Section. Check enabled for the current page type, handle, locale and group, then limit. If its type is in another component’s childTypes, see Standalone and Nested Components.
  • Wrong page type in enabled. The route reports a different pageType or handle than you expect. See Report the route identity.
  • Data doesn’t refresh after an edit. The input lacks shouldRevalidate: true. See Re-running Loaders.
  • A client component ends up in the server bundle. The schema module imports the component (or another client module) at runtime. Use import type, or move shared values into a server-safe module.
  • Groups appear twice. The schema has both settings and inspector. See Migrating from inspector.

Next Steps

Input Settings

Every input type and what it returns.

Creating Components

Write, register and type a component.

Data Fetching

Loaders, caching and per-item revalidation.

Studio Integration

Route identity, revalidation and theme routes.
Last modified on November 30, 2026