• /
  • Log in
  • Free account

Badge

Usage

import { Badge } from 'nr1'

Examples

Props

childrenrequiredstring|number

String to render inside the badge. Ellipsis will apply if the content is more than 24 characters.

classNamestring

Appends class names to the component.

Should be used only for positioning and spacing purposes.

spacingTypeenum[]

Spacing property. Spacing is defined as a tuple of zero to four values, which follow the same conventions as CSS properties like margin or padding. To omit a value, use SPACING_TYPE.OMIT.

<Array of
<One of
Badge.SPACING_TYPE.EXTRA_LARGE,
Badge.SPACING_TYPE.LARGE,
Badge.SPACING_TYPE.MEDIUM,
Badge.SPACING_TYPE.NONE,
Badge.SPACING_TYPE.OMIT,
Badge.SPACING_TYPE.SMALL,
>
>
styleobject

Inline style for custom styling.

Should be used only for positioning and spacing purposes.

testIdstring

Adds a data-test-id attribute. Use it to target the component in unit and E2E tests.

For a test id to be valid, prefix it with your nerdpack id, followed up by a dot.

For example, my-nerdpack.some-element.

Note: You might not see data-test-id attributes as they are removed from the DOM, to debug them pass a e2e-test query parameter to the URL.

typeenum
DEFAULT
Badge.TYPE.NORMAL

Type can be:

  • Normal — indicates general or in-progress status, eg. ‘Coming soon’ or ‘Minor’.
  • Info - indicates a new, created, or help status, eg. ‘New’, ‘Beta’ or ‘Information’.
  • Success - indicates a successful state.
  • Warning - indicates items that require advice state.
  • Critical - indicates problematic items.
<One of
Badge.TYPE.CRITICAL,
Badge.TYPE.INFO,
Badge.TYPE.NORMAL,
Badge.TYPE.SUCCESS,
Badge.TYPE.WARNING,
>
Create issueEdit page
Copyright © 2021 New Relic Inc.