For the complete documentation index, see llms.txt. This page is also available as Markdown.

Search Feedback

Collect user ratings for search quality.

Documentation

Give feedback to the search quality

Use ff-search-feedback to let customers rate their search experience. The element provides two slots.

caption

Use caption for the element label. The complete slot is clickable. Selecting it slides out the caption and slides in the content slot.

content

Use content for the rating controls. It must include two HTML elements for positive and negative ratings. Any HTML element works when it has data-positive or data-negative. The component listens for clicks on these elements and updates its state.

The default rating is positive. It remains positive when the user does not select an option.

To collect feedback text, add data-message to an HTML element with a value property. Add data-send to an element that sends the feedback when selected.

<ff-search-feedback align="right" unresolved reset-on-toggle reset-on-send>
    <div slot="caption">
        <span>Feedback</span>
    </div>
    <div slot="content">
        <p>Did you find what you were looking for?</p>
        <fieldset>
            <input type="radio" id="pos" name="positive" value="positive" checked data-positive>
            <label for="pos"> Yes</label><br>
            <input type="radio" id="neg" name="positive" value="negative" data-negative>
            <label for="neg"> No</label><br>
            <textarea rows="4" cols="15" maxlength="150" data-message></textarea>
        </fieldset>
        <button data-send>Rate</button>
        <button data-toggle>Cancel</button>
    </div>
</ff-search-feedback>

Add data-toggle to any HTML element that should toggle the opened property of ff-search-feedback.

Demo

API code

Properties

Properties
Name
Description

opened (Boolean) (default: false)

Controls which slot is visible: caption when false, or content when true.

align (String) Options: "left", "right" (default: "left")

The absolute alignment of the element.

positive (String) (default: "true")

Holds the rating state: "true" for positive and "false" for negative.

reset-on-toggle (Boolean) (default: false)

Resets positive and clears data-message when a toggle hides the element.

reset-on-send (Boolean) (default: false)

Resets positive and clears data-message after a successful request.

dont-show-on-result-changed (Boolean) (default: false)

Prevents the element from showing when results change while it is hidden.

Methods

Methods
Name
Description

hide()

Hides the element and sets opened to "false".

show()

Shows the element with its former state.

reset()

Resets the rating and clears the data-message value.

Events

Events
Name
Description

open-changed

Fired when the element hides or a data-toggle element is clicked.

positive-changed

Fired when the positive property changes.

successful

Fired after a successful feedback tracking request.

failed

Fired after a failed feedback tracking request.

Directives

Directives
Name
Description

data-positive

Sets the rating to positive.

data-negative

Sets the rating to negative.

data-message

Sets the rating text from the element value.

data-send

Submits feedback.

data-toggle

Toggles the opened property.

Last updated

Was this helpful?