Welcome to the Alfresco Builder Network

Displays a input text that shows find-as-you-type suggestions.

adf-search-control

Basic usage

<adf-search-control 
    [highlight]="true"
    (optionClicked)="onItemClicked($event)"
    (submit)="onSearchSubmit($event)">
</adf-search-control>

Transclusions

You can show your own custom template when no results are found for the search:

<adf-search-control [highlight]="true"
                    (optionClicked)="onItemClicked($event)"
                    (submit)="onSearchSubmit($event)">
    <adf-empty-search-result>
        <!-- YOUR CUSTOM TEMPLATE HERE -->
        <span>YOUR CUSTOM MESSAGE</span>
    </adf-empty-search-result>
</adf-search-control>

Class members

Properties

NameTypeDefault valueDescription
autocompletebooleanfalseToggles auto-completion of the search input field.
expandablebooleantrueToggles whether to use an expanding search control. If false then a regular input is used.
highlightbooleanfalseToggles highlighting of the search term in the results.
inputTypestring"text"Type of the input field to render, e.g. "search" or "text" (default).
liveSearchEnabledbooleantrueToggles "find-as-you-type" suggestions for possible matches.
liveSearchMaxResultsnumber5Maximum number of results to show in the live search.

Events

NameTypeDescription
optionClickedEventEmitter<any>Emitted when a file item from the list of "find-as-you-type" results is selected.
searchChangeEventEmitter<string>Emitted when the search term is changed. The search term is provided in the 'value' property of the returned object. If the term is less than three characters in length then it is truncated to an empty string.
submitEventEmitter<any>Emitted when the search is submitted by pressing the ENTER key. The search term is provided as the value of the event.

Details

Below is an example of a component that uses the search control. In this example the search term is simply logged to the console. However, the component could instead emit an event to be consumed upstream,or it could trigger a change inside a search results component embedded inside the same component.

<adf-search-control 
    [highlight]="true"
    (optionClicked)="onItemClicked($event)"
    (submit)="onSearchSubmit($event)">
</adf-search-control>

Interested in trying Alfresco?

Try Now