@abraracs/better-shopify-wc-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +325 -0
- package/docs/avatar.md +481 -0
- package/docs/badge.md +266 -0
- package/docs/banner.md +350 -0
- package/docs/box.md +618 -0
- package/docs/button.md +604 -0
- package/docs/buttongroup.md +251 -0
- package/docs/checkbox.md +346 -0
- package/docs/chip.md +261 -0
- package/docs/choicelist.md +416 -0
- package/docs/clickable.md +703 -0
- package/docs/clickablechip.md +377 -0
- package/docs/colorfield.md +416 -0
- package/docs/colorpicker.md +152 -0
- package/docs/datefield.md +706 -0
- package/docs/datepicker.md +443 -0
- package/docs/divider.md +263 -0
- package/docs/dropzone.md +331 -0
- package/docs/emailfield.md +377 -0
- package/docs/grid.md +1246 -0
- package/docs/heading.md +201 -0
- package/docs/icon.md +295 -0
- package/docs/image.md +517 -0
- package/docs/link.md +456 -0
- package/docs/menu.md +331 -0
- package/docs/modal.md +640 -0
- package/docs/moneyfield.md +385 -0
- package/docs/numberfield.md +393 -0
- package/docs/orderedlist.md +224 -0
- package/docs/page.md +319 -0
- package/docs/paragraph.md +333 -0
- package/docs/passwordfield.md +381 -0
- package/docs/popover.md +419 -0
- package/docs/querycontainer.md +121 -0
- package/docs/searchfield.md +319 -0
- package/docs/section.md +267 -0
- package/docs/select.md +449 -0
- package/docs/spinner.md +121 -0
- package/docs/stack.md +748 -0
- package/docs/switch.md +365 -0
- package/docs/table.md +805 -0
- package/docs/text.md +339 -0
- package/docs/textarea.md +328 -0
- package/docs/textfield.md +425 -0
- package/docs/thumbnail.md +245 -0
- package/docs/tooltip.md +130 -0
- package/docs/unorderedlist.md +135 -0
- package/docs/urlfield.md +314 -0
- package/package.json +43 -0
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: TextField
|
|
3
|
+
description: >-
|
|
4
|
+
Lets users enter or edit text within a single-line input. Use to collect
|
|
5
|
+
short, free-form information from users.
|
|
6
|
+
api_name: app-home
|
|
7
|
+
source_url:
|
|
8
|
+
html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/forms/textfield'
|
|
9
|
+
md: >-
|
|
10
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/forms/textfield.md
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# TextField
|
|
14
|
+
|
|
15
|
+
Lets users enter or edit text within a single-line input. Use to collect short, free-form information from users.
|
|
16
|
+
|
|
17
|
+
## TextField
|
|
18
|
+
|
|
19
|
+
A text input field that allows users to enter and edit text.
|
|
20
|
+
|
|
21
|
+
* autocomplete
|
|
22
|
+
|
|
23
|
+
"on" | "off" | TextAutocompleteField | \`section-${string} one-time-code\` | "shipping one-time-code" | "billing one-time-code" | \`section-${string} shipping one-time-code\` | \`section-${string} billing one-time-code\` | \`section-${string} language\` | \`section-${string} organization\` | \`section-${string} additional-name\` | \`section-${string} address-level1\` | \`section-${string} address-level2\` | \`section-${string} address-level3\` | \`section-${string} address-level4\` | \`section-${string} address-line1\` | \`section-${string} address-line2\` | \`section-${string} address-line3\` | \`section-${string} country-name\` | \`section-${string} country\` | \`section-${string} family-name\` | \`section-${string} given-name\` | \`section-${string} honorific-prefix\` | \`section-${string} honorific-suffix\` | \`section-${string} name\` | \`section-${string} nickname\` | \`section-${string} organization-title\` | \`section-${string} postal-code\` | \`section-${string} sex\` | \`section-${string} street-address\` | \`section-${string} transaction-currency\` | \`section-${string} username\` | \`section-${string} cc-additional-name\` | \`section-${string} cc-family-name\` | \`section-${string} cc-given-name\` | \`section-${string} cc-name\` | \`section-${string} cc-type\` | "shipping language" | "shipping organization" | "shipping additional-name" | "shipping address-level1" | "shipping address-level2" | "shipping address-level3" | "shipping address-level4" | "shipping address-line1" | "shipping address-line2" | "shipping address-line3" | "shipping country-name" | "shipping country" | "shipping family-name" | "shipping given-name" | "shipping honorific-prefix" | "shipping honorific-suffix" | "shipping name" | "shipping nickname" | "shipping organization-title" | "shipping postal-code" | "shipping sex" | "shipping street-address" | "shipping transaction-currency" | "shipping username" | "shipping cc-additional-name" | "shipping cc-family-name" | "shipping cc-given-name" | "shipping cc-name" | "shipping cc-type" | "billing language" | "billing organization" | "billing additional-name" | "billing address-level1" | "billing address-level2" | "billing address-level3" | "billing address-level4" | "billing address-line1" | "billing address-line2" | "billing address-line3" | "billing country-name" | "billing country" | "billing family-name" | "billing given-name" | "billing honorific-prefix" | "billing honorific-suffix" | "billing name" | "billing nickname" | "billing organization-title" | "billing postal-code" | "billing sex" | "billing street-address" | "billing transaction-currency" | "billing username" | "billing cc-additional-name" | "billing cc-family-name" | "billing cc-given-name" | "billing cc-name" | "billing cc-type" | \`section-${string} shipping language\` | \`section-${string} shipping organization\` | \`section-${string} shipping additional-name\` | \`section-${string} shipping address-level1\` | \`section-${string} shipping address-level2\` | \`section-${string} shipping address-level3\` | \`section-${string} shipping address-level4\` | \`section-${string} shipping address-line1\` | \`section-${string} shipping address-line2\` | \`section-${string} shipping address-line3\` | \`section-${string} shipping country-name\` | \`section-${string} shipping country\` | \`section-${string} shipping family-name\` | \`section-${string} shipping given-name\` | \`section-${string} shipping honorific-prefix\` | \`section-${string} shipping honorific-suffix\` | \`section-${string} shipping name\` | \`section-${string} shipping nickname\` | \`section-${string} shipping organization-title\` | \`section-${string} shipping postal-code\` | \`section-${string} shipping sex\` | \`section-${string} shipping street-address\` | \`section-${string} shipping transaction-currency\` | \`section-${string} shipping username\` | \`section-${string} shipping cc-additional-name\` | \`section-${string} shipping cc-family-name\` | \`section-${string} shipping cc-given-name\` | \`section-${string} shipping cc-name\` | \`section-${string} shipping cc-type\` | \`section-${string} billing language\` | \`section-${string} billing organization\` | \`section-${string} billing additional-name\` | \`section-${string} billing address-level1\` | \`section-${string} billing address-level2\` | \`section-${string} billing address-level3\` | \`section-${string} billing address-level4\` | \`section-${string} billing address-line1\` | \`section-${string} billing address-line2\` | \`section-${string} billing address-line3\` | \`section-${string} billing country-name\` | \`section-${string} billing country\` | \`section-${string} billing family-name\` | \`section-${string} billing given-name\` | \`section-${string} billing honorific-prefix\` | \`section-${string} billing honorific-suffix\` | \`section-${string} billing name\` | \`section-${string} billing nickname\` | \`section-${string} billing organization-title\` | \`section-${string} billing postal-code\` | \`section-${string} billing sex\` | \`section-${string} billing street-address\` | \`section-${string} billing transaction-currency\` | \`section-${string} billing username\` | \`section-${string} billing cc-additional-name\` | \`section-${string} billing cc-family-name\` | \`section-${string} billing cc-given-name\` | \`section-${string} billing cc-name\` | \`section-${string} billing cc-type\`
|
|
24
|
+
|
|
25
|
+
Default: 'on' for everything else
|
|
26
|
+
|
|
27
|
+
A hint as to the intended content of the field.
|
|
28
|
+
|
|
29
|
+
When set to `on` (the default), this property indicates that the field should support autofill, but you do not have any more semantic information on the intended contents.
|
|
30
|
+
|
|
31
|
+
When set to `off`, you are indicating that this field contains sensitive information, or contents that are never saved, like one-time codes.
|
|
32
|
+
|
|
33
|
+
Alternatively, you can provide value which describes the specific data you would like to be entered into this field during autofill.
|
|
34
|
+
|
|
35
|
+
* defaultValue
|
|
36
|
+
|
|
37
|
+
string
|
|
38
|
+
|
|
39
|
+
The default value for the field.
|
|
40
|
+
|
|
41
|
+
* details
|
|
42
|
+
|
|
43
|
+
string
|
|
44
|
+
|
|
45
|
+
Additional text to provide context or guidance for the field. This text is displayed along with the field and its label to offer more information or instructions to the user.
|
|
46
|
+
|
|
47
|
+
This will also be exposed to screen reader users.
|
|
48
|
+
|
|
49
|
+
* disabled
|
|
50
|
+
|
|
51
|
+
boolean
|
|
52
|
+
|
|
53
|
+
Default: false
|
|
54
|
+
|
|
55
|
+
Disables the field, disallowing any interaction.
|
|
56
|
+
|
|
57
|
+
* error
|
|
58
|
+
|
|
59
|
+
string
|
|
60
|
+
|
|
61
|
+
Indicate an error to the user. The field will be given a specific stylistic treatment to communicate problems that have to be resolved immediately.
|
|
62
|
+
|
|
63
|
+
* icon
|
|
64
|
+
|
|
65
|
+
"replace" | "search" | "split" | "link" | "edit" | "product" | "variant" | "collection" | "select" | "info" | "incomplete" | "complete" | "color" | "money" | "adjust" | "affiliate" | "airplane" | "alert-bubble" | "alert-circle" | "alert-diamond" | "alert-location" | "alert-octagon" | "alert-octagon-filled" | "alert-triangle" | "alert-triangle-filled" | "app-extension" | "apps" | "archive" | "arrow-down" | "arrow-down-circle" | "arrow-down-right" | "arrow-left" | "arrow-left-circle" | "arrow-right" | "arrow-right-circle" | "arrow-up" | "arrow-up-circle" | "arrow-up-right" | "arrows-in-horizontal" | "arrows-out-horizontal" | "asterisk" | "attachment" | "automation" | "backspace" | "bag" | "bank" | "barcode" | "battery-low" | "bill" | "blank" | "blog" | "bolt" | "bolt-filled" | "book" | "book-open" | "bug" | "bullet" | "business-entity" | "button" | "button-press" | "calculator" | "calendar" | "calendar-check" | "calendar-compare" | "calendar-list" | "calendar-time" | "camera" | "camera-flip" | "caret-down" | "caret-left" | "caret-right" | "caret-up" | "cart" | "cart-abandoned" | "cart-discount" | "cart-down" | "cart-filled" | "cart-sale" | "cart-send" | "cart-up" | "cash-dollar" | "cash-euro" | "cash-pound" | "cash-rupee" | "cash-yen" | "catalog-product" | "categories" | "channels" | "chart-cohort" | "chart-donut" | "chart-funnel" | "chart-histogram-first" | "chart-histogram-first-last" | "chart-histogram-flat" | "chart-histogram-full" | "chart-histogram-growth" | "chart-histogram-last" | "chart-histogram-second-last" | "chart-horizontal" | "chart-line" | "chart-popular" | "chart-stacked" | "chart-vertical" | "chat" | "chat-new" | "chat-referral" | "check" | "check-circle" | "check-circle-filled" | "checkbox" | "chevron-down" | "chevron-down-circle" | "chevron-left" | "chevron-left-circle" | "chevron-right" | "chevron-right-circle" | "chevron-up" | "chevron-up-circle" | "circle" | "circle-dashed" | "clipboard" | "clipboard-check" | "clipboard-checklist" | "clock" | "clock-list" | "clock-revert" | "code" | "code-add" | "collection-featured" | "collection-list" | "collection-reference" | "color-none" | "compass" | "compose" | "confetti" | "connect" | "content" | "contract" | "corner-pill" | "corner-round" | "corner-square" | "credit-card" | "credit-card-cancel" | "credit-card-percent" | "credit-card-reader" | "credit-card-reader-chip" | "credit-card-reader-tap" | "credit-card-secure" | "credit-card-tap-chip" | "crop" | "currency-convert" | "cursor" | "cursor-banner" | "cursor-option" | "data-presentation" | "data-table" | "database" | "database-add" | "database-connect" | "delete" | "delivered" | "delivery" | "desktop" | "disabled" | "disabled-filled" | "discount" | "discount-add" | "discount-automatic" | "discount-code" | "discount-remove" | "dns-settings" | "dock-floating" | "dock-side" | "domain" | "domain-landing-page" | "domain-new" | "domain-redirect" | "download" | "drag-drop" | "drag-handle" | "drawer" | "duplicate" | "email" | "email-follow-up" | "email-newsletter" | "empty" | "enabled" | "enter" | "envelope" | "envelope-soft-pack" | "eraser" | "exchange" | "exit" | "export" | "external" | "eye-check-mark" | "eye-dropper" | "eye-dropper-list" | "eye-first" | "eyeglasses" | "fav" | "favicon" | "file" | "file-list" | "filter" | "filter-active" | "flag" | "flip-horizontal" | "flip-vertical" | "flower" | "folder" | "folder-add" | "folder-down" | "folder-remove" | "folder-up" | "food" | "foreground" | "forklift" | "forms" | "games" | "gauge" | "geolocation" | "gift" | "gift-card" | "git-branch" | "git-commit" | "git-repository" | "globe" | "globe-asia" | "globe-europe" | "globe-lines" | "globe-list" | "graduation-hat" | "grid" | "hashtag" | "hashtag-decimal" | "hashtag-list" | "heart" | "hide" | "hide-filled" | "home" | "home-filled" | "icons" | "identity-card" | "image" | "image-add" | "image-alt" | "image-explore" | "image-magic" | "image-none" | "image-with-text-overlay" | "images" | "import" | "in-progress" | "incentive" | "incoming" | "info-filled" | "inheritance" | "inventory" | "inventory-edit" | "inventory-list" | "inventory-transfer" | "inventory-updated" | "iq" | "key" | "keyboard" | "keyboard-filled" | "keyboard-hide" | "keypad" | "label-printer" | "language" | "language-translate" | "layout-block" | "layout-buy-button" | "layout-buy-button-horizontal" | "layout-buy-button-vertical" | "layout-column-1" | "layout-columns-2" | "layout-columns-3" | "layout-footer" | "layout-header" | "layout-logo-block" | "layout-popup" | "layout-rows-2" | "layout-section" | "layout-sidebar-left" | "layout-sidebar-right" | "lightbulb" | "link-list" | "list-bulleted" | "list-bulleted-filled" | "list-numbered" | "live" | "live-critical" | "live-none" | "location" | "location-none" | "lock" | "map" | "markets" | "markets-euro" | "markets-rupee" | "markets-yen" | "maximize" | "measurement-size" | "measurement-size-list" | "measurement-volume" | "measurement-volume-list" | "measurement-weight" | "measurement-weight-list" | "media-receiver" | "megaphone" | "mention" | "menu" | "menu-filled" | "menu-horizontal" | "menu-vertical" | "merge" | "metafields" | "metaobject" | "metaobject-list" | "metaobject-reference" | "microphone" | "microphone-muted" | "minimize" | "minus" | "minus-circle" | "mobile" | "money-none" | "money-split" | "moon" | "nature" | "note" | "note-add" | "notification" | "number-one" | "order" | "order-batches" | "order-draft" | "order-filled" | "order-first" | "order-fulfilled" | "order-repeat" | "order-unfulfilled" | "orders-status" | "organization" | "outdent" | "outgoing" | "package" | "package-cancel" | "package-fulfilled" | "package-on-hold" | "package-reassign" | "package-returned" | "page" | "page-add" | "page-attachment" | "page-clock" | "page-down" | "page-heart" | "page-list" | "page-reference" | "page-remove" | "page-report" | "page-up" | "pagination-end" | "pagination-start" | "paint-brush-flat" | "paint-brush-round" | "paper-check" | "partially-complete" | "passkey" | "paste" | "pause-circle" | "payment" | "payment-capture" | "payout" | "payout-dollar" | "payout-euro" | "payout-pound" | "payout-rupee" | "payout-yen" | "person" | "person-add" | "person-exit" | "person-filled" | "person-list" | "person-lock" | "person-remove" | "person-segment" | "personalized-text" | "phablet" | "phone" | "phone-down" | "phone-down-filled" | "phone-in" | "phone-out" | "pin" | "pin-remove" | "plan" | "play" | "play-circle" | "plus" | "plus-circle" | "plus-circle-down" | "plus-circle-filled" | "plus-circle-up" | "point-of-sale" | "point-of-sale-register" | "price-list" | "print" | "product-add" | "product-cost" | "product-filled" | "product-list" | "product-reference" | "product-remove" | "product-return" | "product-unavailable" | "profile" | "profile-filled" | "question-circle" | "question-circle-filled" | "radio-control" | "receipt" | "receipt-dollar" | "receipt-euro" | "receipt-folded" | "receipt-paid" | "receipt-pound" | "receipt-refund" | "receipt-rupee" | "receipt-yen" | "receivables" | "redo" | "referral-code" | "refresh" | "remove-background" | "reorder" | "replay" | "reset" | "return" | "reward" | "rocket" | "rotate-left" | "rotate-right" | "sandbox" | "save" | "savings" | "scan-qr-code" | "search-add" | "search-list" | "search-recent" | "search-resource" | "send" | "settings" | "share" | "shield-check-mark" | "shield-none" | "shield-pending" | "shield-person" | "shipping-label" | "shipping-label-cancel" | "shopcodes" | "slideshow" | "smiley-happy" | "smiley-joy" | "smiley-neutral" | "smiley-sad" | "social-ad" | "social-post" | "sort" | "sort-ascending" | "sort-descending" | "sound" | "sports" | "star" | "star-circle" | "star-filled" | "star-half" | "star-list" | "status" | "status-active" | "stop-circle" | "store" | "store-import" | "store-managed" | "store-online" | "sun" | "table" | "table-masonry" | "tablet" | "target" | "tax" | "team" | "text" | "text-align-center" | "text-align-left" | "text-align-right" | "text-block" | "text-bold" | "text-color" | "text-font" | "text-font-list" | "text-grammar" | "text-in-columns" | "text-in-rows" | "text-indent" | "text-indent-remove" | "text-italic" | "text-quote" | "text-title" | "text-underline" | "text-with-image" | "theme" | "theme-edit" | "theme-store" | "theme-template" | "three-d-environment" | "thumbs-down" | "thumbs-up" | "tip-jar" | "toggle-off" | "toggle-on" | "transaction" | "transaction-fee-add" | "transaction-fee-dollar" | "transaction-fee-euro" | "transaction-fee-pound" | "transaction-fee-rupee" | "transaction-fee-yen" | "transfer" | "transfer-in" | "transfer-internal" | "transfer-out" | "truck" | "undo" | "unknown-device" | "unlock" | "upload" | "variant-list" | "video" | "video-list" | "view" | "viewport-narrow" | "viewport-short" | "viewport-tall" | "viewport-wide" | "wallet" | "wand" | "watch" | "wifi" | "work" | "work-list" | "wrench" | "x" | "x-circle" | "x-circle-filled" | AnyString
|
|
66
|
+
|
|
67
|
+
Default: ''
|
|
68
|
+
|
|
69
|
+
The type of icon to be displayed in the field.
|
|
70
|
+
|
|
71
|
+
* id
|
|
72
|
+
|
|
73
|
+
string
|
|
74
|
+
|
|
75
|
+
A unique identifier for the element.
|
|
76
|
+
|
|
77
|
+
* label
|
|
78
|
+
|
|
79
|
+
string
|
|
80
|
+
|
|
81
|
+
Content to use as the field label.
|
|
82
|
+
|
|
83
|
+
* labelAccessibilityVisibility
|
|
84
|
+
|
|
85
|
+
"visible" | "exclusive"
|
|
86
|
+
|
|
87
|
+
Default: 'visible'
|
|
88
|
+
|
|
89
|
+
Changes the visibility of the component's label.
|
|
90
|
+
|
|
91
|
+
* `visible`: the label is visible to all users.
|
|
92
|
+
* `exclusive`: the label is visually hidden but remains in the accessibility tree.
|
|
93
|
+
|
|
94
|
+
* maxLength
|
|
95
|
+
|
|
96
|
+
number
|
|
97
|
+
|
|
98
|
+
Default: Infinity
|
|
99
|
+
|
|
100
|
+
Specifies the maximum number of characters allowed.
|
|
101
|
+
|
|
102
|
+
* minLength
|
|
103
|
+
|
|
104
|
+
number
|
|
105
|
+
|
|
106
|
+
Default: 0
|
|
107
|
+
|
|
108
|
+
Specifies the min number of characters allowed.
|
|
109
|
+
|
|
110
|
+
* name
|
|
111
|
+
|
|
112
|
+
string
|
|
113
|
+
|
|
114
|
+
An identifier for the field that is unique within the nearest containing form.
|
|
115
|
+
|
|
116
|
+
* placeholder
|
|
117
|
+
|
|
118
|
+
string
|
|
119
|
+
|
|
120
|
+
A short hint that describes the expected value of the field.
|
|
121
|
+
|
|
122
|
+
* prefix
|
|
123
|
+
|
|
124
|
+
string
|
|
125
|
+
|
|
126
|
+
Default: ''
|
|
127
|
+
|
|
128
|
+
A value to be displayed immediately before the editable portion of the field.
|
|
129
|
+
|
|
130
|
+
This is useful for displaying an implied part of the value, such as "https://" or "+353".
|
|
131
|
+
|
|
132
|
+
This cannot be edited by the user, and it isn't included in the value of the field.
|
|
133
|
+
|
|
134
|
+
It may not be displayed until the user has interacted with the input. For example, an inline label may take the place of the prefix until the user focuses the input.
|
|
135
|
+
|
|
136
|
+
* readOnly
|
|
137
|
+
|
|
138
|
+
boolean
|
|
139
|
+
|
|
140
|
+
Default: false
|
|
141
|
+
|
|
142
|
+
The field cannot be edited by the user. It is focusable will be announced by screen readers.
|
|
143
|
+
|
|
144
|
+
* required
|
|
145
|
+
|
|
146
|
+
boolean
|
|
147
|
+
|
|
148
|
+
Default: false
|
|
149
|
+
|
|
150
|
+
Whether the field needs a value. This requirement adds semantic value to the field, but it will not cause an error to appear automatically. If you want to present an error when this field is empty, you can do so with the `error` property.
|
|
151
|
+
|
|
152
|
+
* suffix
|
|
153
|
+
|
|
154
|
+
string
|
|
155
|
+
|
|
156
|
+
Default: ''
|
|
157
|
+
|
|
158
|
+
A value to be displayed immediately after the editable portion of the field.
|
|
159
|
+
|
|
160
|
+
This is useful for displaying an implied part of the value, such as "@shopify.com", or "%".
|
|
161
|
+
|
|
162
|
+
This cannot be edited by the user, and it isn't included in the value of the field.
|
|
163
|
+
|
|
164
|
+
It may not be displayed until the user has interacted with the input. For example, an inline label may take the place of the suffix until the user focuses the input.
|
|
165
|
+
|
|
166
|
+
* value
|
|
167
|
+
|
|
168
|
+
string
|
|
169
|
+
|
|
170
|
+
The current value for the field. If omitted, the field will be empty.
|
|
171
|
+
|
|
172
|
+
### TextAutocompleteField
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
'language' | 'organization' | 'additional-name' | 'address-level1' | 'address-level2' | 'address-level3' | 'address-level4' | 'address-line1' | 'address-line2' | 'address-line3' | 'country-name' | 'country' | 'family-name' | 'given-name' | 'honorific-prefix' | 'honorific-suffix' | 'name' | 'nickname' | 'one-time-code' | 'organization-title' | 'postal-code' | 'sex' | 'street-address' | 'transaction-currency' | 'username' | 'cc-additional-name' | 'cc-family-name' | 'cc-given-name' | 'cc-name' | 'cc-type'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### AnyString
|
|
179
|
+
|
|
180
|
+
Prevents widening string literal types in a union to \`string\`.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
string & {}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Slots
|
|
187
|
+
|
|
188
|
+
* accessory
|
|
189
|
+
|
|
190
|
+
HTMLElement
|
|
191
|
+
|
|
192
|
+
The accessory to display in the text field.
|
|
193
|
+
|
|
194
|
+
## Events
|
|
195
|
+
|
|
196
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
197
|
+
|
|
198
|
+
* blur
|
|
199
|
+
|
|
200
|
+
CallbackEventListener<'input'>
|
|
201
|
+
|
|
202
|
+
* change
|
|
203
|
+
|
|
204
|
+
CallbackEventListener<'input'>
|
|
205
|
+
|
|
206
|
+
* focus
|
|
207
|
+
|
|
208
|
+
CallbackEventListener<'input'>
|
|
209
|
+
|
|
210
|
+
* input
|
|
211
|
+
|
|
212
|
+
CallbackEventListener<'input'>
|
|
213
|
+
|
|
214
|
+
### CallbackEventListener
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
(EventListener & {
|
|
218
|
+
(event: CallbackEvent<T>): void;
|
|
219
|
+
}) | null
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### CallbackEvent
|
|
223
|
+
|
|
224
|
+
```ts
|
|
225
|
+
Event & {
|
|
226
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Examples
|
|
231
|
+
|
|
232
|
+
### Examples
|
|
233
|
+
|
|
234
|
+
* #### Code
|
|
235
|
+
|
|
236
|
+
##### jsx
|
|
237
|
+
|
|
238
|
+
```jsx
|
|
239
|
+
<s-text-field
|
|
240
|
+
label="Store name"
|
|
241
|
+
value="Jaded Pixel"
|
|
242
|
+
placeholder="Become a merchant"
|
|
243
|
+
/>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
##### html
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<s-text-field
|
|
250
|
+
label="Store name"
|
|
251
|
+
value="Jaded Pixel"
|
|
252
|
+
placeholder="Become a merchant"
|
|
253
|
+
></s-text-field>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
* #### Basic usage
|
|
257
|
+
|
|
258
|
+
##### Description
|
|
259
|
+
|
|
260
|
+
Demonstrates a simple text input field for entering a store name with autocomplete turned off, providing a clean and straightforward input experience.
|
|
261
|
+
|
|
262
|
+
##### jsx
|
|
263
|
+
|
|
264
|
+
```jsx
|
|
265
|
+
<s-text-field label="Store name" autocomplete="off" />
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
##### html
|
|
269
|
+
|
|
270
|
+
```html
|
|
271
|
+
<s-text-field label="Store name" autocomplete="off"></s-text-field>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
* #### With icon
|
|
275
|
+
|
|
276
|
+
##### Description
|
|
277
|
+
|
|
278
|
+
Showcases a text field enhanced with a search icon and a placeholder, creating a visually intuitive input for searching products.
|
|
279
|
+
|
|
280
|
+
##### jsx
|
|
281
|
+
|
|
282
|
+
```jsx
|
|
283
|
+
<s-text-field
|
|
284
|
+
label="Search"
|
|
285
|
+
icon="search"
|
|
286
|
+
placeholder="Search products..."
|
|
287
|
+
/>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
##### html
|
|
291
|
+
|
|
292
|
+
```html
|
|
293
|
+
<s-text-field
|
|
294
|
+
label="Search"
|
|
295
|
+
icon="search"
|
|
296
|
+
placeholder="Search products..."
|
|
297
|
+
></s-text-field>
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
* #### Specific error messages for merchant context
|
|
301
|
+
|
|
302
|
+
##### Description
|
|
303
|
+
|
|
304
|
+
Demonstrates the importance of providing clear, actionable, and context-specific error messages that guide merchants toward correct input and understanding.
|
|
305
|
+
|
|
306
|
+
##### jsx
|
|
307
|
+
|
|
308
|
+
```jsx
|
|
309
|
+
<s-stack gap="base">
|
|
310
|
+
{/* Generic error (avoid) */}
|
|
311
|
+
<s-text-field label="Product weight" error="Invalid value" />
|
|
312
|
+
|
|
313
|
+
{/* Specific error (preferred) */}
|
|
314
|
+
<s-text-field
|
|
315
|
+
label="Product weight"
|
|
316
|
+
error="Weight must be greater than 0 and less than 500 pounds for shipping calculations"
|
|
317
|
+
/>
|
|
318
|
+
|
|
319
|
+
{/* Business rule error */}
|
|
320
|
+
<s-text-field
|
|
321
|
+
label="SKU"
|
|
322
|
+
error="SKU 'TSHIRT-001' already exists. SKUs must be unique across all products."
|
|
323
|
+
/>
|
|
324
|
+
</s-stack>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
##### html
|
|
328
|
+
|
|
329
|
+
```html
|
|
330
|
+
<s-stack gap="base">
|
|
331
|
+
<!-- Generic error (avoid) -->
|
|
332
|
+
<s-text-field label="Product weight" error="Invalid value"></s-text-field>
|
|
333
|
+
|
|
334
|
+
<!-- Specific error (preferred) -->
|
|
335
|
+
<s-text-field
|
|
336
|
+
label="Product weight"
|
|
337
|
+
error="Weight must be greater than 0 and less than 500 pounds for shipping calculations"
|
|
338
|
+
></s-text-field>
|
|
339
|
+
|
|
340
|
+
<!-- Business rule error -->
|
|
341
|
+
<s-text-field
|
|
342
|
+
label="SKU"
|
|
343
|
+
error="SKU 'TSHIRT-001' already exists. SKUs must be unique across all products."
|
|
344
|
+
></s-text-field>
|
|
345
|
+
</s-stack>
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
* #### Required field with validation
|
|
349
|
+
|
|
350
|
+
##### Description
|
|
351
|
+
|
|
352
|
+
Illustrates a text field marked as required, ensuring that users must provide input before form submission, with built-in validation support.
|
|
353
|
+
|
|
354
|
+
##### jsx
|
|
355
|
+
|
|
356
|
+
```jsx
|
|
357
|
+
<s-text-field label="Store name" required />
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
##### html
|
|
361
|
+
|
|
362
|
+
```html
|
|
363
|
+
<s-text-field label="Store name" required></s-text-field>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
* #### With prefix and suffix
|
|
367
|
+
|
|
368
|
+
##### Description
|
|
369
|
+
|
|
370
|
+
Displays text field usage with prefix and suffix
|
|
371
|
+
|
|
372
|
+
##### jsx
|
|
373
|
+
|
|
374
|
+
```jsx
|
|
375
|
+
<s-stack gap="small">
|
|
376
|
+
<s-text-field
|
|
377
|
+
label="Phone number"
|
|
378
|
+
prefix="+03"
|
|
379
|
+
/>
|
|
380
|
+
<s-text-field
|
|
381
|
+
label="Credit Card Number"
|
|
382
|
+
value="1234 5678 9012 3456"
|
|
383
|
+
suffix="VISA"
|
|
384
|
+
/>
|
|
385
|
+
</s-stack>
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
##### html
|
|
389
|
+
|
|
390
|
+
```html
|
|
391
|
+
<s-stack gap="small">
|
|
392
|
+
<s-text-field label="Phone number" prefix="+03" />
|
|
393
|
+
<s-text-field
|
|
394
|
+
label="Credit Card Number"
|
|
395
|
+
value="1234 5678 9012 3456"
|
|
396
|
+
suffix="VISA"
|
|
397
|
+
/>
|
|
398
|
+
</s-stack>
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
* #### With accessory
|
|
402
|
+
|
|
403
|
+
##### Description
|
|
404
|
+
|
|
405
|
+
Demonstrates the flexibility of adding interactive elements like buttons to text fields, enabling immediate actions based on the entered input.
|
|
406
|
+
|
|
407
|
+
##### jsx
|
|
408
|
+
|
|
409
|
+
```jsx
|
|
410
|
+
<>
|
|
411
|
+
<s-tooltip id="info-tooltip">This is info tooltip</s-tooltip>
|
|
412
|
+
<s-text-field label="Discount code">
|
|
413
|
+
<s-icon slot="accessory" interestFor="info-tooltip" type="info" />
|
|
414
|
+
</s-text-field>
|
|
415
|
+
</>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
##### html
|
|
419
|
+
|
|
420
|
+
```html
|
|
421
|
+
<s-tooltip id="info-tooltip">This is info tooltip</s-tooltip>
|
|
422
|
+
<s-text-field label="Discount code">
|
|
423
|
+
<s-icon slot="accessory" interestFor="info-tooltip" type="info" />
|
|
424
|
+
</s-text-field>
|
|
425
|
+
```
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Thumbnail
|
|
3
|
+
description: 'Display a small preview image representing content, products, or media.'
|
|
4
|
+
api_name: app-home
|
|
5
|
+
source_url:
|
|
6
|
+
html: 'https://shopify.dev/docs/api/app-home/polaris-web-components/media/thumbnail'
|
|
7
|
+
md: >-
|
|
8
|
+
https://shopify.dev/docs/api/app-home/polaris-web-components/media/thumbnail.md
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Thumbnail
|
|
12
|
+
|
|
13
|
+
Display a small preview image representing content, products, or media.
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
* alt
|
|
18
|
+
|
|
19
|
+
string
|
|
20
|
+
|
|
21
|
+
Default: \`''\`
|
|
22
|
+
|
|
23
|
+
An alternative text description that describe the image for the reader to understand what it is about. It is extremely useful for both users using assistive technology and sighted users. A well written description provides people with visual impairments the ability to participate in consuming non-text content. When a screen readers encounters an `s-image`, the description is read and announced aloud. If an image fails to load, potentially due to a poor connection, the `alt` is displayed on screen instead. This has the benefit of letting a sighted buyer know an image was meant to load here, but as an alternative, they’re still able to consume the text content. Read [considerations when writing alternative text](https://www.shopify.com/ca/blog/image-alt-text#4) to learn more.
|
|
24
|
+
|
|
25
|
+
* size
|
|
26
|
+
|
|
27
|
+
"small" | "small-200" | "small-100" | "base" | "large" | "large-100"
|
|
28
|
+
|
|
29
|
+
Default: 'base'
|
|
30
|
+
|
|
31
|
+
Adjusts the size the product thumbnail image.
|
|
32
|
+
|
|
33
|
+
* src
|
|
34
|
+
|
|
35
|
+
string
|
|
36
|
+
|
|
37
|
+
The image source (either a remote URL or a local file resource).
|
|
38
|
+
|
|
39
|
+
When the image is loading or no `src` is provided, a placeholder will be rendered.
|
|
40
|
+
|
|
41
|
+
## Events
|
|
42
|
+
|
|
43
|
+
Learn more about [registering events](https://shopify.dev/docs/api/app-home/using-polaris-components#event-handling).
|
|
44
|
+
|
|
45
|
+
* error
|
|
46
|
+
|
|
47
|
+
OnErrorEventHandler
|
|
48
|
+
|
|
49
|
+
* load
|
|
50
|
+
|
|
51
|
+
CallbackEventListener\<typeof tagName> | null
|
|
52
|
+
|
|
53
|
+
### CallbackEventListener
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
(EventListener & {
|
|
57
|
+
(event: CallbackEvent<T>): void;
|
|
58
|
+
}) | null
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### CallbackEvent
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
Event & {
|
|
65
|
+
currentTarget: HTMLElementTagNameMap[T];
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Examples
|
|
70
|
+
|
|
71
|
+
### Examples
|
|
72
|
+
|
|
73
|
+
* #### Code
|
|
74
|
+
|
|
75
|
+
##### jsx
|
|
76
|
+
|
|
77
|
+
```jsx
|
|
78
|
+
<s-thumbnail
|
|
79
|
+
alt="White sneakers"
|
|
80
|
+
src="https://cdn.shopify.com/static/images/polaris/thumbnail-wc_src.jpg"
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
##### html
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<s-thumbnail
|
|
88
|
+
alt="White sneakers"
|
|
89
|
+
src="https://cdn.shopify.com/static/images/polaris/thumbnail-wc_src.jpg"
|
|
90
|
+
></s-thumbnail>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
* #### Basic usage
|
|
94
|
+
|
|
95
|
+
##### Description
|
|
96
|
+
|
|
97
|
+
Demonstrates a basic thumbnail component with a product image, showing the default base size and an alt text for accessibility.
|
|
98
|
+
|
|
99
|
+
##### jsx
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
<s-thumbnail
|
|
103
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
104
|
+
alt="Product preview"
|
|
105
|
+
size="base"
|
|
106
|
+
/>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
##### html
|
|
110
|
+
|
|
111
|
+
```html
|
|
112
|
+
<s-thumbnail
|
|
113
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
114
|
+
alt="Product preview"
|
|
115
|
+
size="base"
|
|
116
|
+
></s-thumbnail>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
* #### Empty state
|
|
120
|
+
|
|
121
|
+
##### Description
|
|
122
|
+
|
|
123
|
+
Shows the thumbnail component in an empty state, displaying a placeholder icon when no image source is provided.
|
|
124
|
+
|
|
125
|
+
##### jsx
|
|
126
|
+
|
|
127
|
+
```jsx
|
|
128
|
+
<s-thumbnail alt="No image available" size="base" />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
##### html
|
|
132
|
+
|
|
133
|
+
```html
|
|
134
|
+
<s-thumbnail alt="No image available" size="base"></s-thumbnail>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
* #### Different sizes
|
|
138
|
+
|
|
139
|
+
##### Description
|
|
140
|
+
|
|
141
|
+
Illustrates the various size options for the thumbnail component, showcasing small-200, base, and large sizes in a stack layout.
|
|
142
|
+
|
|
143
|
+
##### jsx
|
|
144
|
+
|
|
145
|
+
```jsx
|
|
146
|
+
<s-stack gap="large-100">
|
|
147
|
+
<s-thumbnail
|
|
148
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
149
|
+
alt="Small thumbnail"
|
|
150
|
+
size="small-200"
|
|
151
|
+
/>
|
|
152
|
+
<s-thumbnail
|
|
153
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
154
|
+
alt="Base thumbnail"
|
|
155
|
+
size="base"
|
|
156
|
+
/>
|
|
157
|
+
<s-thumbnail
|
|
158
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
159
|
+
alt="Large thumbnail"
|
|
160
|
+
size="large"
|
|
161
|
+
/>
|
|
162
|
+
</s-stack>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
##### html
|
|
166
|
+
|
|
167
|
+
```html
|
|
168
|
+
<s-stack gap="large-100">
|
|
169
|
+
<s-thumbnail
|
|
170
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
171
|
+
alt="Small thumbnail"
|
|
172
|
+
size="small-200"
|
|
173
|
+
></s-thumbnail>
|
|
174
|
+
<s-thumbnail
|
|
175
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
176
|
+
alt="Base thumbnail"
|
|
177
|
+
size="base"
|
|
178
|
+
></s-thumbnail>
|
|
179
|
+
<s-thumbnail
|
|
180
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
181
|
+
alt="Large thumbnail"
|
|
182
|
+
size="large"
|
|
183
|
+
></s-thumbnail>
|
|
184
|
+
</s-stack>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
* #### With event handling
|
|
188
|
+
|
|
189
|
+
##### Description
|
|
190
|
+
|
|
191
|
+
Demonstrates how event handlers like onload or onerror can be attached to the thumbnail component via JavaScript to handle image loading states.
|
|
192
|
+
|
|
193
|
+
##### jsx
|
|
194
|
+
|
|
195
|
+
```jsx
|
|
196
|
+
const [loading, setLoading] = useState(true)
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<s-stack direction="inline" gap="base" alignItems="center">
|
|
200
|
+
<s-thumbnail
|
|
201
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
202
|
+
alt="Product"
|
|
203
|
+
size="small-200"
|
|
204
|
+
onLoad={() => setLoading(false)}
|
|
205
|
+
/>
|
|
206
|
+
<s-paragraph>{loading ? 'Loading...' : 'Image loaded'}</s-paragraph>
|
|
207
|
+
</s-stack>
|
|
208
|
+
)
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
##### html
|
|
212
|
+
|
|
213
|
+
```html
|
|
214
|
+
<s-stack direction="inline" gap="base">
|
|
215
|
+
<s-thumbnail
|
|
216
|
+
src="https://cdn.shopify.com/static/sample-product/House-Plant1.png"
|
|
217
|
+
alt="Product"
|
|
218
|
+
size="small-200"
|
|
219
|
+
onLoad="setLoading(false)"
|
|
220
|
+
/>
|
|
221
|
+
<s-paragraph>Image loaded</s-paragraph>
|
|
222
|
+
</s-stack>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Useful for
|
|
226
|
+
|
|
227
|
+
* Identifying items visually in lists, tables, or cards
|
|
228
|
+
* Seeing a preview of images before uploading or publishing
|
|
229
|
+
* Distinguishing between similar items by their appearance
|
|
230
|
+
* Confirming the correct item is selected
|
|
231
|
+
|
|
232
|
+
## Best practices
|
|
233
|
+
|
|
234
|
+
* `small-200`: use in very small areas
|
|
235
|
+
* `small`: use in small areas
|
|
236
|
+
* `base`: use as the default size
|
|
237
|
+
* `large`: use when thumbnail is a focal point
|
|
238
|
+
|
|
239
|
+
## Content guidelines
|
|
240
|
+
|
|
241
|
+
Alternative text should be accurate, concise, and descriptive:
|
|
242
|
+
|
|
243
|
+
* Use "Image of", "Photo of" prefix
|
|
244
|
+
* Be primary visual content: "Image of a woman with curly brown hair smiling"
|
|
245
|
+
* Include relevant emotions: "Image of a woman laughing with her hand on her face"
|