Skip to content

Commit c098bef

Browse files
committed
docs: Improve toasts documentation
1 parent aefe018 commit c098bef

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

docs/concepts/conversations.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ For details and usage on each of these parameters, you may consult the [**API do
151151
## Message
152152

153153
<div style={{ display: "flex", justifyContent: "center" }}>
154-
<div style={{ width: "40%" }}>
154+
<div style={{ width: "40%", max }}>
155155
![RCB Message](./img/rcb-message.png)
156156
</div>
157157
</div>
@@ -172,12 +172,24 @@ For manipulating messages, it is recommended that you utilize `injectMessage` an
172172

173173
## Toast
174174

175-
Toasts are strictly speaking not essential for chatbot conversations. However, they are oftentime useful in providing feedback to users. For example, the [**rcb-input-validator-plugin**] uses toasts to inform users of any input validation errors. A toast comprises of **3 properties**:
175+
<div style={{ display: "flex", justifyContent: "center" }}>
176+
<div style={{ width: "40%" }}>
177+
![RCB Toast](./img/rcb-toast.png)
178+
</div>
179+
</div>
180+
181+
Toasts are strictly speaking not essential for chatbot conversations. However, they are oftentime useful in providing feedback to users (as **outlined in red** on the image above). For example, the [**rcb-input-validator-plugin**](https://github.com/react-chatbotify-plugins/rcb-input-validator-plugin) uses toasts to inform users of any input validation errors. A toast comprises of **3 properties**:
176182

177183
- id (required) - an auto-generated uuidv4 `string`, uniquely identifying a toast
178184
- content (required) - a `string` or `JSX.Element`, representing the content of the toast
179185
- timeout (optional) - specifies the duration that the toast is shown for before it is automatically dismissed
180186

187+
:::info Info
188+
189+
For manipulating toasts, it is recommended that you utilize `showToast` and `dismissToast` which are provided in [**params**](/docs/api/params#showtoast) or [**hooks**](/docs/api/hooks#useToast). If you are directly manipulating the `toasts` array (not recommended), which is possible via the [`useToast`](/docs/api/hooks#usetoast) hook, you need to specify **at least the 2 required fields** yourself.
190+
191+
:::
192+
181193
## Summary
182194

183195
Does that sound like a lot to take in? Fret not! Let us take one final look at the code snippet we saw at the beginning and put things all together. Notice that the `ChatBot` takes in the `flow` that we have just gone through above. Tinker with the live editor below and try out the result for yourself!

docs/concepts/img/rcb-message.png

8.85 KB
Loading

docs/concepts/img/rcb-toast.png

153 KB
Loading

0 commit comments

Comments
 (0)