Search JS SDK Configuration

This document outlines the available configuration options for the UNBXD Search JS SDK. Refer to the GitHub Link for implementation examples.


Examples/Recipes


Search Template Config

The search template options are configured under the products object.

OPTIONSDATATYPEDESCRIPTION
gridCountNumberNumber of columns in grid view
defaultFiltersObjectDefault filters applied to all API requests
templateFunctionFunction with parameters: product, idx for rendering each product card
productItemClassStringClass name for the product card
productTypeStringOne of SEARCH, BROWSE, or CATEGORY
attributesMapObjectField mappings for the current product card
elElementElement to place the search template

Loader Config

OPTIONSDATATYPEDESCRIPTION
templateFunctionTemplate function for loader
elElementElement to place the loader

No Results Config

OPTIONSDATATYPEDESCRIPTION
templateFunctionTemplate function for no-results section
elElementElement to place the no-results message

Facet Config

OPTIONSDATATYPEDESCRIPTION
facetsElElementElement to place facet elements
facetTemplateFunctionTemplate with args facetInfo, facets
facetItemTemplateFunctionTemplate to render individual facet filters
facetMultiSelectBooleanEnable multiple facet selection
facetClassStringCSS class name for facet item
facetActionStringInteraction type: click or change
selectedFacetClassStringCSS class for selected facet
selectedFacetsElElementElement to place selected facets
selectedFacetTemplateFunctionTemplate to customize selected facet view
rangeFacetElElementPlaceholder to render range facet
rangeTemplateFunctionTemplate function for customizing range filters
rangeWidgetConfigFunctionConfig for range sliders (minLabel, maxLabel)
multiLevelFacetSelectorStringClass name for multilevel facet items
multiLevelFacetElElementPlaceholder to render multilevel facet
facetDepthNumberNumber of category filter levels
clearFacetsSelectorStringCSS class for "Clear All" button
removeFacetsSelectorStringCSS class to remove individual facet filters
onFacetLoadFunctionCallback after a facet is selected
applyMultipleFiltersBooleanApply multiple facet filters at once
isCollapsibleBooleanEnable accordion-style facets
defaultOpenStringFacets to open by default: ALL, FIRST, NONE
isSearchableBooleanEnable search within facets

Pagination Config

OPTIONSDATATYPEDESCRIPTION
elElementPlaceholder for pagination element
typeStringOne of: FIXED_PAGINATION, INFINITE_SCROLL, or CLICK_N_SCROLL
onPaginateFunctionCallback after pagination action
actionStringPagination trigger: click or change
templateFunctionCustom template for pagination layout

Spellcheck Config

OPTIONSDATATYPEDESCRIPTION
enabledBooleanEnable spellcheck feature
elElementElement to place spellcheck suggestions
templateFunctionFunction to customize spellcheck appearance

Sort Config

OPTIONSDATATYPEDESCRIPTION
elElementPlaceholder for the sort section
optionsArrayArray of sort options
sortClassStringCSS class name for sort option items
selectedSortClassStringCSS class for the selected sort item
templateFunctionTemplate to customize sort layout (receives options object)

PageSize Config

OPTIONSDATATYPEDESCRIPTION
pageSizeNumberNumber of results per page
optionsArrayArray of available page size options
pageSizeClassStringCSS class for page size element
selectedPageSizeClassStringCSS class for selected page size
actionStringclick or change based on UI interaction
templateFunctionTemplate for customizing the page size section
elElementElement to place the page size controls

Breadcrumb Config

OPTIONSDATATYPEDESCRIPTION
enabledBooleanEnable breadcrumbs
elElementPlaceholder for breadcrumb trail
selectorClassStringCSS class for individual breadcrumb items
templateFunctionCustom template for breadcrumb layout

Product Views

OPTIONSDATATYPEDESCRIPTION
elElementElement to place view toggle
actionStringEvent to trigger view change (click or change)
viewTypeClassStringClass for the view type icons
selectedViewTypeClassStringClass for selected view type
viewTypesStringView types available: LIST, GRID

Variants Config

OPTIONSDATATYPEDESCRIPTION
enabledBooleanEnable variant support
countNumberNumber of variants per product
groupByStringField to group variants (must exist in catalogue)
attributesArrayList of required variant fields
mappingObjectMapping between product and variant fields