= (args) => {
+ const { array } = args;
+
+ return (
+
+ {array.map((value, key) => (
+
+
+ {value ? value.charAt(0).toUpperCase() + value.slice(1) : ''}
+
+
+
+
+
+
+ ))}
+
+ );
+};
+
+export const Sizes: StoryObj = {
+ render: TemplateColumn,
+ args: {
+ array: sizeArray,
+ children: 'Draft',
+ color: 'neutral',
+ },
+};
+
export const Colors: Story = {
render: TemplateAllCombos,
};
@@ -150,22 +187,15 @@ export const StatusIndicator: Story = {
},
};
-const TemplateLarge: StoryFn = (args) => (
-
-
-
-
-
-
-
-
-);
-
-export const Large: Story = {
- render: TemplateLarge,
- args: {
- color: 'neutral',
- size: 'large',
- children: 'Draft',
- },
+export const WithTooltip: StoryFn = () => {
+ return (
+
+
+
+
+
+ Icon-only badges should always have a tooltip to provide context and ensure accessibility.
+
+
+ );
};
diff --git a/src/tedi/components/tags/status-badge/status-badge.tsx b/src/tedi/components/tags/status-badge/status-badge.tsx
index a2ee589c..27e809c5 100644
--- a/src/tedi/components/tags/status-badge/status-badge.tsx
+++ b/src/tedi/components/tags/status-badge/status-badge.tsx
@@ -1,4 +1,5 @@
import cn from 'classnames';
+import { forwardRef } from 'react';
import { BreakpointSupport, useBreakpointProps } from '../../../helpers';
import { Icon } from '../../base/icon/icon';
@@ -60,7 +61,7 @@ export interface StatusBadgeProps extends BreakpointSupport {
+export const StatusBadge = forwardRef((props, ref) => {
const { getCurrentBreakpointProps } = useBreakpointProps(props.defaultServerBreakpoint);
const {
color = 'neutral',
@@ -93,6 +94,7 @@ export const StatusBadge = (props: StatusBadgeProps): JSX.Element => {
return (
{
{children && {children}}
);
-};
+});
+
+StatusBadge.displayName = 'StatusBadge';