Boolean$disable-rtl: false !default;Set this to true if you do not need to support RTL languages
Boolean$disable-validation: false !default;Set this to true if you want to disable build-time validation for overriding react-md values. No idea why you would want this though.
Boolean$disable-has-selectors: false !default;Set this to true to remove the :has selectors in the code if you need to support older browsers even though I don't really support older browsers.
Boolean$disable-focus-visible: false !default;Set this to true if focus styles should be applied with
.rmd-keyboard-mode :focus instead of :focus-visible.
Boolean$temporary-element-z-index: 30 !default;The default z-index to use for temporary elements
mixin@mixin map-to-styles($map) { … }Converts a property: value map into styles. Also supports custom selectors.
Note: If the styles include complex selectors like .parent &, it will need to be the last mixin in the current block or wrap other styles in & {}
@use "@react-md/core";
$styles: (
background-color: red,
color: blue,
padding: 0.25rem,
);
.container {
@include core.map-to-styles($styles);
}@use "@react-md/core";
$styles: (
background-color: red,
"&:hover": (
background-color: orange,
color: red,
),
);
.container {
@include core.map-to-styles($styles);
}mixin@mixin map-to-animation($map) { … }Used to convert a map into a css animation
@use "@react-md/core";
$animation: (
0%: (
opacity: 0.06,
),
60%: (
opacity: 0.1,
),
80%: (
opacity: 0.08,
),
100%: (
opacity: 0.06,
),
);
@keyframes my-animation {
@include core.map-to-animation($animation);
}mixin@mixin pseudo-element($z-index: 0, $fixed: false, $inset: 0, $border-radius: inherit) { … }Generates a pseudo element with most used styles.
@use "@react-md/core";
.container {
@include core.pseudo-element;
position: relative;
}mixin@mixin sr-only($focusable: false, $focus-selector: "&--focusable") { … }Generates styles to create a screen-reader only visible element but can also allow the element to be visible to everyone while focused.
You'll normally just want to use the SrOnly component or cssUtils instead of this mixin.
mixin@mixin hide-scrollbar { … }Used to hide the scrollbar for an element while still remaining scrollable.
NOTE: This is generally not recommended for accessibility since most users do not know how to scroll without a visible scrollbar
mixin@mixin optional-css-modules($selector, $css-modules: false, $parent-selector: true) { … }Mostly an internal mixin for generating styles that might be created from a CSS module. This really just wraps the provided selector in :global and wrapping the rest of the content in :local.
mixin@mixin rtl { … }Used to apply styles when using rtl behavior
Note: This will need to be included at the end of a block with the new Sass rules or prefix styles with & {}
@use "@react-md/core";
.selector {
margin-right: 1rem;
// swap the margin in RTL
@include core.rtl {
margin-left: 1rem;
margin-right: auto;
}
}mixin@mixin keyboard-only($css-modules: false, $parent-selector: true) { … }Used to apply styles only while the user is using a keyboard. This relies on the UserInteractionModeProvider to work correctly.
Note: This will need to be included at the end of a block with the new Sass rules or prefix styles with & {}
mixin@mixin mouse-only($css-modules: false, $parent-selector: true) { … }Used to apply styles only while the user is using a mouse. This relies on the UserInteractionModeProvider to work correctly.
Note: This will need to be included at the end of a block with the new Sass rules or prefix styles with & {}
mixin@mixin touch-only($css-modules: false, $parent-selector: true) { … }Used to apply styles only while the user is using a touch device. This relies on the UserInteractionModeProvider to work correctly.
Note: This will need to be included at the end of a block with the new Sass rules or prefix styles with & {}
mixin@mixin mouse-hover($wrap-in-hover: true) { … }A helper mixin to apply hover styles only when the user is using a mouse. If you just use :hover, the styles will also be applied after touching an element on touch screens until another element is focused.
| Name | Description | Type | Default Value |
|---|---|---|---|
$wrap-in-hover | Set this to | Boolean | true |
@use "@react-md/core";
.selector {
@include core.mouse-hover {
background-color: red;
}
}mixin@mixin optional-layer($name, $disabled) { … }An internal helper to dynamically wrap the CSS in a @layer.
| Name | Description | Type | Default Value |
|---|---|---|---|
$name | The layer name to use | String | — |
$disabled | Set to | Boolean | — |
function@function scrollbar-size { … }This function can be used to offset position: fixed or position: absolute
elements by the current scrollbar size. The variable will only be set while the useScrollLock hook has been triggered.
Stringa var string
@use "@react-md/core";
.selector {
margin-right: core.scrollbar-size();
}function@function negate-var($css-variable) { … }Used to negate a number or a variable that might be a var statement.
Stringthe calc string
function@function validate($options, $key-or-value, $error-message) { … }Internal validation function to ensure the user overrides variables with accepted values.
anythe value from the list or map
Unable to validate anything except for lists and maps at this time. Received:
Invalid #{$error-message}: