MudXChat: Enhance docs and examples with CSS styling#58
Conversation
Updated `ChatDocPage.razor` to include details on targeting CSS styles for individual or all chat bubbles. Modified `ChatAvatarExample.razor` to demonstrate this by adding a new `avatar-docs-show` class and corresponding `<style>` block to customize the background color of chat text. These changes improve clarity and usability for developers.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request enhances the documentation and examples for MudXChat by adding custom CSS styling to an example. My review focuses on improving the way this styling is applied by suggesting a move from an inline <style> block to Blazor's CSS isolation feature. This change would align the example with best practices for Blazor development, improving maintainability and demonstrating a more robust styling approach to users of the library.
There was a problem hiding this comment.
Pull request overview
Updates the MudXChat documentation examples to better demonstrate avatar usage and how to scope custom CSS to a specific chat instance.
Changes:
- Added a custom
Classto the avatar chat example to scope styling. - Added an inline
<style>rule to override the default text-variant bubble background for that example. - Expanded the “With Avatar” section description to mention CSS targeting/scoping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/MudX.Docs/Components/Docs/Chat/Examples/ChatAvatarExample.razor |
Adds a scoped class to the example and an inline CSS override for the chat text background. |
src/MudX.Docs/Components/Docs/Chat/ChatDocPage.razor |
Updates docs copy in the “With Avatar” section to mention CSS targeting. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| <style> | ||
| .avatar-docs-show .mudx-chat-text { | ||
| background-color: #d4d7dc; |
There was a problem hiding this comment.
The inline CSS uses a hard-coded hex background color. Since the docs site supports dark mode, this color will likely look incorrect (and may reduce contrast) when the theme switches. Prefer using an existing MudBlazor palette CSS variable (e.g., a neutral surface/hover token) so the example stays theme-aware while still demonstrating targeted styling.
| background-color: #d4d7dc; | |
| background-color: var(--mud-palette-surface-hover); |
| @using MudX | ||
|
|
||
| <MudXChat ChatPosition="MudX.ChatBubblePosition.Start"> | ||
| <MudXChat Class="avatar-docs-show" ChatPosition="MudX.ChatBubblePosition.Start"> |
There was a problem hiding this comment.
The PR description mentions adding Class="avatar-docs-showr", but the actual class added here is avatar-docs-show. Please align the PR description (or the code) so reviewers/readers don’t get a misleading class name.
| MudXChat can include an avatar, which works seamlessly with the <CodeInline>MudAvatar</CodeInline> component. The avatar will always appear on the first <CodeInline>MudXChatBubble</CodeInline> inside a MudXChat. | ||
| You can also see how easy it is to target a css style for a single bubble, all bubbles in a chat, etc. |
There was a problem hiding this comment.
This new description text has a couple of documentation issues: “css” should be capitalized as “CSS”, and the sentences read like informal notes rather than docs. Consider rephrasing to clearly explain that Class can be used to scope custom CSS to a single chat/bubble, and remove the extra trailing space at the end of the first sentence.
| MudXChat can include an avatar, which works seamlessly with the <CodeInline>MudAvatar</CodeInline> component. The avatar will always appear on the first <CodeInline>MudXChatBubble</CodeInline> inside a MudXChat. | |
| You can also see how easy it is to target a css style for a single bubble, all bubbles in a chat, etc. | |
| MudXChat can include an avatar, which works seamlessly with the <CodeInline>MudAvatar</CodeInline> component. The avatar will always appear on the first <CodeInline>MudXChatBubble</CodeInline> inside a <CodeInline>MudXChat</CodeInline>. | |
| Use the <CodeInline>Class</CodeInline> parameter on <CodeInline>MudXChat</CodeInline> or <CodeInline>MudXChatBubble</CodeInline> to scope custom CSS to a single bubble, all bubbles in a chat, or multiple chats. |
Motivation
Description
Class="avatar-docs-showto theMudXChatinstance inChatAvatarExample.razorand updated the ChatDocPage to match.<style>block that targets.avatar-docs-show .mudx-chat-textand sets a background color of#d4d7dcfor the Text Variant to highlight the avatar example. (match the color of the avatar background.Testing
tests/MudX.UnitTests, includingChatTests, and all tests passed successfullyCloses #56
Closes #57