[Blazor] Components.AI — UI shells, theming, and CSS#66184
Draft
javiercn wants to merge 1 commit intojaviercn/ai-components-blazor-componentsfrom
Draft
[Blazor] Components.AI — UI shells, theming, and CSS#66184javiercn wants to merge 1 commit intojaviercn/ai-components-blazor-componentsfrom
javiercn wants to merge 1 commit intojaviercn/ai-components-blazor-componentsfrom
Conversation
Add high-level layout components and stylesheet: - ChatPage, ChatBubble, and ChatDrawer layout shells - SuggestionList for suggested prompts - BubblePosition and DrawerPosition configuration enums - ai-chat.css vanilla stylesheet with CSS custom properties - Default renderers for FunctionInvocationContentBlock and FunctionApprovalBlock - SSR approval block rendering tests - Shell component unit tests
e9ee969 to
3629162
Compare
c649146 to
08e98cf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the overall Components.AI design: #66178
Builds on #66183
Default UI Shells, Theming, and CSS
Summary
Provide ready-to-use chat layouts (
ChatPage,ChatBubble,ChatDrawer) and a CSS design token system so applications can drop in a full chat UI with a single component and customize its appearance entirely through CSS custom properties. Also addsSuggestionListfor quick-reply chip buttons.Motivation
The core components (
AgentBoundary,MessageList,MessageInput) are composable but require manual assembly. Most applications want one of three standard chat layouts:Each layout composes the same core components but with different HTML structure, positioning, and interaction patterns.
Goals
ChatPage,ChatBubble, andChatDrawershell components that compose core components into ready-to-use layouts.SuggestionListfor quick-reply chip buttons..sc-ai-root.sc-ai-to avoid collisions.Non-goals
Detailed design
Shell composition
All three shells compose the same core components:
@bind-Open.SuggestionList
Quick-reply chips shown when the conversation is idle. Each
Suggestionhas aLabel,Prompt, and optionalIcon. Chips are disabled duringStreamingstatus. On click, sendssuggestion.Promptas a message.CSS design token system
All visual properties driven by CSS custom properties on
.sc-ai-root:--sc-ai-font-family,--sc-ai-font-size--sc-ai-color-bg,--sc-ai-color-text,--sc-ai-color-accent,--sc-ai-color-error--sc-ai-spacing-xs/sm/md/lg--sc-ai-radius-sm/md/lg--sc-ai-shadow-sm/md/lg--sc-ai-transition-speedSSR dual-mode approval buttons
Approval buttons render both
<button type="submit">(SSR) andonclickhandlers (interactive). In SSR,onclickis a no-op. In interactive mode,onclickfires first.Risks
sc-ai-namespace prefix.Drawbacks
Test coverage
242 tests (cumulative) covering:
ChatBubbleopen/close toggle, panel rendering, trigger icon switching.ChatDraweropen/close binding, position classes, header actions.ChatPageheader rendering, welcome content, input configuration passthrough.SuggestionListchip rendering, click-to-send, disable during streaming.