@coveo/headless-react
    Preparing search index...

    Interface StandaloneSearchBox

    The StandaloneSearchBox controller is responsible for handling a standalone search box.

    interface StandaloneSearchBox {
        state: StandaloneSearchBoxState;
        afterRedirection(): void;
        clear(): void;
        selectSuggestion(value: string): void;
        showSuggestions(): void;
        submit(): void;
        subscribe(listener: () => void): Unsubscribe;
        updateRedirectUrl(url: string): void;
        updateText(value: string): void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Resets the standalone search box state. To be dispatched on single page applications after the redirection has been triggered.

      Returns void

    • Clears the search box text and the suggestions.

      Returns void

    • Selects a suggestion and calls submit.

      Parameters

      • value: string

        The string value of the suggestion to select

      Returns void

    • Shows the suggestions for the current search box value.

      Returns void

    • Triggers a redirection.

      Returns void

    • Adds a callback that's invoked on state change.

      Parameters

      • listener: () => void

        A callback that's invoked on state change.

      Returns Unsubscribe

      A function to remove the listener.

    • Updates the redirection url of the standalone search box.

      Parameters

      • url: string

        The new URL to redirect to.

      Returns void

    • Updates the search box text value and shows the suggestions for that value.

      Parameters

      • value: string

        The string value to update the search box with.

      Returns void

    Properties

    A scoped and simplified part of the headless state that is relevant to the StandaloneSearchBox controller.