OpenUI Chat
Use this opt-in library for the official OpenUI Chat positional contracts. The default createOpenUiLibrary() continues to use the existing Stack catalog. In particular, Chat uses Card(children, sources?) and Text(variant, value, subtext?, subtextVariant?, size?).
The host handles OpenUrl and conversation actions through onAction; the components do not assume a browser or a backend. Markdown renders as native Lynx elements, and raw HTML is displayed as text. The native main-thread first frame displays plain text; background hydration applies Markdown, keeping Unicode-dependent parsing out of the main-thread VM. Citations are one-based indices into Card.sources.
Import selected components
createOpenUiChatLibrary() registers the entire Chat catalog, including all of its component styles. It does not remove styles based on which components occur in a response. To keep unused components and their styles out of an application, use the individual component entry points and the catalog-free factory:
Each component imports its own CSS automatically; there is no separate component stylesheet to import. Shared implementation styles remain included where needed: BoldText uses the Text styles, and TextContent uses the Chat Markdown styles. Theme tokens remain a host-level import. Schema-only items such as Col have no renderer styles. Prefer the component subpaths over the aggregate openui/chat entry when unused modules must stay outside the dependency graph.
Server-side prompt generation and validation
For a reduced client library, use the matching headless component subpaths so the Agent generates the same vocabulary:
These entries load neither ReactLynx nor CSS. Both component and agent subpaths cover every component listed below, including the shared Button.
Supported components:
- Content:
Card,CardHeader,InlineHeader,Callout,TextContent,Text,BoldText,Button,Buttons,Image,ImageBlock,ImageText,Separator. - Collections:
ListBlock,ListItem,Steps,StepsItem,SectionBlock,SectionItem,Table,Col. - Cards:
CompositeCardBlock,CompositeCardItem. - Forms:
Form,FormControl,Input,TextArea,RadioGroup,RadioItem,CheckBoxGroup,CheckBoxItem,Slider. - Document extension:
ProductFeature(src, alt, title, subtitle, paragraphs, price, url). This is not an upstream OpenUI Chat component.
This is an explicit subset of the upstream Chat library; unknown components are reported by the parser. Composite headers support ImageText, Text and Image; bodies support Text, BoldText, ListBlock and Image, with BoldText prices and Button footers. Skipped optional positional arguments must remain null when supplying a later argument.
Sections support streaming expansion and isFoldable=false. Their contents stay mounted while folded. Named component declarations retain their identity across array changes; repeat references are also supported. Table column data can contain both scalar values and registered component nodes, and short columns leave empty cells. Grid and carousel layouts share the same CompositeCardItem contract. A card block action includes the selected item context; footer buttons dispatch their own action.
Forms use Form(name, buttons, fields) and FormControl(label, input, hint?). Input, TextArea, RadioGroup, CheckBoxGroup and Slider accept an optional reactive binding in their last position. Without one, the field name identifies its value within the enclosing form. Use stable, unique field names and named component declarations when inserting, deleting or reordering fields.
Checkbox groups sharing a binding merge their changes into the complete object; validation checks only each group's own items. Defaults initialize missing values without overwriting hydrated or edited state. Streaming disables editing and submission. Structured validation rules run before button actions, which receive the current form state.
Slider state and defaultValue use arrays even for a single value, matching Chat expressions such as @First($budget). Multiple values render as separate bounded Lynx slider controls, constrained to preserve their order. Native rendering differs from the upstream multi-thumb track; the positional and state contracts remain the same.
Additional content and multiline input
These Chat signatures preserve the upstream argument order, including optional slots:
CardHeader(title?, subtitle?): either text can be omitted.InlineHeader(heading, description?): compact Markdown heading and description.Callout(variant, title, description, visible?):variantisinfo,warning,error,successorneutral; the description supports Markdown. Whenvisibleis bound to a boolean state, the banner sets that state tofalseafter three seconds. Without a reactive binding it remains visible.Image(alt, src?): displays an image in a 3:2 frame. The alt text is the first argument, unlike the default Stack catalog'sImage(url, fit?, variant?).ImageBlock(src, alt?): shows loading and error states and preserves the loaded image's aspect ratio. It renders nothing until a source is available.Separator(orientation?, decorative?): defaults tohorizontalandtrue;verticalis also supported.TextArea(name, placeholder?, rows?, rules?, value?): multiline form input;rowsdefaults to 3 and controls visible height, not the allowed number of lines. Validation, hydration, reactive binding and streaming behavior matchInput.
Contracts are pinned to thesysdev/openui. See THIRD_PARTY_NOTICES.md for attribution.

