Skip to main content

Badge

Badges are status descriptors used to emphasize an item's state.

Importโ€‹

import { Badge } from '@faststore/ui'

Usageโ€‹

Loading...

Use casesโ€‹

Use the Badge component to highlight:

  • Promotional discounts.
  • Product features (e.g., vegan or cruelty-free).
  • Product availability statuses (e.g., NEW,ONLY 1 LEFT and OUT OF STOCK).
Loading...

Propsโ€‹

Customizationโ€‹

data-store-badge

Best practicesโ€‹

โœ… Do'sโ€‹

  • Place the badge next to or on top of its related item.
  • Be cautious about the badge's positioning, writing, shape, and color to avoid any confusion with components similar in appearance.

โŒ Don'tsโ€‹

  • Don't use long texts in badges. A reasonable character limit is 15.
  • Don't label badges with active verbs.
  • Don't use color alone to convey information. If color is needed to convey meaning, ensure there is a text alternative for that meaning as well.
  • Don't place badges next to buttons. Although badges and buttons are similar in appearance, badges are not interactive and may confuse users if not used in the proper context.

Accessibilityโ€‹

  • id attribute value must be unique.
  • Text elements must have sufficient color contrast against the background.

Didn't find your answers? Ask the Community. For documentation suggestions, submit your feedback.

JOIN THE COMMUNITY