Skip to main content

Anatomy

Input allows developers to specify a set of configurations that merchants can adjust to customize a component. Each setting provides a specific control, from simple text inputs to complex selectors. Input settings are generally composed of standard attributes. We can classify them into two main categories:

Overview

A quick look at an input configs type:

Attributes Details

Here’s a breakdown of the available attributes in an input setting:
  • condition The condition attribute enables developers to define conditions under which an input will be displayed. It supports two formats:
    1. Function-based conditions (Recommended):
    2. String-based conditions (Deprecated):
    Note to users: String-based conditions are deprecated. For new components, we strongly recommend using function-based conditions which offer more flexibility and better type safety.
    Function-based conditions receive the component’s current data and the Weaverse instance, allowing for more complex conditional logic that can reference multiple fields or perform calculations.
  • helpText The helpText attribute can utilize HTML, offering more expressive help instructions. This allows for the inclusion of links, emphasis using bold or italics, lists, and more. Example:
    data-line-numbers=false
    Will appear as: Help text input example

Basic Inputs

heading

The heading input type is a special input that creates a heading or section title in the settings panel. It’s used to organize inputs into logical groups. Example:
Output: Heading input type example

text

The text input allows merchants to enter a single line of plain text. It’s frequently used for capturing headings, button text, or short promotional messages. Return: string - The inputted text value. Example:
Output: Text input example

textarea

The textarea input provides a multi-line text box suitable for longer descriptions, like testimonials, user reviews, or shipping and return policies. Return: string - The inputted multiline text value. Example:
Output: Textarea input example

switch

The switch input provides a toggle option. This can be useful for enabling or disabling product availability, promotional features, or customer reviews. Return: boolean - Indicates whether the switch is turned on (true) or off (false). Example:
Output: Switch input example

range

The range input lets merchants select a value within a set range. This can be used for adjusting quantities, setting percentages, or customizing display sizes. Return: number - The selected value within the defined range. Example:
Output: Range input example configs details:

select

The select input provides a dropdown list, allowing merchants to select one option from a predefined list of options. Return: string - The selected option’s value. Example:
Output: Select input example configs details:

toggle-group

The toggle group input allows merchants to make a selection from a group of toggleable options (only one choice is allowed). While it functions similarly to the select input, its UI is distinct, showcasing options as toggle buttons. This makes it particularly useful and user-friendly for cases with fewer options, allowing for a more intuitive selection process. Return: string - The chosen option’s value. Example (Display as Text):
Output: Toggle group text input example Example (Display as Icon):
Output: Toggle group icon input example configs details 💡 Note for icons:
  • We use Lucide Icons library for the icons.
  • The value is the Icon name (e.g: mail-search, bar-chart-horizontal…)
  • Not all icons are supported yet. Please contact us if you need an icon that is missing from your configs.

richtext

The richtext input allows merchants to craft content using a rich text editor, providing flexibility and more advanced text formatting options. Return: string - A string containing rich-text (HTML) formatted content. Example:
Output: Rich text input example 🌟 Pro Tip: our richtext input comes with AI-powered content generation capabilities, allowing merchants to effortlessly craft top-notch content, from descriptions to promotional texts and more. Rich text AI-powered input example

image

The image input offers merchants the ability to select or upload images. Here’s how it works:
  • Media Manager: on open, it displays the Media Manager modal with all images from the Files page of the merchant’s Shopify Admin.
  • Uploading Images: any image a merchant uploads through this input is saved to the Files page as well.
  • Enhancing SEO: merchants can edit the alt text of the images they’ve uploaded.
A theme can hide files from the gallery so a picker only offers what belongs in it. Declare the store-wide default on HydrogenThemeSchema.media, and override it for a single input through configs:
An input’s configs overrides the theme value field by field:
  • the key is absent — the input inherits the theme’s value
  • an array or boolean is present — it replaces the theme’s value for this picker
  • excludeFilenamePrefixes: [] — this picker shows every file, ignoring the theme’s list
Declaring one field never resets the other, and there is no flag to enable overriding: the presence of the key is the signal. 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 that declares no media key filters nothing, which is not an error. Return: object - A WeaverseImage object with the following structure:
Example:
📌 Note: The defaultValue in the input configuration can either be:
  • an object of the WeaverseImage type (where all properties are optional except for the url)
  • or a string representing the image URL
Output: Image input example Usage We highly recommend developers use the Image component from the @shopify/hydrogen package to render images. It’s optimized to work with the data returned from the image input, ensuring efficient image delivery. Here’s a simple example:

video

The video input offers merchants the ability to select or upload videos. Here’s how it works:
  • Media Manager: on open, it displays the Media Manager modal with all videos from the Files page of the merchant’s Shopify Admin.
  • Uploading Videos: any video a merchant uploads through this input is saved to the Files page as well.
  • Enhancing SEO: merchants can edit the alt text of the videos they’ve uploaded.
  • Filtering the gallery: video inputs accept the same configs as image — see Filtering the Media Manager gallery.
Return: object - A WeaverseVideo object with the following structure:
Example:
Output: Video input example

color

The color input type allows merchants to select a color using a color picker. This can be handy for design-related settings, such as background color, text color, border color, etc. Return: string - A color in hex format (e.g., #RRGGBB or #RRGGBBAA if alpha is set). Example:
Output: Color input example

datepicker

The datepicker input type provides merchants with a way to select a specific date and time, making it ideal for scheduling content, setting event dates, or determining promotional periods. Return: number - A timestamp of the selected date and time. Example:
Output: Date picker input example 💡 Parsing: The returned timestamp should be transformed into a readable date-time string, for example:

map-autocomplete

🚧 - Experimental feature, may not work as expected. The map-autocomplete input provides merchants with a location-based autocomplete functionality. As merchants type in the input, a dropdown list of suggested places appears. Return: string - The selected location or place name from the dropdown suggestions. Example:
Output: Map autocomplete input example

position

The position input enables merchants to select a content alignment from a predefined subset of positions using intuitive directional arrows. Return: string - The selected content position from the following allowed values:
  • top left | top center | top right
  • center left | center center | center right
  • bottom left | bottom center | bottom right
Example:
Output: Position input example

blog

The blog input provides merchants with an intuitive search and select interface to choose a specific blog from their store. Return: object - A WeaverseBlog object (type can be imported from @weaverse/hydrogen package). Example:
Output: Blog input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting a blog. Please use the handle or id of the selected blog to fetch the full blog data.

metaobject

The metaobject input provides merchants with an intuitive search and select interface to choose a specific metaobject definition from their store. Return: object - A WeaverseMetaobject object with the following structure:
Example:
Output: Metaobject input example Similar to other resource picker inputs, when selecting a metaobject definition, the preview will automatically revalidate and run the loader function. Use the handle or id of the selected metaobject to fetch the full data from the Storefront API.

collection

The collection input provides merchants with an intuitive search and select interface to choose a specific collection from their store. Return: object - A WeaverseCollection object (type can be imported from @weaverse/hydrogen package). Example:
Output: Collection input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting a collection. Please use the handle or id of the selected collection to fetch the full collection data.

collection-list

The collection-list input provides merchants with an intuitive search and select interface to choose multiple collections from their store. Return: array - An array of WeaverseCollection object with their respective IDs and handles. Example:
Output: Collection list input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting collections. Please use the handle or id of the selected collection to fetch the full collection data.

Querying Storefront Data

After using the Resource Picker inputs, you might notice that the returned data is limited, typically just the id and handle of the selected resource. In most cases, you’ll need more detailed data for your components or routes. This is where the Weaverse client comes in handy. Using its storefront.query function, you can fetch the full set of data related to your selection from Shopify’s Storefront API. To learn more about how to effectively fetch and utilize data within Weaverse, refer to our dedicated section on Data Fetching & Caching.

Resource Picker Inputs

url

The url input allows merchants to enter a URL or select a page from their store using the internal link picker. Return: string - The entered URL or the selected page’s URL. Example:
Output: URL input example

product

The product input provides merchants with an intuitive search and select interface to choose a specific product from their store. Return: object - A WeaverseProduct object (type can be imported from @weaverse/hydrogen package). Example:
Output: Product input example When selecting a product, the preview will automatically revalidate and run the loader function. The loader function will read the handle or id of the selected product and fetch all the product data from the Storefront API. Here’s an example of how to use the loader function:

product-list

The product-list input provides merchants with an intuitive search and select interface to choose multiple products from their store. Return: array - An array of WeaverseProduct object with their respective IDs and handles. Example:
Output: Product list input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting products. Please use the handle or id of the selected product to fetch the full product data.

collection

The collection input provides merchants with an intuitive search and select interface to choose a specific collection from their store. Return: object - A WeaverseCollection object (type can be imported from @weaverse/hydrogen package). Example:
Output: Collection input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting a collection. Please use the handle or id of the selected collection to fetch the full collection data.

collection-list

The collection-list input provides merchants with an intuitive search and select interface to choose multiple collections from their store. Return: array - An array of WeaverseCollection object with their respective IDs and handles. Example:
Output: Collection list input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting collections. Please use the handle or id of the selected collection to fetch the full collection data.

blog

The blog input provides merchants with an intuitive search and select interface to choose a specific blog from their store. Return: object - A WeaverseBlog object (type can be imported from @weaverse/hydrogen package). Example:
Output: Blog input example Similar to the product input, the preview will automatically revalidate and run the loader function when selecting a blog. Please use the handle or id of the selected blog to fetch the full blog data.

metaobject

The metaobject input provides merchants with an intuitive search and select interface to choose a specific metaobject definition from their store. Return: object - A WeaverseMetaobject object with the following structure:
Example:
Output: Metaobject input example Similar to other resource picker inputs, when selecting a metaobject definition, the preview will automatically revalidate and run the loader function. Use the handle or id of the selected metaobject to fetch the full data from the Storefront API.

Querying Storefront Data

After using the Resource Picker inputs, you might notice that the returned data is limited, typically just the id and handle of the selected resource. In most cases, you’ll need more detailed data for your components or routes. This is where the Weaverse client comes in handy. Using its storefront.query function, you can fetch the full set of data related to your selection from Shopify’s Storefront API. To learn more about how to effectively fetch and utilize data within Weaverse, refer to our dedicated section on Data Fetching & Caching.

Next Steps

Now that you have a solid understanding of Input Settings, let’s learn how to render a Weaverse page in the next article: Rendering a Weaverse Page.