Design system.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

37 řádky
731 B

  1. import * as React from 'react';
  2. import * as BadgeBase from '@tesseract-design/web-base-badge';
  3. export type BadgeProps = React.HTMLProps<HTMLSpanElement> & {
  4. rounded?: boolean,
  5. };
  6. export const Badge = React.forwardRef<HTMLSpanElement, BadgeProps>(
  7. (
  8. {
  9. children,
  10. rounded = false,
  11. },
  12. ref,
  13. ) => {
  14. const badgeStyleProps = React.useMemo<BadgeBase.BadgeBaseArgs>(() => ({
  15. rounded,
  16. }), [rounded]);
  17. return (
  18. <strong
  19. ref={ref}
  20. className={BadgeBase.Root(badgeStyleProps)}
  21. data-testid="badge"
  22. >
  23. <span
  24. className={BadgeBase.Content()}
  25. >
  26. {children}
  27. </span>
  28. </strong>
  29. )
  30. }
  31. )
  32. Badge.displayName = 'Badge';