1. Docs
  2. Build a Weaverse Hydrogen Theme

Input Settings

Published on Sep 27, 2023, updated 5 months ago


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:


A quick look at an input configs type:

type Input = {  type: InputType  name: string  defaultValue: string | number | boolean | Partial<WeaverseImage>  label?: string  placeholder?: string  configs?: AdditionalInputConfigs  condition?: string  helpText?: string}

Attributes Details

Here's a breakdown of the available attributes in an input setting:

typeInputTypeSpecifies the kind of UI control the merchant will interact with.
namestringThe key of the value in the component's data. E.g., "title" binds to component.data.title.
defaultValuestring | number | boolean | WeaverseImageSets initial values for inputs and initial data for the component.
labelstringA label for the input to show in the Weaverse Studio's Inspector
placeholderstringA placeholder text to show when the input is empty.
configsAdditionalInputConfigsAdditional options for inputs require more configuration. (Available for select, toggle-group, and range input)
conditionstringOnly displays the input if the specified condition matches.
helpTextstringProvides additional information or instructions for the input setting (HTML format supported).
  • condition

    The condition attribute enables developers to define conditions under which an input will be displayed. It supports the following operators:

  • eq: equals

  • ne: not equals

  • gt: greater than

  • gte: greater than or equal to

  • lt: less than

  • lte: less than or equal to

    The format is as follows: bindingName.conditionalOperator.value.


    • clickAction.eq.openLink - Displays the input if the clickAction is set to openLink.

    • imagesPerRow.gt.1 - Displays the input if the number of imagesPerRow is greater than 1.

  • 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.


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

    Will appear as:


Basic Inputs


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.


{  type: "text",  label: "Heading",  name: "heading",  defaultValue: "Testimonials",  placeholder: "Enter section heading",}




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.


{  type: "textarea",  label: "Customer testimonial",  name: "customerTestimonial",  defaultValue: "The shipping was fast, and the packaging was eco-friendly. I love shopping here!",  placeholder: "Share customer shopping experience..."}




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).


{  type: "switch",  label: "Enable discount",  name: "enableDiscount",  defaultValue: true,}




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.


{  type: "range",  label: "Discount percentage",  name: "discountPercentage",  defaultValue: 10,  configs: {    min: 5,    max: 50,    step: 1,    unit: "%"  }}



configs details:

minnumberThe minimum value the range input can have.
maxnumberThe maximum value the range input can have.
stepnumberThe intervals between values in the range.
unitstringA unit of measure displayed next to the value (e.g., px, %). Purely for display purposes.


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.


{  type: "select",  label: "Image aspect ratio",  name: "imageAspectRatio",  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" },    ]  },  defaultValue: "auto"}


aspect_ratio_select_0 aspect_ratio_select_1

configs details:

optionsArray<OptionType>An array containing all options. Each option must be an object.
valuestringA unique value for the option.
labelstringDisplayed text for the option.


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):

{  type: "select",  label: "Image aspect ratio",  name: "imageAspectRatio",  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" },    ]  },  defaultValue: "auto"}



Example (Display as Icon):

{  type: "toggle-group",  name: "loading",  label: "Background image loading",  configs: {    options: [      {label: "Eager", value: "eager", icon: "Lightning"},      {label: "Lazy", value: "lazy", icon: "SpinnerGap"},    ],  },  defaultValue: "eager",  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>.',}



configs details

optionsArray<OptionType>An array of OptionType objects. See below for the details of each property on an option.
valuestringA unique value for the option.
labelstringDisplayed text for the option.
iconstringDisplayed icon for the option. When an icon is set, the label will act as its tooltip.
weightstringAn optional weight for the icon, which can be one of the following values: thin | light | regular | bold | fill | duotone

💡 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.


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.


{  type: "richtext",  label: "Promotion details",  name: "promotionDetails",  defaultValue: "<p>We're excited to announce our <strong>limited-time</strong> savings event. From <em>October 15th to November 15th</em>, enjoy exclusive discounts and offers.</p>"}



🌟 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.



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.

Return: object - A WeaverseImage (type can be imported from @weaverse/hydrogen package).

WeaverseImage type definition:

type WeaverseImage = {  id: string  url: string  altText: string  width: number  height: number}


{  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,  },  /* The following `defaultValue` are acceptable as well:     defaultValue: {       url: "https://cdn.shopify.com/s/files/1/0669/0262/2504/files/linkedin-sales-solutions-pAtA8xe_iVM-unsplash.jpg?v=1697429747",     },     defaultValue: "https://cdn.shopify.com/s/files/1/0669/0262/2504/files/linkedin-sales-solutions-pAtA8xe_iVM-unsplash.jpg?v=1697429747",   */}

📌 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




We highly recommend developers to utilize 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:

import { Image } from '@shopify/hydrogen'import type { HydrogenComponentProps, WeaverseImage } from '@weaverse/hydrogen'import { forwardRef } from 'react'
interface ImageGalleryItemProps extends HydrogenComponentProps {  source: WeaverseImage}
let ImageGalleryItem = forwardRef<HTMLImageElement, ImageGalleryItemProps>(  (props, ref) => {    let { source, ...rest } = props    /*      Pass the object returned from the `image` input (name it as you like, e.g., `source`)      directly to the `data` prop of the `Image` component.      This will automatically generate all the necessary attributes for the image element.    */    return (      <Image        ref={ref}        {...rest}        data={source}        sizes={`(min-width: 45em) 50vw, 100vw`}      />    )  },)
export default ImageGalleryItem


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:

{  type: "color",  label: "Background color",  name: "backgroundColor",  defaultValue: "#FFFFFF",}




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.


{  type: "datepicker",  label: "Start date",  name: "startDate",  defaultValue: "2024-01-01"}



💡 Parsing: The returned timestamp should be transformed into a readable date-time string, for example:

// Get the `timestamp` from Weaverse Component propslet timestamp = 1704067200000let date = new Date(timestamp)
// Parsing examples:console.log(date.toISOString().split('T')[0]) // => "2024-01-01"console.log(  date.toLocaleDateString('en-US', {    month: 'long',    day: 'numeric',    year: 'numeric',  }),) // => "January 1, 2024"


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.


{  type: "map-autocomplete",  name: "address",  label: "Business address",  defaultValue: "San Francisco, CA"}




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 available choices.

The position can be one of the following values: top left | top center | top right | center left | center center | center right | bottom left | bottom center | bottom right


{  type: "position",  name: "contentPosition",  label: "Content position",  defaultValue: "center center"}



Resource Picker Inputs


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.


{  type: "url",  label: "Button link",  name: "buttonLink",  defaultValue: "/products"}




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).

WeaverseProduct type definition:

type WeaverseProduct = {  id: number  handle: string}


{  type: "product",  name: "product",  label: "Featured product",}




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.


{  label: "Select products",  name: "products",  type: "product-list",}




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).


{  type: "collection",  name: "collection",  label: "Collection",}




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.


{  type: "collection-list",  name: "collections",  label: "Select collections",}




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).


{  type: "blog",  name: "blog",  label: "Blog",}



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.

Was this article helpful?