Skip to main content
react-md
react-md - Badge - SassDoc

Variables

rmd-badge-size

Number

The height and width to use for a circular badge.

$rmd-badge-size: 1.5rem !default;

rmd-badge-border-radius

Number

The border radius to use for a circular badge.

$rmd-badge-border-radius: 50% !default;

rmd-badge-default-background-color

Color

The "default" background color.

$rmd-badge-default-background-color: rgba($rmd-black-base, 0.2) !default;

rmd-badge-default-color

Color

The "default" themed text color.

$rmd-badge-default-color: if(
  rmd-theme-tone($rmd-badge-default-background-color) == light,
  $rmd-black-base,
  $rmd-white-base
) !default;

rmd-badge-font-size

Number

The badge's font size.

$rmd-badge-font-size: 0.625rem !default;

rmd-badge-offset-top

Number

The top position for the badge.

$rmd-badge-offset-top: 0 !default;

rmd-badge-offset-right

Number

The right position for the badge. This will be swapped to be left for rtl languages.

$rmd-badge-offset-right: 0 !default;

rmd-badge-theme-values

Map

A Map of all the "themeable" parts of the badge package. Every key in this map will be used to create a css variable to dynamically update the values of the icon as needed.

$rmd-badge-theme-values: (
  background-color: $rmd-badge-default-background-color,
  color: $rmd-badge-default-color,
  border-radius: $rmd-badge-border-radius,
  font-size: $rmd-badge-font-size,
  size: $rmd-badge-size,
  top: $rmd-badge-offset-top,
  right: $rmd-badge-offset-right,
) !default;

Mixins

rmd-badge-theme

mixin

Creates the styles for one of the badge's theme values. This is mostly going to be an internal helper mixin util.

Parameters
NameDescriptionTypeDefault Value
$property

The property to set a rmd-badge-theme-values value to.

String
$theme-style

One of the keys of rmd-badge-theme-values to extract a value from.

String
$fallback

A fallback value to use if the css variable isn't set somehow. This will default to automatically retrieving the default value from the rmd-badge-theme-values map when null.

Color|String|Numbernull

rmd-badge-theme-update-var

mixin

Updates one of the badge's theme variables with the new value for the section of your app.

Parameters
NameDescriptionTypeDefault Value
$theme-style

The badge theme style type to update. This should be one of the $rmd-badge-theme-values keys.

String
$value

The new value to use.

Color|String|Number

rmd-badge-container

mixin

Creates the minimal styles for a badge container.

rmd-badge

mixin

Creates all the styles for the badge component.

react-md-badge

mixin

Creates all the styles for this package as well as defining all the theme CSS variables.

Functions

rmd-badge-theme

function

This function is used to quickly get one of the badge's theme values. This is really just for the rmd-badge-theme mixin to provide some validation that a correct style key is used, but might be useful in other cases.

Returns — Color|String|Number

one of the badge's theme values.

Parameters
NameDescriptionTypeDefault Value
$theme-style

One of the $rmd-badge-theme-values map keys to get a value for.

String

rmd-badge-theme-var

function

This function is used to get one of the badge's theme variables as a CSS Variable to be applied as a style attribute. By default, the CSS Variable will have a fallback of the current $rmd-badge-theme-values

This function is used to create a CSS Variable declaration with an optional fallback value if the CSS Variable has not been declared somehow.

Returns — String

one of the badge's theme values as a css variable.

Parameters
NameDescriptionTypeDefault Value
$theme-style

One of the $rmd-badge-theme-values map keys to set a value for.

String
$fallback

An optional fallback color to apply. This is set to null by default and not used since the link's theme variables should always exist.

Color|String|Numbernull