data-llm attribute narrates the view’s current state to the model, so on the next turn it can answer about what is on screen.
Example
The carousel tells the model whether the shopper is browsing or looking at one product, so a follow-up like “is this one in stock?” resolves to the right item.views/carousel.tsx
Behavior
- Only the content currently on screen is sent. It is recomputed on every render and dropped when the element unmounts.
- The text is model-visible, but not live: the host surfaces it to the model on the next turn, not mid-interaction.
- Nested attributes form an indented outline. This:
data-llm rides the same view state as useViewState, so its lifecycle governs when and where the model sees it.
Manage State
What to narrate, and what to leave out
useViewState
Persist structured state alongside the narration
useToolInfo
Read the tool result the view mounted with