<miso-favorite>

Since 1.14.2

The star that adds a chat thread to the reader's favorites, or removes it. Put it in the header of <miso-conversation> to star the open thread:

<miso-conversation class="miso-conversation">
  <div class="miso-conversation__header" visible-when="nonempty">
    <div class="miso-conversation__header-row">
      <miso-favorite></miso-favorite>
      <miso-title></miso-title>
    </div>
  </div>
  <miso-messages></miso-messages>
  <miso-query visible-when="ready"></miso-query>
</miso-conversation>

Containers

ContainerThe star ofOptions on
<miso-conversation>The open thread.client.ui.conversation
<miso-thread-item>One thread in the list.client.ui.history

You do not write <miso-thread-item> yourself. <miso-threads> puts one in each thread of the list, with a star in it. That star shows when the pointer is on the item.

To change the star, call useLayouts on the workflow of the container, under the role favorite.

Starring a thread

A click on an empty star adds the thread to the favorites, and the star fills. A second click removes it.

A list with group="favorite" or group="unfavorite" moves the thread at once. If Miso rejects the change, the thread moves back. See <miso-threads>.

The star is disabled until the thread has an ID. On a new thread, that is when Miso has saved the first question.

To star a thread from your own code, call favorite() on client.workflows.conversation for the open thread, or favorite(threadId) on client.workflows.history for any thread.

Options

The star shows no text, so its labels are for screen readers. Your options are merged over the defaults, so set only what you change.

OptionDefaultWhat it does
ariaLabel"Add to favorites"The label of the star on a thread that is not a favorite.
checkedAriaLabel"Remove from favorites"The label of the star on a favorite.
textNoneText to show next to the star on a thread that is not a favorite.
checkedTextThe value of textText to show next to the star on a favorite.
client.ui.conversation.useLayouts({
  favorite: { ariaLabel: "Pin", checkedAriaLabel: "Unpin" },
});
client.ui.history.useLayouts({
  favorite: { ariaLabel: "Pin", checkedAriaLabel: "Unpin" },
});

Style

The star is a <button> with role="switch" and data-role="favorite". On a favorite, it also has data-checked. The color of a filled star is the CSS variable --miso-favorite-checked-color:

:root {
  --miso-favorite-checked-color: #e0457b;
}

Next