Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FluentCard] Add MinimalStyle property #1595

Merged
merged 4 commits into from
Feb 28, 2024
Merged

Conversation

dvoituron
Copy link
Collaborator

[FluentCard] Add MinimalStyle property

By default the FluentCard component is a visual container and design system provider. Cards are snapshots of content that are typically used in a group to present collections of related information. Thus, by design, the FluentCard component includes all the styles required for a good representation of the other components included in it. This adds a large number of styles such as justify-content; align-items; gap; width; and over 80 CSS variables. The code generated can therefore become very important, especially if you use this component several times, for example in a list or during a foreach.

To avoid this, you can use the MinimalStyle property. This will remove all the default styles from the FluentCard component. This will allow you to use the FluentCard component as a simple container without any style, except the styles to draw the box-shadow (and some minimal styles).

Example

<FluentCard MinimalStyle="true">
    <p>Just some content in a card (with a button that does not do anything).</p>

    <FluentButton Appearance="Appearance.Accent">Hello</FluentButton>
    <p>No Width or Height has been specified.</p>
</FluentCard>

image

Code generated

<div class="fluent-card-minimal-style">
  <p>Just some content in a card (with a button that does not do anything).</p>
  <fluent-button type="button" appearance="accent" class="accent">Hello</fluent-button>
  <p>No Width or Height has been specified.</p>
</div>

Default FluentCard code generated

image

Verified

This commit was signed with the committer’s verified signature.
crazy-max CrazyMax
@vnbaaij vnbaaij enabled auto-merge (squash) February 28, 2024 13:39
@vnbaaij vnbaaij merged commit 1006573 into dev Feb 28, 2024
4 checks passed
@vnbaaij vnbaaij deleted the users/dvoituron/card-style-only branch February 28, 2024 13:43
vnbaaij added a commit that referenced this pull request Mar 6, 2024
* Add FluentCard.MinimalStyle property

* Fix style adding `contain: content;`

---------

Co-authored-by: Vincent Baaij <vnbaaij@outlook.com>
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.

None yet

2 participants