Fejlesztőknek
Kezdj bele
Témák/Theme SDK/Modules/search/Types

Types

Ez az oldal még csak angolul érhető el.

The types of @poltura/theme-sdk/search.

Ezen az oldalon
import { … } from '@poltura/theme-sdk/search';

SearchState

The storefront search: the query, live results, suggestions and the actions that drive them.

queryrequiredstring

What the shopper typed.

setQueryrequired(query: string) => void

Updates the query; results follow after a short pause.

debouncedQueryrequiredstring

The query results are for, after the pause.

hasQueryrequiredboolean

Whether the query is long enough to search, two characters or more.

resultsrequiredreadonly ProductCard[]

The matching products.

totalrequirednumber | null

How many products match, or null before the first answer.

isFetchingrequiredboolean

Whether results are loading.

suggestionsrequiredreadonly SearchSuggestion[]

Popular searches and matching categories.

featuredrequiredreadonly ProductCard[]

The merchant's featured products, in order.

categoriesrequiredreadonly SearchSuggestion[]

The categories whose name matches the query.

collectionsrequiredreadonly SearchSuggestion[]

The collections whose name matches the query.

pagesrequiredreadonly SearchSuggestion[]

The store's pages whose title matches the query.

recentrequiredreadonly SearchSuggestion[]

What the shopper searched for on this device, newest first.

resultsHrefrequiredstring

The full results page for the query.

submitrequired() => void

Opens the full results page for the query.

clearrequired() => void

Empties the query.

SearchSuggestion

A suggestion shown before or while the shopper types: a popular or recent search, or a matching category, collection or page.

kindrequired'query' | 'recent' | 'category' | 'collection' | 'page'

Whether it is a popular or recent search, or a category, collection or page.

labelrequiredstring

The suggestion's text in the page language.

hrefrequiredstring

Where choosing it goes.

iconIconValue | null

A category's icon, drawn with `Icon`; null or absent otherwise.

SearchOptions

Options of useSearch.

limitnumber

Most products to load as results; defaults to 6.

popularSearchesreadonly string[]

Popular searches offered before the shopper types, in order.

featuredCollectionIdstring

The collection whose products are offered as featured before the shopper types.

SearchInputProps

Props of SearchInput.

valuerequiredstring

What the field shows.

onChangerequired(value: string) => void

Called with the new text as the shopper types.

onSubmitrequired() => void

Called when the shopper presses Enter without a highlighted option.

placeholderstring

Shown while the field is empty.

classNamestring

Classes added to the field's form.

SearchResultsProps

Props of SearchResults.

staterequiredSearchState

The search whose results to list.

onNavigate() => void

Called when the shopper opens a result, such as to close a dialog.

classNamestring

Classes added to the list.

SearchSuggestionsProps

Props of SearchSuggestions.

itemsrequiredreadonly SearchSuggestion[]

Popular searches and categories to offer.

featuredrequiredreadonly ProductCard[]

Featured products to offer below them.

onPick(suggestion: SearchSuggestion) => void

Called when the shopper picks a suggestion; without it every suggestion is a link.

onNavigate() => void

Called when the shopper opens a featured product.

classNamestring

Classes added to the list.

SearchDialogProps

Props of SearchDialog.

labelrequiredstring

Names the dialog and its icon button for assistive technology.

openboolean

Whether the dialog is open; leave unset to let the button control it.

onOpenChange(open: boolean) => void

Called when the dialog opens or closes.

childrenrequiredReactNode

What the dialog holds, usually the field and the results.

classNamestring

Classes added to the dialog.

SearchGroupKind

A result group of the search dropdown, as the element type the merchant adds under a search block.

type SearchGroupKind = 'products' | 'categories' | 'collections' | 'pages' | 'popular' | 'recent' | 'view-all' | 'empty'

SearchGroup

One result group of the search dropdown, in the order the dropdown lists it.

idrequiredstring

The group's block id.

kindrequiredSearchGroupKind

What the group lists.

headingrequiredstring

The group's heading; empty shows the platform heading.

limitrequirednumber

Most items the group lists.

imagerequiredboolean

Whether product rows show their image.

pricerequiredboolean

Whether product rows show their price.

badgerequiredboolean

Whether product rows show the merchant's badge.

layoutrequired'list' | 'grid'

Rows under each other, or a grid.

columnsrequired2 | 3

The grid's columns.

textrequiredstring

The text of a view-all link or a no-results note; empty shows the platform text.

suggestionsrequiredboolean

Whether a no-results note offers the popular searches.

attrsElementAttrs

The group block's attributes, spread on the group's root.

SearchDropdown

How the search dropdown is drawn.

width'input' | 'wide' | 'full'

As wide as the field, a wide panel, or the page's full width.

schemestring

The colour scheme the dropdown draws in; unset keeps the page's.

radiusnumber

Corner radius in pixels; unset keeps the theme's corners.

shadow'none' | 'soft' | 'strong'

The dropdown's shadow; unset draws the soft overlay shadow.

phone'anchored' | 'sheet'

On phones, open under the field or as a sheet from the bottom of the screen.

SearchComboboxProps

Props of SearchCombobox.

limitnumber

Most products to load as results; defaults to 6.

popularSearchesreadonly string[]

Popular searches offered before the shopper types, in order.

featuredCollectionIdstring

The collection whose products are offered as featured before the shopper types.

placeholderstring

Shown while the field is empty.

floatingboolean

The suggestions and results float in a popover under the field; otherwise they list below it.

onNavigate() => void

Called when the shopper opens a result or a featured product, such as to close a dialog.

groupsreadonly SearchGroup[]

The dropdown's result groups in order; unset lists popular searches, products and the no-results note.

dropdownSearchDropdown

The dropdown's width, colour scheme, corners, shadow and phone presentation.

previewboolean

Holds the dropdown open with sample results, as the editor shows a selected search block.

HeaderSearchProps

Props of HeaderSearch.

limitnumber

Most products to load as results; defaults to 6.

popularSearchesreadonly string[]

Popular searches offered before the shopper types, in order.

featuredCollectionIdstring

The collection whose products are offered as featured before the shopper types.

variant'inline' | 'popover' | 'dialog'

A field with its results in a popover under it, an icon that opens a popover, or an icon that opens a dialog.

placeholderstring

Shown while the field is empty.

classNamestring

Classes added to the field or the icon button.

attrsElementAttrs

A block's attributes, spread on the search's root when it draws the block itself.

groupsreadonly SearchGroup[]

The dropdown's result groups in order; unset lists popular searches, products and the no-results note.

dropdownSearchDropdown

The dropdown's width, colour scheme, corners, shadow and phone presentation.

previewboolean

Holds the dropdown open with sample results, as the editor shows a selected search block.

Utoljára frissítve