Fulldev UI

Native Liquid number field with readable CSS and shared data-slot parts.

Installation

npx shadcn@latest add https://ui.full.dev/r/liquid/number-field.json https://ui.full.dev/r/liquid/field.json

Follow the one-time layout setup. A full components install already includes this item.

Usage

After this install, render these once in the layout head before theme overrides and other modules. The full ui hook already includes them. The command also installs the parts used in this example.

{% render 'ui-init' %}
{% render 'ui-input' %}
{% render 'ui-icon' %}
{% render 'ui-input-group' %}
{% render 'ui-button' %}
{% render 'ui-runtime' %}
{% render 'ui-number-field' %}
{% render 'ui-field' %}

The preview and its Usage tab render the same native Liquid source. Use data-slot for parts, data-variant for variants and data-size for sizes. Keep your store’s labels, translations and Shopify data in your theme.

A number field is an input group around a native <input type="number">, such as the quantity of a product or a cart line. The input keeps its own name, min, max and step, and works without JavaScript. The runtime connects the decrement and increment buttons: they step the input as its arrow keys do and fire input and change, so a cart script listens to the input only. The runtime also disables a button when a step would not change the value, at the input’s min or max, with step='any' or while the input is disabled or read-only, so set max to cap a quantity and disable the input to disable the field. It follows changed attributes and replaced markup; a script that sets the input’s value property fires input or change. The buttons take type='button', so Enter in the input still submits with the form’s own button, and tabindex='-1', as the input’s arrow keys step it. Each click steps once; holding a button does not repeat, as it does in React.

Parts

number-field, number-field-decrement, number-field-increment, with input-group-addon around the buttons and a native input.

Component source · Theming