Skip to content

feat(Card): support custom class for header#8199

Merged
ArgoZhang merged 11 commits into
mainfrom
card-supportcustom-attributes
Jul 9, 2026
Merged

feat(Card): support custom class for header#8199
ArgoZhang merged 11 commits into
mainfrom
card-supportcustom-attributes

Conversation

@Tony-ST0754

@Tony-ST0754 Tony-ST0754 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Link issues

fixes #8197

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Allow Card component sections to accept custom attributes for header, body, and footer containers.

New Features:

  • Add HeaderAttributes parameter to customize attributes on the card header element.
  • Add BodyAttributes parameter to customize attributes on the card body container element.
  • Add FooterAttributes parameter to customize attributes on the card footer container element.

refactor: header、body、footer这三个部分增加自定义属性
@bb-auto

bb-auto Bot commented Jul 8, 2026

Copy link
Copy Markdown

Thanks for your PR, @Tony-ST0754. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@bb-auto
bb-auto Bot requested a review from ArgoZhang July 8, 2026 07:54
@bb-auto bb-auto Bot added the enhancement New feature or request label Jul 8, 2026
@sourcery-ai

sourcery-ai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds support for custom attribute dictionaries on Card header, body, and footer sections and wires them into the corresponding markup, allowing consumers to apply arbitrary HTML attributes to those elements.

File-Level Changes

Change Details Files
Expose new parameter dictionaries for header, body, and footer attributes on the Card component and prevent them from being serialized.
  • Add using directive for System.Text.Json.Serialization to enable JsonIgnore usage.
  • Introduce HeaderAttributes, BodyAttributes, and FooterAttributes as nullable IDictionary<string, object>? parameters, each annotated with [Parameter] and [JsonIgnore].
src/BootstrapBlazor/Components/Card/Card.razor.cs
Apply the new attribute dictionaries to the header, body, and footer elements in the Card markup.
  • Attach @HeaderAttributes to the header div with class "card-header" so callers can provide arbitrary attributes.
  • Attach @BodyAttributes to the main body div identified by BodyId and BodyClassName.
  • Attach @FooterAttributes to the footer div rendered when FooterTemplate is provided.
src/BootstrapBlazor/Components/Card/Card.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#8197 Expose a way to customize the Card header section (e.g., class/style/attributes) so users can independently control its background and other visual properties.
#8197 Provide similar customization capabilities for the Card body and footer sections so their backgrounds and other styles can be independently controlled.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added this to the v10.8.0 milestone Jul 8, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.79%. Comparing base (7a7a47a) to head (57ab7eb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8199   +/-   ##
=======================================
  Coverage   98.78%   98.79%           
=======================================
  Files         767      767           
  Lines       34290    34298    +8     
  Branches     4715     4715           
=======================================
+ Hits        33875    33884    +9     
+ Partials      415      414    -1     
Flag Coverage Δ
BB 98.79% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ArgoZhang ArgoZhang changed the title feat(Card): support custom attributes for header, body, and footer feat(Card): support custom class for header Jul 9, 2026
@ArgoZhang
ArgoZhang merged commit 9ff580f into main Jul 9, 2026
9 checks passed
@ArgoZhang
ArgoZhang deleted the card-supportcustom-attributes branch July 9, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(Card): support custom class for header

2 participants