CSS utility classes
Add CSS utility classes to inputs and content.
Last updated
Was this helpful?
Add CSS utility classes to inputs and content.
Last updated
Was this helpful?
Use the classNames
parameter to add CSS utility classes to inputs and other content. In the example below, the available classes are used to create a composite address input.
An fmd-
prefix is added to all class names. However, this can be changed. See the prefix section to learn more.
Generates the following Markdown-like syntax:
The following CSS utility classes are available by default:
All of the content uses a grid based, 12-column system. Add a .col-{value}
class to any block-level element to have it occupy only a portion of the full width of the row. The layout class names come in the following formats:
.col-{value}
(only for tablets and desktops, ≥ 576px
)
.xs:col-{value}
(only for phones, < 576px
)
The {value}
can be any integer between 1
to 12
(included) or auto
. For example, .col-4
would span 4 columns.
Generates the following Markdown-like syntax:
Push and pull each column using the following classes:
.col-start-{value}
/.xs:col-start-{value}
(sets grid-column-start: {value}
)
.col-end-{value}
/.xs:col-end-{value}
(sets grid-column-end: {value}
)
Here, the {value}
can be any integer between 1
to 13
(included) or auto
.
Generates the following Markdown-like syntax:
The layout class names will also work in the exact same way for content inside <div>
containers.
.text-emphasis
color: var(--fmd-emphasis-color)
(black
in light mode, white
in dark mode)
.text-accent
Sets color
to accent
.d-inline
display: inline
.d-inline-block
display: inline-block
.d-block
display: block
.d-inline-flex
display: inline-flex
.d-flex
display: flex
.align-items-center
align-items: center
.justify-content-start
justify-content: flex-start
.justify-content-center
justify-content: center
.justify-content-end
justify-content: flex-end
.justify-content-stretch
justify-content: stretch
.d-none
display: none
The above classes also have phone-only (< 576px
) variants available using the .xs:
prefix. For example: .xs:d-flex
, .xs:align-items-center
, etc.
.h1
Matches the appearance of <h1>
.h2
Matches the appearance of <h2>
.h3
Matches the appearance of <h3>
.h4
Matches the appearance of <h4>
.h5
Matches the appearance of <h5>
.h6
Matches the appearance of <h6>
.anchored
Adds an anchor link to the heading
.fs-lead
font-size: var(--fmd-font-size-lg)
(18px
by default)
.specific-fs-12
font-size: 12px
.specific-fs-14
font-size: 14px
.specific-fs-16
font-size: 16px
.specific-fs-18
font-size: 18px
.specific-fs-20
font-size: 20px
.fw-lighter
font-weight: lighter
.fw-light
font-weight: 300
.fw-normal
font-weight: 400
.fw-medium
font-weight: 500
.fw-semibold
font-weight: 600
.fw-bold
font-weight: 700
.fw-bolder
font-weight: bolder
.form-question
Matches the appearance of a form field question
.form-description
Matches the appearance of a form field description
.hide-lm
display: none
only in light mode
.hide-dm
display: none
only in dark mode
.list-inside
padding-left: 0
and list-style-position: inside
.list-unstyled
padding-left: 0
and list-style: none
.hide-ltr
display: none
only in LTR
.hide-rtl
display: none
only in RTL
The class names for the margin
and padding
utilities come in the following formats:
.m{sides}-{size}
for margin
.p{sides}-{size}
for padding
t
Sets margin-top
or padding-top
b
Sets margin-bottom
or padding-bottom
s
(start)
Sets margin-left
or padding-left
(inverted in RTL)
e
(end)
Sets margin-right
or padding-right
(inverted in RTL)
0
Sets margin
or padding
to 0
1
Sets margin
or padding
to 4px
2
Sets margin
or padding
to 8px
3
Sets margin
or padding
to 16px
auto
Sets margin-left
or margin-right
to auto
.text-start
text-align: left
(inverted in RTL)
.text-center
text-align: center
.text-end
text-align: right
(inverted in RTL)
.xs:text-start
text-align: left
only on phones (inverted in RTL)
.xs:text-center
text-align: center
only on phones
.xs:text-end
text-align: right
only on phones (inverted in RTL)
.invisible
visibility: hidden
By default, an fmd-
prefix is added to all class names when the classNames
parameter is used. This is mainly used for scoping and avoiding collisions with other CSS that may be present. However, this can be changed using the cssPrefix
form setting. For example, setting cssPrefix
to "none"
would remove the prefix altogether. This means that you can use your own CSS utility classes, even the ones available in frameworks like Tailwind.
Generates the following Markdown-like syntax: