Skip to content

Input

Use Input to let shoppers enter and edit text. It supports a floating label, a leading icon, and error and success states, and it reports value changes through the onValue callback.

The SDK Input with a leading cart icon and a floating Email label.
import { Input } from '/@dropins/tools/components.js';
PropTypeReq?Description
idstringNoThe field id. Falls back to name, then to a generated id.
namestringNoThe field name, used to map the value in a form.
variant'primary' | 'secondary'NoChange the input style. Defaults to primary.
disabledbooleanNoDisable the input field.
errorbooleanNoShow the error state and warning icon.
floatingLabelstringNoLabel text that floats above the field.
onUpdateError(error: Error) => voidNoCalled when an onValue callback throws an error.
onValue(value: any) => voidNoCalled with the trimmed value when it changes (debounced).
size'medium' | 'large'NoChange the input size. Defaults to medium.
successbooleanNoShow the success state and check icon.
iconVNode<HTMLAttributes<SVGSVGElement>>NoA leading ornamental icon.
maxLengthnumberNoMaximum number of characters allowed in the field.

Input also accepts standard input HTML attributes (for example, value, placeholder, and onChange), except size and icon.

Render an input with a floating label and a value handler.

import { Input, provider } from '/@dropins/tools/components.js';
await provider.render(Input, {
name: 'email',
floatingLabel: 'Email',
onValue: (value) => yourSaveEmail(value),
})(document.querySelector('.email-input'));
  • InputPassword — a password field with a show/hide toggle built on Input.
  • InputFile — a file upload field for forms.