Skip to content

Conversation

@ysmoradi
Copy link
Member

@ysmoradi ysmoradi commented Dec 13, 2025

closes #11881

Summary by CodeRabbit

  • Documentation
    • Refined development guidance for UI component usage and theme color implementation
    • Added enhanced patterns and examples for implementing colors and styling across applications
    • Updated best practices for consistent component usage and styling

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 13, 2025

Walkthrough

The copilot-instructions.md documentation file was updated to enhance UI component guidance by adding BitGrid and BitStack recommendations, and to replace the theme-color guidance with detailed multi-step instructions for applying colors in C#, Razor, and SCSS with concrete examples.

Changes

Cohort / File(s) Summary
Copilot Instructions Documentation
src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md
Updated UI component guidance to include BitGrid and BitStack; replaced simple theme-color guidance with detailed multi-step approach covering BitColor, BitCss, SCSS variables, and concrete usage examples for C#/Razor and SCSS; reordered coding conventions items 09–13 with enhanced theme-colors documentation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

  • Verify accuracy of BitColor, BitCss, and SCSS variable usage examples
  • Confirm theme-color guidance aligns with actual Bit framework conventions

Poem

🐰 A guide so clear, now shines so bright,
With grids and stacks aligned just right,
Colors flowing through code and style,
From C# to SCSS, mile after mile,
Copilot learns to code with flair!

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: improvements to the Boilerplate copilot instructions documentation, which is the sole focus of the changeset.
Linked Issues check ✅ Passed The PR successfully addresses the linked issue #11881 by implementing improvements to the copilot instructions, though the issue lacks detailed coding requirements.
Out of Scope Changes check ✅ Passed All changes are narrowly focused on the copilot-instructions.md documentation file with no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between bd21b5c and e02611c.

📒 Files selected for processing (1)
  • src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build Bit.Templates
🔇 Additional comments (2)
src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md (2)

117-117: Strong addition to component guidance.

Expanding the component recommendations to include BitGrid and BitStack provides developers with more structured layout options and reinforces the principle of using the Bit.BlazorUI library consistently. This aligns well with the PR objective to improve copilot instructions.


124-126: Code structure guidance is clear and well-organized.

Items 09–11 provide practical direction on separating concerns (code-behind), isolating styles (scoped SCSS), and correctly styling components with the ::deep selector. These are well-established best practices for Blazor development.

Comment on lines +127 to +128
12. **Use Theme Colors in C# and Razor**: In C# and Razor files, you **MUST** use `BitColor` enum and `BitCss` class to apply theme colors instead of hardcoded colors. Use `BitColor` for component parameters (e.g., `BitColor.Primary`, `BitColor.TertiaryBackground`). Use `BitCss.Class` for CSS classes (e.g., `@BitCss.Class.Color.Background.Primary`, `@BitCss.Class.Color.Foreground.Secondary`). Use `BitCss.Var` for inline styles with CSS variables (e.g., `border-color:var(@BitCss.Var.Color.Border.Primary)`). This ensures automatic dark/light mode support.
13. **Use Theme Colors in SCSS**: In SCSS files, you **MUST** use SCSS variables from `_bit-css-variables.scss` instead of hardcoded colors. Import the file and use variables like `$bit-color-primary`, `$bit-color-foreground-primary`, `$bit-color-background-secondary`, etc. These map to CSS custom properties that automatically adapt to dark/light modes. Available variable categories include: primary, secondary, tertiary, info, success, warning, severe-warning, error, foreground, background, border, and neutral colors.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find _bit-css-variables.scss file and inspect variable definitions
fd -type f -name '*bit-css-variables*' | head -10

Repository: bitfoundation/bitplatform

Length of output: 239


🏁 Script executed:

#!/bin/bash
# Search for BitCss class/interface definitions
fd -type f \( -name '*.cs' -o -name '*.ts' -o -name '*.tsx' \) | xargs rg -l 'BitCss' | head -10

Repository: bitfoundation/bitplatform

Length of output: 951


🏁 Script executed:

#!/bin/bash
# Look for documentation or examples of BitCss usage in the repository
rg -l 'BitCss\.Class|BitCss\.Var' --type md --type cs | head -10

Repository: bitfoundation/bitplatform

Length of output: 51


🏁 Script executed:

#!/bin/bash
# Inspect BitCss.class.cs to verify nested property structure
wc -l src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs
head -100 src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs

Repository: bitfoundation/bitplatform

Length of output: 4254


🏁 Script executed:

#!/bin/bash
# Inspect BitCss.var.cs to understand variable structure
wc -l src/BlazorUI/Bit.BlazorUI/Utils/BitCss.var.cs
head -100 src/BlazorUI/Bit.BlazorUI/Utils/BitCss.var.cs

Repository: bitfoundation/bitplatform

Length of output: 4166


🏁 Script executed:

#!/bin/bash
# Find _bit-css-variables.scss file
fd -type f -name '*bit-css-variables*'

Repository: bitfoundation/bitplatform

Length of output: 239


🏁 Script executed:

#!/bin/bash
# Read more of BitCss.class.cs to see all color categories
tail -200 src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs | head -100

Repository: bitfoundation/bitplatform

Length of output: 4796


🏁 Script executed:

#!/bin/bash
# Search for _bit-css-variables.scss in style directories
find . -type f -name '*bit-css*' -o -name '*theme*' | grep -i scss | head -20

Repository: bitfoundation/bitplatform

Length of output: 580


🏁 Script executed:

#!/bin/bash
# Also search for any SCSS files that might contain color variable definitions
fd -e scss | grep -i 'color\|theme\|variable' | head -20

Repository: bitfoundation/bitplatform

Length of output: 1156


🏁 Script executed:

#!/bin/bash
# Read the SCSS variables file relevant to the boilerplate template
head -100 src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Styles/abstracts/_bit-css-variables.scss

Repository: bitfoundation/bitplatform

Length of output: 4805


🏁 Script executed:

#!/bin/bash
# Read the rest of BitCss.var.cs to see Background, Border, and other categories
sed -n '200,400p' src/BlazorUI/Bit.BlazorUI/Utils/BitCss.var.cs

Repository: bitfoundation/bitplatform

Length of output: 9209


🏁 Script executed:

#!/bin/bash
# Extract all top-level Color subcategories from BitCss.var.cs
grep 'public static class' src/BlazorUI/Bit.BlazorUI/Utils/BitCss.var.cs | grep -v '//'

Repository: bitfoundation/bitplatform

Length of output: 3292


🏁 Script executed:

#!/bin/bash
# Search for actual usage of BitCss.Var in inline styles
rg 'BitCss\.Var' -A 2 -B 2 | head -80

Repository: bitfoundation/bitplatform

Length of output: 1231


🏁 Script executed:

#!/bin/bash
# Search for actual usage of BitCss.Class in Razor files
rg 'BitCss\.Class\.Color' src/Templates/Boilerplate/ -A 1 -B 1 | head -60

Repository: bitfoundation/bitplatform

Length of output: 956


🏁 Script executed:

#!/bin/bash
# Get the full structure of BitCss.Class.Color.Background class
sed -n '/public static class Background/,/^[[:space:]]*}/p' src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs | head -80

Repository: bitfoundation/bitplatform

Length of output: 746


🏁 Script executed:

#!/bin/bash
# Search for implicit operators in BitCss files
rg 'implicit|operator|implicit operator' src/BlazorUI/Bit.BlazorUI/Utils/BitCss*.cs

Repository: bitfoundation/bitplatform

Length of output: 51


🏁 Script executed:

#!/bin/bash
# Look at more real examples from Boilerplate to understand actual usage
rg 'BitCss\.Class' src/Templates/Boilerplate/ -A 1 -B 1 | head -100

Repository: bitfoundation/bitplatform

Length of output: 956


🏁 Script executed:

#!/bin/bash
# Read the actual App.razor file to see the exact BitCss usage
cat src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/Components/App.razor

Repository: bitfoundation/bitplatform

Length of output: 4944


🏁 Script executed:

#!/bin/bash
# Also check the Accordion.razor file
cat src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/Settings/Accordion.razor | grep -A 5 -B 5 'BitCss.Class.Color'

Repository: bitfoundation/bitplatform

Length of output: 486


🏁 Script executed:

#!/bin/bash
# Check if there are operator overloads in BitCss files by looking at the full files
tail -100 src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs | head -50

Repository: bitfoundation/bitplatform

Length of output: 2634


🏁 Script executed:

#!/bin/bash
# Look for ToString or implicit operators throughout BitCss files
cat src/BlazorUI/Bit.BlazorUI/Utils/BitCss.cs

Repository: bitfoundation/bitplatform

Length of output: 134


🏁 Script executed:

#!/bin/bash
# Search for any method that might explain how Primary class becomes a string
rg -A 5 'public static class Primary|public static implicit' src/BlazorUI/Bit.BlazorUI/Utils/BitCss.class.cs | head -50

Repository: bitfoundation/bitplatform

Length of output: 1245


Verify BitCss property accessor usage in C# and Razor examples.

The theme color guidance is sound, but the C# and Razor code examples are incomplete:

  1. BitCss.Class examples (line 127): The example @BitCss.Class.Color.Background.Primary should include the property accessor for clarity: @BitCss.Class.Color.Background.Primary.Main (or .Dark, .Light, .Text depending on the variant). The BitCss.Class API includes nested color categories (Primary, Secondary, Tertiary, Info, Success, Warning, SevereWarning, Error), plus semantic groupings (Foreground, Background, Border, Neutral), each with variants like Main, Dark, Light, and Text.

  2. BitCss.Var examples (line 127): Similarly, the example border-color:var(@BitCss.Var.Color.Border.Primary) should be border-color: var(@BitCss.Var.Color.Border.Primary.Main). The BitCss.Var API mirrors the Class structure but returns CSS variable names (e.g., --bit-clr-brd-pri) for use in inline styles.

  3. SCSS variables (line 128): The variable naming pattern is confirmed correct. Variables follow the format $bit-color-{category} (e.g., $bit-color-primary, $bit-color-foreground-primary, $bit-color-background-secondary), with modifiers for state (-hover, -active, -dark, -light). The listed categories are accurate and complete.

🤖 Prompt for AI Agents
In src/Templates/Boilerplate/Bit.Boilerplate/.github/copilot-instructions.md
around lines 127 to 128, the C#/Razor examples for BitCss usage are
incomplete—update the examples to include the property accessor (e.g., `.Main`,
`.Dark`, `.Light`, `.Text`) for BitCss.Class entries and the equivalent `.Main`
(or variant) for BitCss.Var entries so they reflect the actual API (e.g., use
@BitCss.Class.Color.Background.Primary.Main and border-color:
var(@BitCss.Var.Color.Border.Primary.Main)); keep the SCSS variable guidance
as-is but ensure you mention modifier suffixes like -hover, -active, -dark,
-light are available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bit Boilerplate copilot instructions need improvements

1 participant