diff --git a/docs/docs/cloud/how-tos/generative_ui_react.md b/docs/docs/cloud/how-tos/generative_ui_react.md index 5e01b1a1b..603d8b5e6 100644 --- a/docs/docs/cloud/how-tos/generative_ui_react.md +++ b/docs/docs/cloud/how-tos/generative_ui_react.md @@ -132,6 +132,8 @@ export default function Page() { } ``` +Behind the scenes, `LoadExternalComponent` will fetch the JS and CSS for the UI components from LangGraph Platform and render them in a shadow DOM, thus ensuring style isolation from the rest of your application. + ## Configuration options ### Show loading UI when components are loading @@ -230,6 +232,21 @@ const { thread, submit } = useStream({ }); ``` +### Remove UI messages from state + +Similar to how messages can be removed from the state by appending a RemoveMessage you can remove an UI message from the state by calling `ui.delete` with the ID of the UI message. + +```typescript +// pushed message +const message = ui.push({ name: "weather", props: { city: "London" } }); + +// remove said message +ui.delete(message.id); + +// return new state to persist changes +return { ui: ui.items }; +``` + ## Learn more - [JS/TS SDK Reference](../reference/sdk/js_ts_sdk_ref.md)