Repository navigation
[dev-v5] Add responsive margin and padding utility classes to modify an element’s appearance - #3208
Merged
Merged
Conversation
|
✅ All tests passed successfully Details on your Workflow / Core Tests page. |
Summary - Unit Tests Code CoverageSummary
CoverageMicrosoft.FluentUI.AspNetCore.Components - 98.1%
|
Denis Voituron (dvoituron)
marked this pull request as ready for review
January 21, 2025 14:31
Denis Voituron (dvoituron)
requested a review
from Vincent Baaij (vnbaaij)
as a code owner
January 21, 2025 14:31
Vincent Baaij (vnbaaij)
requested changes
Jan 22, 2025
Vincent Baaij (vnbaaij)
approved these changes
Jan 22, 2025
This was referenced Sep 28, 2026
Closed
Merged
This was referenced Oct 14, 2026
Closed
Closed
This was referenced Oct 28, 2026
Closed
This was referenced Nov 9, 2026
This was referenced Nov 23, 2026
Closed
Closed
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.
[dev-v5] Add responsive margin and padding utility classes to modify an element’s appearance
Spacing
We include a wide range of shorthand responsive margin and padding utility
classes to modify an element’s appearance.
Spacing is a way to modify the CSS
paddingormarginstyles without creating new classes.How it works
Use the
MarginorPaddingproperty and choose a direction.Then add size, ranging from 0 to 8.
Spacing utilities that apply to all breakpoints, from
xstoxl,have no breakpoint abbreviation in them.
The classes are named using the format
{property}{direction}-{size}for
xsand{property}{direction}-{breakpoint}-{size}forsm,md,lg, andxl.The properties:
mfor classes that setMargin.pfor classes that setpadding.The direction property applies to:
tformargin-toporpadding-top.bformargin-bottomor padding-bottom`.lformargin-leftor padding-left`.rformargin-rightor padding-right`.sformargin-left/padding-left(in LTR mode) andmargin-right/padding-right(in RTL mode).eformargin-right/padding-right(in LTR mode) andmargin-left/padding-left(in RTL mode).xformargin-left/padding-leftandmargin-right/padding-right.yformargin-top/padding-topandmargin-bottom/padding-bottom.afor all 4 sides.Size
The size changes with an interval of, by default, 4 pixels (see the CSS variables below).
Positive
0setsmarginorpaddingto01setsmarginorpaddingto4px2setsmarginorpaddingto8px3setsmarginorpaddingto12px4setsmarginorpaddingto16px5setsmarginorpaddingto20px6setsmarginorpaddingto24px7setsmarginorpaddingto28px8setsmarginorpaddingto32pxNegative
n1setsmarginorpaddingto-4pxn2setsmarginorpaddingto-8pxn3setsmarginorpaddingto-12pxn4setsmarginorpaddingto-16pxn5setsmarginorpaddingto-20pxn6setsmarginorpaddingto-24pxn7setsmarginorpaddingto-28pxn8setsmarginorpaddingto-32pxExample
MarginandPaddingcomponent attributesAll FluentUI Blazor components contain the
MarginandPaddingattributes.You can specify a CSS value respecting the CSS padding
or CSS margin pattern.
Or you can specify a class name like defined above on this page.
Example:
Appendix - CSS variables
Spacing uses these CSS variables, that can be customized:
Unit Tests