Skip to main content
Version: 1.0.0

ContentSearchFieldElement

ContentSearchFieldElement is a custom HTML element that displays a search field for finding content in a SAS Viya deployment. When a search is submitted, the element navigates the surrounding ContentGroupElement to a search location, so components such as the ContentAreaElement display the search results. This element extends HTMLElement.

Place this element inside a ContentGroupElement if you want the search results to drive the other Content SDK components on the page.

Custom Element Tag​

<sas-content-group id="cg">
<sas-content-search url="http://my-viya-server.com" placeholder="Search"></sas-content-search>
<sas-content-area url="http://my-viya-server.com"></sas-content-area>
</sas-content-group>

Attributes​

placeholder: string​

The placeholder text that is displayed in the search field when it is empty. If it is not specified, a localized default is used.

url​

See url.

authentication-type​

See authenticationType.

Properties​

onSearch: (query: string, indices?: string[]) => void​

A callback function that can be used to respond to a search being submitted. The search is always applied to the surrounding content group, whether or not this callback is supplied.

Arguments​

query: string

The text that was entered by the user.

indices?: string[]

The search indices that the query was run against. The catalog index is used by default. See searchIndices for how to change the indices that are searched.

onClearSearch: () => void​

A callback function that can be used to respond to the search field being cleared.