Chat History — UI Customization
Change the parts and the order of the two chat panels, and choose when each part shows.
The elements from the quick start are the whole chat UI, so you change it in
the HTML. Below we move and remove parts of the panels, and then use
visible-when to show a line when the reader has no chats yet.
You need a working chat page first. See Chat History — Quick Start.
Move, add and remove elements
<miso-history> and <miso-conversation> are the two containers. Each one
connects the Miso elements inside it to its workflow, so keep each element in
its own panel:
| Container | Elements you can put in it |
|---|---|
<miso-history> | <miso-new-thread>, <miso-threads>, <miso-error> |
<miso-conversation> | <miso-title>, <miso-rename>, <miso-delete>, <miso-subscription>, <miso-messages>, <miso-query>, <miso-error> |
Inside a container, put the elements in any order, leave out the ones you do not want, and add your own HTML between them. This version puts the New chat button under the list, and removes the subscription toggle and the delete button from the header:
<miso-history class="miso-history">
<miso-threads></miso-threads>
<miso-new-thread></miso-new-thread>
</miso-history>
<miso-conversation class="miso-conversation">
<div class="miso-conversation__header" visible-when="nonempty">
<div class="miso-conversation__header-row">
<miso-title></miso-title>
<miso-rename></miso-rename>
</div>
</div>
<div class="miso-conversation__intro" visible-when="ready+empty">
What can I help with?
</div>
<miso-messages></miso-messages>
<miso-query visible-when="ready"></miso-query>
</miso-conversation>
Each thread in the list keeps its own menu to rename, subscribe or delete. The
SDK draws that menu as part of <miso-threads>, so these changes do not touch
it.
Show a part at the right moment
The visible-when attribute shows an element only in the states it names. Put
it on a <miso-history> or a <miso-conversation>, or on an element inside
one.
| Value | Shows the element when |
|---|---|
initial | The workflow has not sent a request yet. |
loading | The request is out, and no data has arrived. |
ready | The data is arriving or has arrived. |
ongoing | The data is still arriving. |
done | All the data has arrived. |
erroneous | The request failed. |
empty | No Miso element in the container has data. |
nonempty | At least one Miso element in the container has data. |
- Separate values with spaces to show the element in any of them:
visible-when="initial loading". - Join a state to
emptyornonemptywith+to need both:visible-when="ready+empty". - Only the Miso elements that show data count toward
emptyandnonempty. The query box and the buttons do not. - The SDK shows the element with
display: block !important. To lay it out as a flex row or a grid, putvisible-whenon a wrapper around it.
The quick start uses it three times in <miso-conversation>:
| Element | visible-when | What the reader sees |
|---|---|---|
| The header | nonempty | The title and its buttons, once the open thread has messages. |
| The intro line | ready+empty | "What can I help with?", on a new thread with no messages. |
<miso-query> | ready | The question box, hidden while a thread loads. |
The header puts visible-when on miso-conversation__header, and lays out the
row on miso-conversation__header-row inside it. visible-when sets
display: block, so the flex row needs a wrapper of its own.
The thread list shows nothing when the reader has no chats. Add a line for that case:
<miso-history class="miso-history">
<miso-new-thread></miso-new-thread>
<p visible-when="ready+empty">Your chats show here.</p>
<miso-threads></miso-threads>
</miso-history>
If it does not work
| Symptom | Cause |
|---|---|
The console shows … needs to be placed under a workflow container element | A Miso element is outside both containers. |
An element with visible-when always shows | The attribute name is wrong, or the element is outside both containers. The name is visible-when. |
| A flex row breaks into lines when it shows | visible-when sets display: block. Put it on a wrapper. |
Next
- API Configuration — how many threads load at a time, and which articles the answers can cite.
- Citation Links — the class, the attributes and the tooltip of each citation.
