<Badge> Component

<Badge> represents counters or labels.

Here the demo:

Preview
2New!

Installing <Badge> Component

There are 2 ways to install <Badge> component into your react app project:

  • Install the Specific Package of <Badge> Component
  • Install the Whole Reusable-UI Component Pack, including the <Badge> Component

expanded Property

Expands/Collapses the <Badge>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview

<Badge expanded={true}> 

2

Show code

lazy Property

Determines whenever the <Badge>'s children should be rendered or not when the <Badge expanded={false}>.

The possible values are:

  • undefined
  • false
  • true

Floating Properties

Determines how the <Badge> should be floating on the target DOM reference.

floatingOn Property

Determines the target DOM reference where the <Badge> should be floating on.
If not set (undefined), the <Badge> becomes a normal element flow.


Here the preview:

Preview
2
2

Show code

floatingPlacement Property

Determines the location where the <Badge> should be floating on the target DOM reference.


Here the preview:

floatingPlacement='top'
2

floatingStrategy Property

Determines the technical strategy how the <Badge> can float.
In most cases, you should not worry about the detail mechanism how the <Badge> can float.

The possible values are:

  • undefined
  • 'absolute'
  • 'fixed'

floatingAutoFlip Property

Automatically flips the floatingPlacement to opposite direction when the <Badge> is about to be clipped.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview
2

Show code

floatingAutoShift Property

Automatically shifts the floatingPlacement to nearest safe position when the <Badge> is about to be clipped.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview
2

Show code

floatingOffset Property

The distance (in pixel) between the <Badge> and the target DOM reference.

The possible values are:

  • undefined
  • 0
  • positive number
  • negative number

Here the preview:

Preview

<Badge floatingOffset={0}>

2 2

Show code

floatingShift Property

The distance (in pixel) between the <Badge> and the default floatingPlacement location.

The possible values are:

  • undefined
  • 0
  • positive number
  • negative number

Here the preview:

Preview

<Badge floatingShift={0}>

2 2

Show code

onFloatingUpdate Property

Sets a callback function to be called when the <Badge> updates the position relative to the target DOM reference.

The callback function parameters:

  • event: FloatingPosition

Variant Properties

The alternative appearances of the <Badge> layout without changing the <Badge>'s functionality.

badgeStyle Property

Sets the alternative appearances of the <Badge>.

The possible values are:

  • undefined
  • 'regular'
  • 'pill'
  • 'square'
  • 'circle'

Here the preview:

Preview
2 2

Show code

size Property

Defines the alternative size of the <Badge>.

The possible values are:

  • undefined
  • 'sm'
  • 'md'
  • 'lg'

Here the preview:

Preview
2 2 2

Show code

theme Property

Defines the contextual theme of the <Badge>.

The possible values are:

  • undefined
  • 'primary'
  • 'secondary'
  • 'success'
  • 'info'
  • 'warning'
  • 'danger'
  • 'light'
  • 'dark'

Here the preview:

Preview
2 2 2 2 2 2 2 2

Show code

gradient Property

Activates a 3D mode of the <Badge>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview
2 2 2 2 2 2 2 2

Show code

outlined Property

Activates an outlined mode (background-less, contrast foreground, and contrast border) of the <Badge>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview
2 2 2 2 2 2 2 2

Show code

mild Property

Activates a mild mode (mild background, contrast foreground, and contrast border) of the <Badge>.

The possible values are:

  • undefined
  • 'inherit'
  • true
  • false

Here the preview:

Preview
2 2 2 2 2 2 2 2

Show code

nude Property

Activates an nude mode (background-less, padding-less, and border-less) of the <Badge>.

The possible values are:

  • undefined
  • true
  • false

Here the preview:

Preview
2 2 2 2 2 2 2 2

Show code

Variables

There are several variables of <Badge> you can customize. Changing the variables affects all <Badge> instance and other components that depend on <Badge>.

Here the exposed variables:

  • Spacings
  • Typos

The example of accessing, modifying, & adding variables:

Show code