text custom element renders a single-line <input type="text">. Use it for merchant-defined string data.
Factory
Example
Options
Value
null while the input is empty.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
A free-form single-line text input for merchant-defined fields.
text custom element renders a single-line <input type="text">. Use it for merchant-defined string data.
overflow.text(options: CustomTextElementOptions): CustomTextElement
const message = overflow.text({
name: 'giftMessage',
label: 'Gift message (optional)',
placeholder: 'Add a personal note',
autocomplete: 'off',
});
message.on('onChange', ({ value, complete }) => console.log(value, complete));
message.mount('#gift-message');
| Key | Type | Default | Notes |
|---|---|---|---|
elementType | 'text' | required | Discriminant when configured inside Checkout. |
name | string | required | Unique per Overflow instance. |
label | string | required | Renders as <label>. |
placeholder | string | none | |
defaultValue | string | null | Seeds the input on mount. |
autocomplete | string | none | HTML autofill token. |
required | boolean | false | Empty input rejected by built-in check. |
validate | (value: string | null) => string | null | none | Overrides the built-in required check. |
disabled, readOnly, id, ariaLabel, locale | shared | see reference |
type CustomTextValue = string | null;
null while the input is empty.
overflow.checkout({
paymentMethods: ['card'],
customElements: {
giftMessage: { elementType: 'text', label: 'Gift message (optional)' },
},
});
Related topics
Token referenceCustom elements sectionCustom elementsCustom elements referenceElements overviewWas this page helpful?