FluentCss Documentation

Borders and effects

Outline your surfaces with borders and radius, then add rings, shadows and opacity.

Border width

Utility Generated CSS
Border() border-width: 1px
Border(2) border-width: 2px
Border(4) border-width: 4px
BorderT() / BorderT(2) border-top-width: 1px / 2px
BorderR() / BorderR(2) border-right-width: 1px / 2px
BorderB() / BorderB(2) border-bottom-width: 1px / 2px
BorderL() / BorderL(2) border-left-width: 1px / 2px
BorderX() / BorderX(2) border-inline-width: 1px / 2px
BorderY() / BorderY(2) border-block-width: 1px / 2px
1px border
2px border
Dashed blue border
<div class="@Css.Border().BorderColor(Color.Slate300).P(4)">1px border</div>
<div class="@Css.Border(2).BorderColor(Color.Slate300).P(4)">2px border</div>
<div class="@Css.Border(2, Color.Blue400, BorderStyle.Dashed).P(4)">Dashed blue border</div>

Border style and color

Utility Generated CSS
BorderColor(Color.Slate300) border-color: <value>
BorderSolid() border-style: solid
BorderDashed() border-style: dashed
BorderDotted() border-style: dotted
BorderDouble() border-style: double

The composite overload combines the three border pieces in a single call:

Css.Border(2, Color.Slate300, BorderStyle.Dashed);

// expands to three utilities:
// border-2        border-width: 2px
// border-slate-300 border-color: ...
// border-dashed   border-style: dashed

Border radius

Utility Generated CSS
RoundedSm() border-radius: 0.125rem
Rounded() border-radius: 0.25rem
RoundedMd() border-radius: 0.375rem
RoundedLg() border-radius: 0.5rem
RoundedFull() border-radius: 9999px
Rounded(Length.Px(4)) border-radius: 4px
Rounded(Length.Percent(50)) border-radius: 50%
<div class="@Css.RoundedSm().W(16).H(16).Background(Color.Blue500)"></div>
<div class="@Css.RoundedFull().W(16).H(16).Background(Color.Purple500)"></div>

Custom radius with Length

Rounded also accepts a Length, which covers arbitrary values, other units (including percentages) and reusable tokens.

Css.Rounded(Length.Px(4));                  // rounded-4px
Css.Rounded(Length.Percent(50));            // rounded-50%
Css.Rounded(new Length("1.25rem", "card")); // rounded-card
<div class="@Css.Rounded(Length.Px(4))"></div>
<div class="@Css.Rounded(CardRadius)"></div>
<div class="@Css.Rounded(Length.Percent(50))"></div>

Rings and outlines

A ring is a box-shadow based outline that follows the border radius, which makes it ideal for focus states. The outline helpers map to the native outline property.

Utility Generated CSS
Ring(3, Color.Blue300) box-shadow: 0 0 0 3px <value>
Outline(2) outline-width: 2px
OutlineColor(Color.Blue500) outline-color: <value>
OutlineOffset(4) outline-offset: 4px
OutlineHidden() outline: 2px solid transparent
Ring
<button class="@Css.Px(5).Py(2).RoundedMd().FontBold()
                @Css.Focus(f => f.Ring(3, Color.Blue300).OutlineHidden())">
    Focus me
</button>

Shadows

Utility Generated CSS
ShadowSm() box-shadow: small
Shadow() box-shadow: default
ShadowMd() box-shadow: medium
ShadowLg() box-shadow: large
sm
md
lg
<div class="@Css.ShadowSm().P(4).RoundedMd().Background(Color.White)">sm</div>
<div class="@Css.ShadowMd().P(4).RoundedMd().Background(Color.White)">md</div>
<div class="@Css.ShadowLg().P(4).RoundedMd().Background(Color.White)">lg</div>

Opacity and cursor

Utility Generated CSS
Opacity(50) opacity: 0.5
Opacity(0) opacity: 0
Opacity(100) opacity: 1
CursorPointer() cursor: pointer
<div class="@Css.Opacity(100).P(4).RoundedMd().Background(Color.Blue500)"></div>
<div class="@Css.Opacity(75).P(4).RoundedMd().Background(Color.Blue500).CursorPointer()"></div>
<div class="@Css.Opacity(50).P(4).RoundedMd().Background(Color.Blue500)"></div>
<div class="@Css.Opacity(25).P(4).RoundedMd().Background(Color.Blue500)"></div>