Skip to content

The open alternative to Salesforce, designed for AI.

Replace Pill and NotificationCounter with Badge (#27702)

Raphaël Bosid9f2b66a425a
diff --git a/packages/twenty-docs/docs.json b/packages/twenty-docs/docs.json
index 15756244f96..79921bfc4b7 100644
--- a/packages/twenty-docs/docs.json
+++ b/packages/twenty-docs/docs.json
@@ -549,7 +549,7 @@
"ui/primitives/data-display/tag",
"ui/primitives/data-display/status",
"ui/primitives/data-display/color-sample",
- "ui/primitives/data-display/pill"
+ "ui/primitives/data-display/badge"
]
},
{
@@ -631,7 +631,6 @@
"ui/components/data-display/command-block",
"ui/components/data-display/json-tree",
"ui/components/data-display/metric-row",
- "ui/components/data-display/notification-counter",
"ui/components/data-display/tinted-icon-tile"
]
},
diff --git a/packages/twenty-docs/navigation/base-structure.json b/packages/twenty-docs/navigation/base-structure.json
index 6b3271c3914..e19b10ebcb8 100644
--- a/packages/twenty-docs/navigation/base-structure.json
+++ b/packages/twenty-docs/navigation/base-structure.json
@@ -560,7 +560,7 @@
"ui/primitives/data-display/tag",
"ui/primitives/data-display/status",
"ui/primitives/data-display/color-sample",
- "ui/primitives/data-display/pill"
+ "ui/primitives/data-display/badge"
]
},
{
@@ -650,7 +650,6 @@
"ui/components/data-display/command-block",
"ui/components/data-display/json-tree",
"ui/components/data-display/metric-row",
- "ui/components/data-display/notification-counter",
"ui/components/data-display/tinted-icon-tile"
]
},
diff --git a/packages/twenty-docs/snippets/ui/generated/components/data-display/notification-counter.mdx b/packages/twenty-docs/snippets/ui/generated/components/data-display/notification-counter.mdx
deleted file mode 100644
index 44ba8543b4c..00000000000
--- a/packages/twenty-docs/snippets/ui/generated/components/data-display/notification-counter.mdx
+++ /dev/null
@@ -1,24 +0,0 @@
-{/*
- * _____ _
- *|_ _|_ _____ _ __ | |_ _ _
- * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
- * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
- * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
- * |___/
- *
- * This file is generated from the documentation data in packages/twenty-ui/generated.
- * To update it, edit the component prop types or design tokens in twenty-ui and run:
- * npx nx generate:ui twenty-docs
- */}
-
-<ParamField body="className" type="string">
- Class applied to the badge.
-</ParamField>
-
-<ParamField body="count" type="number" required>
- Number to display as supplied, without clamping or hiding zero.
-</ParamField>
-
-<ParamField body="variant" type="&quot;primary&quot; | &quot;secondary&quot;" default="primary">
- Primary or secondary badge styling.
-</ParamField>
diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/badge.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/badge.mdx
new file mode 100644
index 00000000000..fa236d69c78
--- /dev/null
+++ b/packages/twenty-docs/snippets/ui/generated/data-display/badge.mdx
@@ -0,0 +1,32 @@
+{/*
+ * _____ _
+ *|_ _|_ _____ _ __ | |_ _ _
+ * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
+ * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
+ * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
+ * |___/
+ *
+ * This file is generated from the documentation data in packages/twenty-ui/generated.
+ * To update it, edit the component prop types or design tokens in twenty-ui and run:
+ * npx nx generate:ui twenty-docs
+ */}
+
+<ParamField body="children" type="ReactNode">
+ Caller-provided text, numbers, icons, or other inline content.
+</ParamField>
+
+<ParamField body="color" type="&quot;inherit&quot; | &quot;primary&quot; | &quot;secondary&quot; | &quot;tertiary&quot;" default="tertiary">
+ Neutral tertiary, inherited text, primary accent, or secondary treatment.
+</ParamField>
+
+<ParamField body="render" type="ReactElement&lt;unknown, string | JSXElementConstructor&lt;any&gt;&gt; | ComponentRenderFn&lt;HTMLProps, {}&gt;">
+ Replaces the default span. Native props, handlers, and the ref target the rendered element.
+</ParamField>
+
+<ParamField body="shape" type="&quot;circle&quot; | &quot;pill&quot;" default="pill">
+ Rounded pill label or fixed circle with width equal to its height. Use pill for longer content.
+</ParamField>
+
+<ParamField body="size" type="&quot;md&quot; | &quot;sm&quot; | &quot;xs&quot;" default="sm">
+ Compact height, font size, and spacing: xs, sm, or md.
+</ParamField>
diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/pill.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/pill.mdx
deleted file mode 100644
index 9eb748d7a53..00000000000
--- a/packages/twenty-docs/snippets/ui/generated/data-display/pill.mdx
+++ /dev/null
@@ -1,32 +0,0 @@
-{/*
- * _____ _
- *|_ _|_ _____ _ __ | |_ _ _
- * | | \ \ /\ / / _ \ '_ \| __| | | | Auto-generated file
- * | | \ V V / __/ | | | |_| |_| | DO NOT EDIT - changes will be overwritten
- * |_| \_/\_/ \___|_| |_|\__|\__, | Generated by: npx nx generate:ui twenty-docs
- * |___/
- *
- * This file is generated from the documentation data in packages/twenty-ui/generated.
- * To update it, edit the component prop types or design tokens in twenty-ui and run:
- * npx nx generate:ui twenty-docs
- */}
-
-<ParamField body="className" type="string">
- CSS class applied to the pill.
-</ParamField>
-
-<ParamField body="color" type="&quot;inherit&quot; | &quot;tertiary&quot;" default="tertiary">
- Text color. `inherit` takes the parent color and font weight on a tinted background.
-</ParamField>
-
-<ParamField body="Icon" type="IconComponent">
- Icon component rendered before the label at 12px. Import icons from `twenty-ui/icon`.
-</ParamField>
-
-<ParamField body="label" type="string">
- Short text displayed inside the pill.
-</ParamField>
-
-<ParamField body="size" type="&quot;md&quot; | &quot;sm&quot;" default="sm">
- Pill size. `md` uses a larger font, height and icon.
-</ParamField>
diff --git a/packages/twenty-docs/snippets/ui/generated/tokens.mdx b/packages/twenty-docs/snippets/ui/generated/tokens.mdx
index 04875d3bb44..0ced6c776af 100644
--- a/packages/twenty-docs/snippets/ui/generated/tokens.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/tokens.mdx
@@ -903,6 +903,7 @@
| font.color.extraLight | --t-font-color-extra-light | color(display-p3 0.8 0.8 0.8) | color(display-p3 0.298 0.298 0.298) | |
| font.color.inverted | --t-font-color-inverted | color(display-p3 1 1 1) | color(display-p3 0.09 0.09 0.09) | |
| font.color.light | --t-font-color-light | color(display-p3 0.702 0.702 0.702) | color(display-p3 0.4 0.4 0.4) | |
+| font.color.onAccent | --t-font-color-on-accent | color(display-p3 1 1 1) | color(display-p3 1 1 1) | |
| font.color.primary | --t-font-color-primary | color(display-p3 0.2 0.2 0.2) | color(display-p3 0.922 0.922 0.922) | |
| font.color.secondary | --t-font-color-secondary | color(display-p3 0.4 0.4 0.4) | color(display-p3 0.702 0.702 0.702) | |
| font.color.tertiary | --t-font-color-tertiary | color(display-p3 0.6 0.6 0.6) | color(display-p3 0.506 0.506 0.506) | |
diff --git a/packages/twenty-docs/ui/components/data-display/notification-counter.mdx b/packages/twenty-docs/ui/components/data-display/notification-counter.mdx
deleted file mode 100644
index e2d67e11046..00000000000
--- a/packages/twenty-docs/ui/components/data-display/notification-counter.mdx
+++ /dev/null
@@ -1,25 +0,0 @@
----
-title: NotificationCounter
-description: A compact numeric badge for notification counts.
----
-
-import NotificationCounterReference from '/snippets/ui/generated/components/data-display/notification-counter.mdx';
-
-`NotificationCounter` displays the supplied number without clamping it or hiding zero. Use the surrounding label to explain what the count means.
-
-```tsx
-import { NotificationCounter } from 'twenty-ui/components/data-display';
-import { Button } from 'twenty-ui/primitives/input';
-
-export const InboxButton = ({ count }: { count: number }) => (
- <Button endIcon={<NotificationCounter count={count} />}>
- Inbox ({count} unread)
- </Button>
-);
-```
-
-`variant="secondary"` changes the badge appearance. The counter has no click handler or live-region behavior of its own.
-
-## Props
-
-<NotificationCounterReference />
diff --git a/packages/twenty-docs/ui/components/overview.mdx b/packages/twenty-docs/ui/components/overview.mdx
index 0e3c6e99210..3c9778f19b0 100644
--- a/packages/twenty-docs/ui/components/overview.mdx
+++ b/packages/twenty-docs/ui/components/overview.mdx
@@ -40,14 +40,13 @@ Import from `twenty-ui/components/navigation`.
Import from `twenty-ui/components/data-display`.
-| Component | Purpose |
-| ----------------------------------------------------------------------- | --------------------------------------------------------------- |
-| [MetricRow](/ui/components/data-display/metric-row) | Labels and formatted values with optional determinate progress. |
-| [AvatarGroup](/ui/components/data-display/avatar-group) | Overlapping avatars and overflow counts. |
-| [CommandBlock](/ui/components/data-display/command-block) | Command text with an optional copy action. |
-| [JsonTree](/ui/components/data-display/json-tree) | Expandable JSON values and named entries. |
-| [NotificationCounter](/ui/components/data-display/notification-counter) | Compact numeric badges. |
-| [TintedIconTile](/ui/components/data-display/tinted-icon-tile) | Icons on theme-colored tiles. |
+| Component | Purpose |
+| -------------------------------------------------------------- | --------------------------------------------------------------- |
+| [MetricRow](/ui/components/data-display/metric-row) | Labels and formatted values with optional determinate progress. |
+| [AvatarGroup](/ui/components/data-display/avatar-group) | Overlapping avatars and overflow counts. |
+| [CommandBlock](/ui/components/data-display/command-block) | Command text with an optional copy action. |
+| [JsonTree](/ui/components/data-display/json-tree) | Expandable JSON values and named entries. |
+| [TintedIconTile](/ui/components/data-display/tinted-icon-tile) | Icons on theme-colored tiles. |
## Feedback
diff --git a/packages/twenty-docs/ui/primitives/data-display/badge.mdx b/packages/twenty-docs/ui/primitives/data-display/badge.mdx
new file mode 100644
index 00000000000..a6abb539d4f
--- /dev/null
+++ b/packages/twenty-docs/ui/primitives/data-display/badge.mdx
@@ -0,0 +1,129 @@
+---
+title: Badge
+description: Display compact inline information with caller-provided content.
+---
+
+import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
+
+import BadgeReference from '/snippets/ui/generated/data-display/badge.mdx';
+
+`Badge` displays compact inline information, including short labels and counts. Use [Tag](/ui/primitives/data-display/tag) for categories, [Chip](/ui/primitives/data-display/chip) for compact controls, or [Status](/ui/primitives/data-display/status) for a named state with an indicator.
+
+<StoryEmbed
+ storyId="ui-data-display-badge--documentation"
+ title="Badge example"
+/>
+
+## Usage
+
+```tsx
+import { Badge } from 'twenty-ui/primitives/data-display';
+
+export const PreviewLabel = () => <Badge>Preview</Badge>;
+```
+
+Pass text, numbers, or nodes as children. Badge displays the content you supply and adds no count formatting or visibility rules. The default element is a non-interactive `span`.
+
+## With an icon
+
+```tsx
+import { Badge } from 'twenty-ui/primitives/data-display';
+import { IconPaperclip } from 'twenty-ui/icon';
+
+export const AttachmentLabel = () => (
+ <Badge>
+ <IconPaperclip size={12} aria-hidden />
+ Attachment
+ </Badge>
+);
+```
+
+Icons are ordinary child nodes. Give decorative icons `aria-hidden` and keep a visible label to explain the content.
+
+## Appearance
+
+```tsx
+import { Badge } from 'twenty-ui/primitives/data-display';
+import { Text } from 'twenty-ui/primitives/typography';
+
+export const BadgeAppearances = () => (
+ <Text style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
+ <Badge size="sm" color="tertiary" shape="pill">
+ Preview
+ </Badge>
+ <Badge size="md" color="inherit">
+ In review
+ </Badge>
+ <Badge size="xs" color="primary" shape="circle">
+ 3
+ </Badge>
+ <Badge size="xs" color="secondary" shape="circle">
+ 12
+ </Badge>
+ </Text>
+);
+```
+
+`size` accepts `xs`, `sm`, or `md`. `color` accepts `tertiary`, `inherit`, `primary`, or `secondary`. `shape` accepts `pill` or `circle`. The defaults are `sm`, `tertiary`, and `pill`. The circular treatment has a fixed width equal to its height. Use `pill` for longer content, including abbreviated counts.
+
+## Counts and visibility
+
+```tsx
+import { Badge } from 'twenty-ui/primitives/data-display';
+import { Button } from 'twenty-ui/primitives/input';
+
+type InboxButtonProps = {
+ count: number;
+};
+
+export const InboxButton = ({ count }: InboxButtonProps) => (
+ <Button aria-label={`Inbox, ${count} unread messages`}>
+ Inbox
+ {count > 0 && (
+ <Badge size="xs" color="primary" shape="pill" aria-hidden>
+ {count > 99 ? '99+' : count}
+ </Badge>
+ )}
+ </Button>
+);
+```
+
+Your application owns number formatting, abbreviations, clamping, zero visibility, and translated labels. Include the full meaning in the surrounding control's accessible name when its compact count is decorative. A standalone badge can use native accessible attributes, including `aria-label` or `aria-labelledby`.
+
+## Native composition
+
+```tsx
+import { useRef } from 'react';
+import { Badge } from 'twenty-ui/primitives/data-display';
+
+export const BuildStatus = () => {
+ const badgeRef = useRef<HTMLSpanElement>(null);
+
+ return (
+ <Badge ref={badgeRef} title="Current build status" data-build="preview">
+ Preview
+ </Badge>
+ );
+};
+```
+
+Native attributes, event handlers, `className`, `style`, and `ref` target the actual root element. `render` accepts an element or callback through Base UI composition. Choose an appropriate native owner for interactive content:
+
+```tsx
+import { Badge } from 'twenty-ui/primitives/data-display';
+import { Button } from 'twenty-ui/primitives/input';
+
+export const ReleaseLink = () => (
+ <Badge render={<Button href="#release-notes" size="sm" />}>
+ Release notes
+ </Badge>
+);
+```
+
+The rendered Button owns navigation behavior and link semantics. Badge keeps its presentational default and does not infer interaction from its content.
+
+## Props
+
+Types and defaults are generated from the public `BadgeProps` type. Native attributes and event handlers are also accepted.
+
+<BadgeReference />
diff --git a/packages/twenty-docs/ui/primitives/data-display/pill.mdx b/packages/twenty-docs/ui/primitives/data-display/pill.mdx
deleted file mode 100644
index f1765faeb7e..00000000000
--- a/packages/twenty-docs/ui/primitives/data-display/pill.mdx
+++ /dev/null
@@ -1,37 +0,0 @@
----
-title: Pill
-description: Show a compact neutral label with an optional icon.
----
-
-import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
-
-import PillReference from '/snippets/ui/generated/data-display/pill.mdx';
-
-`Pill` displays a short, non-interactive label. Use [Tag](/ui/primitives/data-display/tag) for colored categories or [Status](/ui/primitives/data-display/status) for a named state with an indicator.
-
-<StoryEmbed storyId="ui-data-display-pill--default" title="Pill example" />
-
-## Usage
-
-```tsx
-import { Pill } from 'twenty-ui/primitives/data-display';
-
-export const PreviewLabel = () => <Pill label="Preview" />;
-```
-
-## With an icon
-
-```tsx
-import { Pill } from 'twenty-ui/primitives/data-display';
-import { IconPaperclip } from 'twenty-ui/icon';
-
-export const AttachmentLabel = () => (
- <Pill label="Attachment" Icon={IconPaperclip} />
-);
-```
-
-Pass the icon component to `Icon`, rather than a rendered element. Keep a visible label to explain its meaning. The component accepts `label`, `Icon`, and `className`; it does not forward click handlers, children, or native accessibility attributes. Put actions on a separate [Button](/ui/primitives/input/button).
-
-## Props
-
-<PillReference />
diff --git a/packages/twenty-docs/ui/primitives/input/button.mdx b/packages/twenty-docs/ui/primitives/input/button.mdx
index 57c3c36a18b..bd2663abc5c 100644
--- a/packages/twenty-docs/ui/primitives/input/button.mdx
+++ b/packages/twenty-docs/ui/primitives/input/button.mdx
@@ -81,10 +81,10 @@ Your application owns progress formatting and the translated label. Pass the com
## Upcoming features
-Your application owns feature availability and its label. Compose a disabled button with `Pill` as children so the label remains part of the button's accessible name. Supply localized text from your application.
+Your application owns feature availability and its label. Compose a disabled button with `Badge` as children so the label remains part of the button's accessible name. Supply localized text from your application.
```tsx
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Button } from 'twenty-ui/primitives/input';
import { Text } from 'twenty-ui/primitives/typography';
@@ -99,7 +99,7 @@ export const UpcomingAction = () => (
}}
>
Upcoming action
- <Pill label="Coming soon" />
+ <Badge>Coming soon</Badge>
</Text>
</Button>
);
diff --git a/packages/twenty-docs/ui/primitives/overview.mdx b/packages/twenty-docs/ui/primitives/overview.mdx
index dac78996b7f..3c9a053be26 100644
--- a/packages/twenty-docs/ui/primitives/overview.mdx
+++ b/packages/twenty-docs/ui/primitives/overview.mdx
@@ -94,7 +94,7 @@ Each page includes usage examples, interaction guidance, and a generated API ref
| Family | Primitives |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Accessibility | [VisuallyHidden](/ui/primitives/accessibility/visually-hidden) |
-| Data display | [Avatar](/ui/primitives/data-display/avatar), [Chip](/ui/primitives/data-display/chip), [ColorSample](/ui/primitives/data-display/color-sample), [Pill](/ui/primitives/data-display/pill), [Status](/ui/primitives/data-display/status), [Tag](/ui/primitives/data-display/tag) |
+| Data display | [Avatar](/ui/primitives/data-display/avatar), [Chip](/ui/primitives/data-display/chip), [ColorSample](/ui/primitives/data-display/color-sample), [Badge](/ui/primitives/data-display/badge), [Status](/ui/primitives/data-display/status), [Tag](/ui/primitives/data-display/tag) |
| Feedback | [Banner](/ui/primitives/feedback/banner), [Loader](/ui/primitives/feedback/loader), [ProgressBar](/ui/primitives/feedback/progress-bar), [ProgressRing](/ui/primitives/feedback/progress-ring) |
| Forms | [Button](/ui/primitives/input/button), [ButtonGroup](/ui/primitives/input/button-group), [Checkbox](/ui/primitives/input/checkbox), [Field](/ui/primitives/input/field), [Input](/ui/primitives/input/input), [InputGroup](/ui/primitives/input/input-group), [Radio](/ui/primitives/input/radio), [RadioGroup](/ui/primitives/input/radio-group), [SegmentedControl](/ui/primitives/input/segmented-control), [Select](/ui/primitives/input/select), [Slider](/ui/primitives/input/slider), [Switch](/ui/primitives/input/switch), [Textarea](/ui/primitives/input/textarea) |
| Layout | [Collapsible](/ui/primitives/layout/collapsible), [Separator](/ui/primitives/layout/separator), [ResizeHandle](/ui/primitives/layout/resize-handle), [DirectionProvider](/ui/primitives/layout/direction-provider) |
diff --git a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
index cb0e984ea64..a52d2714473 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/TwentyUiGallery.stories.tsx
@@ -1,3 +1,4 @@
+import { badgeTest } from '@/__stories__/twenty-ui-gallery/utils/badgeTest';
import { currencyPickerTest } from '@/__stories__/twenty-ui-gallery/utils/currencyPickerTest';
import { dropdownTest } from '@/__stories__/twenty-ui-gallery/utils/dropdownTest';
import { phoneCountryPickerTest } from '@/__stories__/twenty-ui-gallery/utils/phoneCountryPickerTest';
@@ -91,6 +92,18 @@ export const DataDisplayPreact: Story = createGalleryStory({
play: commandBlockTest,
});
+export const BadgeReact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-badge',
+ runtime: 'react',
+ play: badgeTest,
+});
+
+export const BadgePreact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-badge',
+ runtime: 'preact',
+ play: badgeTest,
+});
+
export const FeedbackReact: Story = createGalleryStory({
frontComponentBundleName: 'twenty-ui-feedback-gallery',
runtime: 'react',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
index 0292d5771f7..7eca9124ca7 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/README.md
@@ -21,6 +21,8 @@ Card composition checks native part props and DOM refs, customized anatomy, ordi
AvatarGroup checks derived counts, partially loaded totals, custom overflow and surviving keyed child state. Its native button and link (`target="_blank"`) verify refs, focus and pointer/keyboard activation in React and Preact.
+Badge checks ordinary node content, compact sizes, colors and circle shape. Its React and Preact fixtures keep count clamping and zero visibility in the caller, and verify native span attributes, refs and pointer handlers plus explicit button and link render composition with keyboard activation.
+
Scenarios share their checks between runtimes where behavior matches. The story
file contains the metadata and named entries; `utils/` holds the story factory,
shared assertions, render checks, interaction checks, and known-failure
@@ -43,6 +45,7 @@ effect within the interaction timeout.
| `twenty-ui-display-helpers` | Text |
| `twenty-ui-avatar-controls` | Avatar (stable presentational root, compound fallback, refs, explicit button/link composition and native keyboard/disabled behavior) |
| `twenty-ui-avatar-group` | AvatarGroup (derived and partial totals, custom overflow, keyed child state, native refs and explicit button/link composition) |
+| `twenty-ui-badge` | Badge (node content, appearance, caller-owned counts, native span refs and explicit button/link composition) |
| `twenty-ui-tag-controls` | Tag (stable presentational root, positive truncation, native spacing, node content, refs and explicit button/link composition) |
| `twenty-ui-status-controls` | Status (stable presentational root, loading/busy state, node content, refs and explicit button/link composition) |
| `twenty-ui-avatar-image` | Avatar Root/Image/Fallback (image labels/attributes/refs, loading callbacks, decoded images, fallback, replacement and unmount/remount) |
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-badge.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-badge.front-component.tsx
new file mode 100644
index 00000000000..03add8fec49
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-badge.front-component.tsx
@@ -0,0 +1,150 @@
+import { createElement, useState } from 'react';
+import { defineFrontComponent } from 'twenty-sdk/define';
+import { isDefined } from 'twenty-shared/utils';
+import { IconStar } from 'twenty-ui/icon';
+import { Badge } from 'twenty-ui/primitives/data-display';
+import { Button } from 'twenty-ui/primitives/input';
+
+import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
+
+const BadgeExample = () => {
+ const [count, setCount] = useState(3);
+ const [pointerEntries, setPointerEntries] = useState(0);
+ const [buttonActivations, setButtonActivations] = useState(0);
+ const [renderActivations, setRenderActivations] = useState(0);
+ const [linkActivations, setLinkActivations] = useState(0);
+
+ return (
+ <TwentyUiGalleryCard title="Badge content, appearance and native roots">
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'flex-start',
+ gap: 12,
+ }}
+ >
+ <Badge aria-label="Node content badge">
+ <IconStar size={12} aria-hidden="true" />
+ <strong>Node content</strong>
+ </Badge>
+ <Badge aria-label="Extra small badge" size="xs">
+ Extra small
+ </Badge>
+ <Badge aria-label="Small badge" size="sm">
+ Small
+ </Badge>
+ <Badge aria-label="Medium badge" size="md">
+ Medium
+ </Badge>
+ <Badge
+ aria-label="Primary circle badge"
+ size="xs"
+ color="primary"
+ shape="circle"
+ >
+ 3
+ </Badge>
+ <Badge
+ aria-label="Secondary circle badge"
+ size="xs"
+ color="secondary"
+ shape="circle"
+ >
+ 7
+ </Badge>
+ <span style={{ color: 'rgb(20, 80, 120)', fontWeight: 600 }}>
+ <Badge aria-label="Inherited badge" color="inherit">
+ Inherited
+ </Badge>
+ </span>
+ <Badge aria-label="Caller supplied zero">{0}</Badge>
+ {count > 0 && (
+ <Badge
+ aria-label="Unread messages"
+ size="xs"
+ color="primary"
+ shape="pill"
+ >
+ {count > 99 ? '99+' : count}
+ </Badge>
+ )}
+ <Button onClick={() => setCount(1200)}>Load large count</Button>
+ <Button onClick={() => setCount(0)}>Clear count</Button>
+ <Badge
+ id="native-badge"
+ aria-label="Native badge"
+ title="Native badge title"
+ lang="fr"
+ dir="rtl"
+ className="custom-badge"
+ style={{ marginInlineStart: 7 }}
+ onMouseEnter={() => setPointerEntries((entries) => entries + 1)}
+ ref={(element) => {
+ if (isDefined(element)) {
+ element.dataset.refTag = element.tagName;
+ }
+ }}
+ >
+ Native content
+ </Badge>
+ <Badge
+ aria-label="Open badge details"
+ render={
+ <button
+ type="button"
+ data-composed="button"
+ onClick={() =>
+ setRenderActivations((activations) => activations + 1)
+ }
+ />
+ }
+ onClick={() => setButtonActivations((activations) => activations + 1)}
+ ref={(element) => {
+ if (isDefined(element)) {
+ element.dataset.refTag = element.tagName;
+ }
+ }}
+ >
+ Details
+ </Badge>
+ <Badge
+ aria-label="Badge documentation"
+ render={(props) =>
+ createElement('a', {
+ ...props,
+ href: '#badge-docs',
+ target: '_self',
+ 'data-composed': 'link',
+ })
+ }
+ onClick={() => setLinkActivations((activations) => activations + 1)}
+ ref={(element) => {
+ if (isDefined(element)) {
+ element.dataset.refTag = element.tagName;
+ }
+ }}
+ >
+ Documentation
+ </Badge>
+ <output aria-label="Native badge pointer entries">
+ {pointerEntries}
+ </output>
+ <output aria-label="Badge button activations">
+ {buttonActivations}
+ </output>
+ <output aria-label="Rendered button activations">
+ {renderActivations}
+ </output>
+ <output aria-label="Badge link activations">{linkActivations}</output>
+ </div>
+ </TwentyUiGalleryCard>
+ );
+};
+
+export default defineFrontComponent({
+ universalIdentifier: '46ddc4e4-b0ed-4ad2-8b0c-34bdc958dc8b',
+ name: 'twenty-ui-badge',
+ description: 'Badge caller-owned content and native root composition',
+ component: BadgeExample,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
index e3e06233e89..21331744193 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-data-display-gallery.front-component.tsx
@@ -1,17 +1,14 @@
import { defineFrontComponent } from 'twenty-sdk/define';
-import {
- AvatarGroup,
- NotificationCounter,
-} from 'twenty-ui/components/data-display';
+import { AvatarGroup } from 'twenty-ui/components/data-display';
import { IconStar } from 'twenty-ui/icon';
import { CommandBlockExample } from './command-block-example';
import { TintedIconTileExample } from './tinted-icon-tile-example';
import {
Avatar,
+ Badge,
Chip,
ColorSample,
- Pill,
Status,
Tag,
} from 'twenty-ui/primitives/data-display';
@@ -82,12 +79,21 @@ const DATA_DISPLAY_ENTRIES: GalleryEntry[] = [
node: <CommandBlockExample />,
},
{
- name: 'NotificationCounter',
- node: <NotificationCounter count={3} />,
+ name: 'CountBadge',
+ node: (
+ <Badge size="xs" color="primary" shape="circle">
+ 3
+ </Badge>
+ ),
},
{
- name: 'Pill',
- node: <Pill label="Pill" Icon={IconStar} />,
+ name: 'Badge',
+ node: (
+ <Badge>
+ <IconStar size={12} />
+ Badge
+ </Badge>
+ ),
},
{
name: 'Status',
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
index 028a1b025f8..defe2882a41 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-reading-directions.front-component.tsx
@@ -1,6 +1,6 @@
import { AvatarGroup, JsonTree } from 'twenty-ui/components/data-display';
import { Callout } from 'twenty-ui/components/feedback';
-import { Avatar, Pill } from 'twenty-ui/primitives/data-display';
+import { Avatar, Badge } from 'twenty-ui/primitives/data-display';
import { Button, ButtonGroup } from 'twenty-ui/primitives/input';
import { ListItem } from 'twenty-ui/primitives/navigation';
import { Text } from 'twenty-ui/primitives/typography';
@@ -55,7 +55,7 @@ const DirectionalLayoutExample = ({
}}
>
Upcoming action
- <Pill label="Soon" />
+ <Badge>Soon</Badge>
</Text>
</Button>
{(['left', 'right'] as const).map((overlap) => (
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/badgeTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/badgeTest.ts
new file mode 100644
index 00000000000..0ff4040dff8
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/badgeTest.ts
@@ -0,0 +1,115 @@
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+
+import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
+import { expectFrontComponentMounted } from '@/__stories__/shared/test-utils/matchers/expectFrontComponentMounted';
+import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
+
+export const badgeTest: TwentyUiGalleryPlayFunction = async ({
+ canvasElement,
+}) => {
+ const canvas = within(canvasElement);
+ await expectFrontComponentMounted(canvas);
+
+ const nodeContent = canvas.getByLabelText('Node content badge');
+ expect(nodeContent.tagName).toBe('SPAN');
+ expect(within(nodeContent).getByText('Node content').tagName).toBe('STRONG');
+ expect(nodeContent.querySelector('svg')).toBeVisible();
+ expect(nodeContent).not.toHaveAttribute('role');
+ expect(nodeContent).not.toHaveAttribute('tabindex');
+
+ const extraSmall = canvas.getByLabelText('Extra small badge');
+ const small = canvas.getByLabelText('Small badge');
+ const medium = canvas.getByLabelText('Medium badge');
+ const primaryCircle = canvas.getByLabelText('Primary circle badge');
+ const secondaryCircle = canvas.getByLabelText('Secondary circle badge');
+ const inherited = canvas.getByLabelText('Inherited badge');
+
+ await waitFor(() => {
+ expect(extraSmall).toHaveStyle({ height: '14px' });
+ expect(small).toHaveStyle({ height: '16px' });
+ expect(medium).toHaveStyle({ height: '18px' });
+ expect(primaryCircle.getBoundingClientRect().width).toBe(
+ primaryCircle.getBoundingClientRect().height,
+ );
+ expect(getComputedStyle(primaryCircle).borderRadius).toBe('50%');
+ expect(getComputedStyle(primaryCircle).backgroundColor).not.toBe(
+ getComputedStyle(secondaryCircle).backgroundColor,
+ );
+ expect(getComputedStyle(small).color).not.toBe(
+ getComputedStyle(secondaryCircle).color,
+ );
+ const primaryCircleStyle = getComputedStyle(primaryCircle);
+ expect(primaryCircleStyle.color).toBe(
+ primaryCircleStyle.getPropertyValue('--t-font-color-on-accent').trim(),
+ );
+ expect(getComputedStyle(inherited).color).toBe('rgb(20, 80, 120)');
+ expect(getComputedStyle(inherited).fontWeight).toBe('600');
+ });
+ expect(small.getBoundingClientRect().width).toBeGreaterThan(
+ small.getBoundingClientRect().height,
+ );
+ expect(canvas.getByLabelText('Caller supplied zero')).toHaveTextContent('0');
+ expect(canvas.getByLabelText('Unread messages')).toHaveTextContent('3');
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Load large count' }),
+ );
+ await waitFor(() =>
+ expect(canvas.getByLabelText('Unread messages')).toHaveTextContent('99+'),
+ );
+ await userEvent.click(canvas.getByRole('button', { name: 'Clear count' }));
+ await waitFor(() =>
+ expect(canvas.queryByLabelText('Unread messages')).not.toBeInTheDocument(),
+ );
+ expect(canvas.getByLabelText('Caller supplied zero')).toHaveTextContent('0');
+
+ const nativeRoot = canvas.getByLabelText('Native badge');
+ expect(nativeRoot.tagName).toBe('SPAN');
+ expect(nativeRoot).toHaveAttribute('id', 'native-badge');
+ expect(nativeRoot).toHaveAttribute('title', 'Native badge title');
+ expect(nativeRoot).toHaveAttribute('lang', 'fr');
+ expect(nativeRoot).toHaveAttribute('dir', 'rtl');
+ expect(nativeRoot).toHaveClass('custom-badge');
+ expect(nativeRoot).toHaveStyle({ marginInlineStart: '7px' });
+ await waitFor(() =>
+ expect(nativeRoot).toHaveAttribute('data-ref-tag', 'HTML-SPAN'),
+ );
+ await userEvent.hover(nativeRoot);
+ await waitFor(() =>
+ expect(
+ canvas.getByLabelText('Native badge pointer entries'),
+ ).toHaveTextContent('1'),
+ );
+
+ const button = canvas.getByRole('button', { name: 'Open badge details' });
+ expect(button).toHaveAttribute('type', 'button');
+ expect(button).toHaveAttribute('data-composed', 'button');
+ await waitFor(() =>
+ expect(button).toHaveAttribute('data-ref-tag', 'HTML-BUTTON'),
+ );
+ await userEvent.click(button);
+ await userEvent.keyboard('{Enter} ');
+ await waitFor(() => {
+ expect(canvas.getByLabelText('Badge button activations')).toHaveTextContent(
+ '3',
+ );
+ expect(
+ canvas.getByLabelText('Rendered button activations'),
+ ).toHaveTextContent('3');
+ });
+ expect(button).toHaveFocus();
+
+ const link = canvas.getByRole('link', { name: 'Badge documentation' });
+ expect(link).toHaveAttribute('href', '#badge-docs');
+ expect(link).toHaveAttribute('target', '_self');
+ expect(link).toHaveAttribute('data-composed', 'link');
+ await waitFor(() => expect(link).toHaveAttribute('data-ref-tag', 'HTML-A'));
+ await userEvent.click(link);
+ await userEvent.keyboard('{Enter}');
+ await waitFor(() =>
+ expect(canvas.getByLabelText('Badge link activations')).toHaveTextContent(
+ '2',
+ ),
+ );
+ expect(link).toHaveFocus();
+ expect(errorHandler).not.toHaveBeenCalled();
+};
diff --git a/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts b/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts
index af97b9f8f97..064b3ead860 100644
--- a/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts
+++ b/packages/twenty-front-component-renderer/src/constants/HtmlCommonProperties.ts
@@ -3,6 +3,7 @@ import { type PropertySchema } from '@/types/PropertySchema';
export const HTML_COMMON_PROPERTIES: Record<string, PropertySchema> = {
id: { type: 'string', optional: true },
dir: { type: 'string', optional: true },
+ lang: { type: 'string', optional: true },
className: { type: 'string', optional: true },
style: { type: 'string', optional: true },
title: { type: 'string', optional: true },
diff --git a/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts b/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts
index 1a197077aca..f074964a7d5 100644
--- a/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts
+++ b/packages/twenty-front-component-renderer/src/remote/generated/remote-elements.ts
@@ -11,6 +11,7 @@ import { type SerializedEventData } from '@/types/SerializedEventData';
export type HtmlCommonProperties = {
id?: string;
dir?: string;
+ lang?: string;
className?: string;
style?: string;
title?: string;
@@ -135,6 +136,7 @@ const HTML_COMMON_EVENTS_CONFIG = Object.fromEntries(
const HTML_COMMON_PROPERTIES_CONFIG = {
id: { type: String },
dir: { type: String },
+ lang: { type: String },
className: { type: String },
style: { type: String },
title: { type: String },
diff --git a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/LastUsedPill.tsx b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/LastUsedPill.tsx
index 05d7c9d24ff..fce80e02831 100644
--- a/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/LastUsedPill.tsx
+++ b/packages/twenty-front/src/modules/auth/sign-in-up/components/internal/LastUsedPill.tsx
@@ -1,6 +1,6 @@
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { themeCssVariables } from 'twenty-ui/theme';
const StyledPillContainer = styled.span`
@@ -8,7 +8,7 @@ const StyledPillContainer = styled.span`
right: -14px;
top: -10px;
- > span {
+ > span[data-badge-size] {
background: ${themeCssVariables.accent.accent3};
border: 1px solid ${themeCssVariables.accent.accent5};
border-radius: ${themeCssVariables.border.radius.pill};
@@ -24,13 +24,13 @@ export const LastUsedPill = () => {
return (
<StyledPillContainer>
- <Pill
- label={t({
+ <Badge>
+ {t({
message: 'Last',
comment:
'Short label (keep brief) indicating the most recently used login method',
})}
- />
+ </Badge>
</StyledPillContainer>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx
index 58ffe951b43..4ab6daa4db5 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownCalendarViewContent.tsx
@@ -20,7 +20,7 @@ import {
IconChevronLeft,
IconTimelineEvent,
} from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { ViewCalendarLayout } from '~/generated-metadata/graphql';
const RECORD_CALENDAR_TIMELINE_VIEW_ID = 'record-calendar-timeline-view';
@@ -136,7 +136,7 @@ export const ObjectOptionsDropdownCalendarViewContent = () => {
aria-selected={false}
selected={false}
indicator="check"
- description={<Pill label={t`Soon`} />}
+ description={<Badge>{t`Soon`}</Badge>}
descriptionPlacement={'end'}
startIcon={<SelectOptionIcon Icon={IconTimelineEvent} />}
>{t`Timeline`}</ListItemButton>
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__tests__/ObjectOptionsDropdownCalendarViewContent.test.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__tests__/ObjectOptionsDropdownCalendarViewContent.test.tsx
index 8541793aad1..09f087f84d7 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__tests__/ObjectOptionsDropdownCalendarViewContent.test.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/__tests__/ObjectOptionsDropdownCalendarViewContent.test.tsx
@@ -91,7 +91,9 @@ jest.mock('@/views/hooks/useUpdateCurrentView', () => ({
})),
}));
jest.mock('twenty-ui/primitives/data-display', () => ({
- Pill: ({ label }: { label: string }) => <span>{label}</span>,
+ Badge: ({ children }: { children: React.ReactNode }) => (
+ <span>{children}</span>
+ ),
}));
jest.mock('twenty-ui/components/navigation', () => ({
ListItemButton: ({
diff --git a/packages/twenty-front/src/modules/object-record/record-drag/components/RecordDragMultiDragCounterChip.tsx b/packages/twenty-front/src/modules/object-record/record-drag/components/RecordDragMultiDragCounterChip.tsx
index 451c1fd3690..d064b4b3d59 100644
--- a/packages/twenty-front/src/modules/object-record/record-drag/components/RecordDragMultiDragCounterChip.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-drag/components/RecordDragMultiDragCounterChip.tsx
@@ -1,9 +1,10 @@
import { draggedRecordIdsComponentState } from '@/object-record/record-drag/states/draggedRecordIdsComponentState';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
import { styled } from '@linaria/react';
-import { NotificationCounter } from 'twenty-ui/components/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
-const StyledNotificationCounterContainer = styled.div`
+const StyledBadgeContainer = styled.div`
+ display: flex;
position: absolute;
right: -7px;
top: -7px;
@@ -20,8 +21,10 @@ export const RecordDragMultiDragCounterChip = () => {
}
return (
- <StyledNotificationCounterContainer>
- <NotificationCounter count={draggedRecordIds.length} />
- </StyledNotificationCounterContainer>
+ <StyledBadgeContainer>
+ <Badge size="xs" color="primary" shape="circle">
+ {draggedRecordIds.length}
+ </Badge>
+ </StyledBadgeContainer>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-drag/components/__stories__/RecordDragMultiDragCounterChip.stories.tsx b/packages/twenty-front/src/modules/object-record/record-drag/components/__stories__/RecordDragMultiDragCounterChip.stories.tsx
new file mode 100644
index 00000000000..2da615eef0c
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-record/record-drag/components/__stories__/RecordDragMultiDragCounterChip.stories.tsx
@@ -0,0 +1,69 @@
+import { RecordDragMultiDragCounterChip } from '@/object-record/record-drag/components/RecordDragMultiDragCounterChip';
+import { draggedRecordIdsComponentState } from '@/object-record/record-drag/states/draggedRecordIdsComponentState';
+import { RecordSelectionComponentInstanceContext } from '@/object-record/record-selection/states/contexts/RecordSelectionComponentInstanceContext';
+import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
+import { styled } from '@linaria/react';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, waitFor, within } from 'storybook/test';
+import { ComponentDecorator } from 'twenty-ui/testing';
+import { themeCssVariables } from 'twenty-ui/theme';
+
+const RECORD_SELECTION_INSTANCE_ID = 'record-drag-count-story';
+
+const StyledDragOverlay = styled.div`
+ height: ${themeCssVariables.spacing[6]};
+ position: relative;
+ width: ${themeCssVariables.spacing[6]};
+`;
+
+const meta: Meta<typeof RecordDragMultiDragCounterChip> = {
+ title: 'Modules/ObjectRecord/RecordDrag/RecordDragMultiDragCounterChip',
+ component: RecordDragMultiDragCounterChip,
+ decorators: [
+ (Story) => (
+ <RecordSelectionComponentInstanceContext.Provider
+ value={{ instanceId: RECORD_SELECTION_INSTANCE_ID }}
+ >
+ <StyledDragOverlay role="group" aria-label="Dragged records">
+ <Story />
+ </StyledDragOverlay>
+ </RecordSelectionComponentInstanceContext.Provider>
+ ),
+ ComponentDecorator,
+ ],
+ beforeEach: () => {
+ jotaiStore.set(
+ draggedRecordIdsComponentState.atomFamily({
+ instanceId: RECORD_SELECTION_INSTANCE_ID,
+ }),
+ [],
+ );
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof RecordDragMultiDragCounterChip>;
+
+export const SelectionCountPolicy: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const overlay = canvas.getByRole('group', { name: 'Dragged records' });
+ const draggedRecordIds = draggedRecordIdsComponentState.atomFamily({
+ instanceId: RECORD_SELECTION_INSTANCE_ID,
+ });
+
+ expect(overlay).toBeEmptyDOMElement();
+
+ jotaiStore.set(draggedRecordIds, ['record-1', 'record-2']);
+ await expect(await canvas.findByText('2')).toBeVisible();
+
+ jotaiStore.set(draggedRecordIds, ['record-1']);
+ await waitFor(() => expect(overlay).toBeEmptyDOMElement());
+
+ jotaiStore.set(
+ draggedRecordIds,
+ Array.from({ length: 1000 }, (_, index) => `record-${index}`),
+ );
+ await expect(await canvas.findByText('1000')).toBeVisible();
+ },
+};
diff --git a/packages/twenty-front/src/modules/onboarding/components/OnboardingCreditsRewardChip.tsx b/packages/twenty-front/src/modules/onboarding/components/OnboardingCreditsRewardChip.tsx
index 3eceba65da3..1cac40cd1ad 100644
--- a/packages/twenty-front/src/modules/onboarding/components/OnboardingCreditsRewardChip.tsx
+++ b/packages/twenty-front/src/modules/onboarding/components/OnboardingCreditsRewardChip.tsx
@@ -1,6 +1,6 @@
import { useLingui } from '@lingui/react/macro';
import { IconCoins } from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
type OnboardingCreditsRewardChipProps = {
formattedCreditsReward: string;
@@ -14,15 +14,11 @@ export const OnboardingCreditsRewardChip = ({
const { t } = useLingui();
return (
- <Pill
- Icon={IconCoins}
- label={
- isRewardPerItem
- ? t`+${formattedCreditsReward} each`
- : `+${formattedCreditsReward}`
- }
- size="md"
- color="inherit"
- />
+ <Badge size="md" color="inherit">
+ <IconCoins size={12} aria-hidden />
+ {isRewardPerItem
+ ? t`+${formattedCreditsReward} each`
+ : `+${formattedCreditsReward}`}
+ </Badge>
);
};
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
index 69b4de368a6..fab8701bca0 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsCard.tsx
@@ -5,7 +5,7 @@ import { t } from '@lingui/core/macro';
import { type ReactNode } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconChevronRight } from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Card } from 'twenty-ui/primitives/surfaces';
import { useTheme, themeCssVariables } from 'twenty-ui/theme';
@@ -136,7 +136,7 @@ export const SettingsCard = ({
</StyledIconContainer>
<StyledTitle disabled={disabled}>
{title}
- {soon && <Pill label={t`Soon`} />}
+ {soon && <Badge>{t`Soon`}</Badge>}
</StyledTitle>
{isDefined(Status) && Status}
<StyledIconChevronRightContainer>
diff --git a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx
index 81687fa6f8d..a4a48b3db67 100644
--- a/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx
+++ b/packages/twenty-front/src/modules/settings/mcp-and-apis/components/SettingsMcpSetupCard.tsx
@@ -4,7 +4,7 @@ import { isDefined } from 'twenty-shared/utils';
import { type McpSetupCard } from '@/settings/mcp-and-apis/types/McpSetup';
import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';
import { IconExternalLink } from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Card, Tooltip } from 'twenty-ui/primitives/surfaces';
import { themeCssVariables, useTheme } from 'twenty-ui/theme';
@@ -151,7 +151,7 @@ export const SettingsMcpSetupCard = ({ card }: SettingsMcpSetupCardProps) => (
<StyledBody>
<StyledHeader>
<StyledTitle>{card.title}</StyledTitle>
- <Pill label={card.badge} />
+ <Badge>{card.badge}</Badge>
<StyledActionSlot>
<SettingsMcpSetupCardAction card={card} />
</StyledActionSlot>
diff --git a/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx b/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx
index 1e51a79ef4a..f8132a1bd68 100644
--- a/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/tab-list/utils/getTabListItemContent.tsx
@@ -1,6 +1,6 @@
import { isNonEmptyString, isString } from '@sniptt/guards';
import { isDefined } from 'twenty-shared/utils';
-import { Avatar, Pill } from 'twenty-ui/primitives/data-display';
+import { Avatar, Badge } from 'twenty-ui/primitives/data-display';
import { type SingleTabProps } from '@/ui/layout/tab-list/types/SingleTabProps';
@@ -19,5 +19,5 @@ export const getTabListItemContent = ({
)}
</>
) : undefined,
- badge: isString(pill) ? <Pill label={pill} /> : pill,
+ badge: isString(pill) ? <Badge>{pill}</Badge> : pill,
});
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
index 8a23a98807c..e7ce7d14b19 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
@@ -18,7 +18,7 @@ import { t } from '@lingui/core/macro';
import { useContext } from 'react';
import { Link } from 'react-router-dom';
import { isAbsoluteUrl, isDefined } from 'twenty-shared/utils';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
import {
Shortcut,
@@ -390,13 +390,13 @@ export const NavigationDrawerItem = ({
{isSoon && (
<NavigationDrawerAnimatedCollapseWrapper>
- <Pill label={t`Soon`} />
+ <Badge>{t`Soon`}</Badge>
</NavigationDrawerAnimatedCollapseWrapper>
)}
{isNew && (
<NavigationDrawerAnimatedCollapseWrapper>
- <Pill label={t`New`} />
+ <Badge>{t`New`}</Badge>
</NavigationDrawerAnimatedCollapseWrapper>
)}
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
index e22b4261d08..fd2909e0d1f 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawerItem.stories.tsx
@@ -95,11 +95,11 @@ export const Breadcrumb: Story = {
],
};
-export const NewPill: Story = {
+export const NewBadge: Story = {
decorators: [
(Story) => (
<StyledContainer>
- <h1>New Pill Examples</h1>
+ <h1>New Badge Examples</h1>
<Story
args={{
label: 'New Feature',
diff --git a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx
index 6954c95f026..e48dcd33e24 100644
--- a/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx
+++ b/packages/twenty-front/src/modules/views/components/ViewBarFilterDropdownAdvancedFilterButton.tsx
@@ -27,12 +27,12 @@ import { flushSync } from 'react-dom';
import { RecordFilterGroupLogicalOperator } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import { IconFilter } from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { themeCssVariables } from 'twenty-ui/theme';
import { v4 } from 'uuid';
-const StyledPillContainer = styled.span`
- & > span {
+const StyledBadgeContainer = styled.span`
+ > span[data-badge-size] {
background: ${themeCssVariables.color.blue3};
color: ${themeCssVariables.color.blue};
}
@@ -155,9 +155,9 @@ export const ViewBarFilterDropdownAdvancedFilterButton = () => {
focused={isSelectedItemId}
endIcon={
advancedFilterQuerySubFilterCount > 0 ? (
- <StyledPillContainer>
- <Pill label={advancedFilterQuerySubFilterCount.toString()} />
- </StyledPillContainer>
+ <StyledBadgeContainer>
+ <Badge>{advancedFilterQuerySubFilterCount.toString()}</Badge>
+ </StyledBadgeContainer>
) : undefined
}
>{t`Advanced filter`}</ListItemButton>
diff --git a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
index 79c61f80295..46dcc6914b4 100644
--- a/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
+++ b/packages/twenty-front/src/modules/views/components/__stories__/ViewBarFilterDropdown.stories.tsx
@@ -285,8 +285,13 @@ export const AdvancedFilterCountBadge: Story = {
expect(advancedFilterButton).toBeVisible();
- const pillBadge = await canvas.findByText('3');
-
- expect(pillBadge).toBeVisible();
+ const badge = await canvas.findByText('3');
+ const badgeStyle = getComputedStyle(badge);
+
+ await expect(badge).toBeVisible();
+ await expect(badge).toHaveStyle({
+ backgroundColor: badgeStyle.getPropertyValue('--t-color-blue3'),
+ color: badgeStyle.getPropertyValue('--t-color-blue'),
+ });
},
};
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
index 23148f630b0..8c8dcdec80d 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsApplicationVariableLabelRow.tsx
@@ -3,7 +3,7 @@ import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { IconInfoCircle } from 'twenty-ui/icon';
-import { Pill } from 'twenty-ui/primitives/data-display';
+import { Badge } from 'twenty-ui/primitives/data-display';
import { Tooltip } from 'twenty-ui/primitives/surfaces';
import { useTheme, themeCssVariables } from 'twenty-ui/theme';
@@ -39,7 +39,7 @@ export const SettingsApplicationVariableLabelRow = ({
return (
<StyledLabelRow>
<StyledLabel>{isNonEmptyString(label) ? label : variableKey}</StyledLabel>
- {isDeprecated && <Pill label={t`Deprecated`} />}
+ {isDeprecated && <Badge>{t`Deprecated`}</Badge>}
{isNonEmptyString(description) && (
<Tooltip
content={description}
diff --git a/packages/twenty-shared/src/constants/DocumentationPaths.ts b/packages/twenty-shared/src/constants/DocumentationPaths.ts
index cac46fa3b4b..bc75dd6b936 100644
--- a/packages/twenty-shared/src/constants/DocumentationPaths.ts
+++ b/packages/twenty-shared/src/constants/DocumentationPaths.ts
@@ -139,8 +139,6 @@ export const DOCUMENTATION_PATHS = {
UI_COMPONENTS_DATA_DISPLAY_JSON_TREE: '/ui/components/data-display/json-tree',
UI_COMPONENTS_DATA_DISPLAY_METRIC_ROW:
'/ui/components/data-display/metric-row',
- UI_COMPONENTS_DATA_DISPLAY_NOTIFICATION_COUNTER:
- '/ui/components/data-display/notification-counter',
UI_COMPONENTS_DATA_DISPLAY_TINTED_ICON_TILE:
'/ui/components/data-display/tinted-icon-tile',
UI_COMPONENTS_FEEDBACK_CALLOUT: '/ui/components/feedback/callout',
@@ -176,10 +174,10 @@ export const DOCUMENTATION_PATHS = {
UI_PRIMITIVES_ACCESSIBILITY_VISUALLY_HIDDEN:
'/ui/primitives/accessibility/visually-hidden',
UI_PRIMITIVES_DATA_DISPLAY_AVATAR: '/ui/primitives/data-display/avatar',
+ UI_PRIMITIVES_DATA_DISPLAY_BADGE: '/ui/primitives/data-display/badge',
UI_PRIMITIVES_DATA_DISPLAY_CHIP: '/ui/primitives/data-display/chip',
UI_PRIMITIVES_DATA_DISPLAY_COLOR_SAMPLE:
'/ui/primitives/data-display/color-sample',
- UI_PRIMITIVES_DATA_DISPLAY_PILL: '/ui/primitives/data-display/pill',
UI_PRIMITIVES_DATA_DISPLAY_STATUS: '/ui/primitives/data-display/status',
UI_PRIMITIVES_DATA_DISPLAY_TAG: '/ui/primitives/data-display/tag',
UI_PRIMITIVES_FEEDBACK_BANNER: '/ui/primitives/feedback/banner',
diff --git a/packages/twenty-ui/design-tokens/font.ts b/packages/twenty-ui/design-tokens/font.ts
index c8c50d0e6ca..6d6481086fd 100644
--- a/packages/twenty-ui/design-tokens/font.ts
+++ b/packages/twenty-ui/design-tokens/font.ts
@@ -9,6 +9,7 @@ export const FONT_TOKENS = {
light: GRAY_SCALE_TOKENS.gray8,
extraLight: GRAY_SCALE_TOKENS.gray7,
inverted: GRAY_SCALE_TOKENS.gray1,
+ onAccent: token('color(display-p3 1 1 1)'),
danger: COLOR_TOKENS.red,
},
size: {
diff --git a/packages/twenty-ui/docs/badgePropDescriptions.ts b/packages/twenty-ui/docs/badgePropDescriptions.ts
new file mode 100644
index 00000000000..1f853b58ac3
--- /dev/null
+++ b/packages/twenty-ui/docs/badgePropDescriptions.ts
@@ -0,0 +1,12 @@
+import { type BadgeProps } from '../src/primitives/data-display/Badge/types/BadgeProps';
+
+export const BADGE_PROP_DESCRIPTIONS = {
+ children: 'Caller-provided text, numbers, icons, or other inline content.',
+ size: 'Compact height, font size, and spacing: xs, sm, or md.',
+ color:
+ 'Neutral tertiary, inherited text, primary accent, or secondary treatment.',
+ shape:
+ 'Rounded pill label or fixed circle with width equal to its height. Use pill for longer content.',
+ render:
+ 'Replaces the default span. Native props, handlers, and the ref target the rendered element.',
+} satisfies Partial<Record<keyof BadgeProps, string>>;
diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.ts
index 419b6e63484..b433cffaae6 100644
--- a/packages/twenty-ui/docs/components.ts
+++ b/packages/twenty-ui/docs/components.ts
@@ -11,7 +11,6 @@ import { PROGRESS_RING_PROP_DESCRIPTIONS } from './progressRingPropDescriptions'
import { AVATAR_GROUP_PROP_DESCRIPTIONS } from './avatarGroupPropDescriptions';
import { COMMAND_BLOCK_PROP_DESCRIPTIONS } from './commandBlockPropDescriptions';
import { JSON_TREE_PROP_DESCRIPTIONS } from './jsonTreePropDescriptions';
-import { NOTIFICATION_COUNTER_PROP_DESCRIPTIONS } from './notificationCounterPropDescriptions';
import { TINTED_ICON_TILE_PROP_DESCRIPTIONS } from './tintedIconTilePropDescriptions';
import { CALLOUT_PROP_DESCRIPTIONS } from './calloutPropDescriptions';
import { INLINE_BANNER_PROP_DESCRIPTIONS } from './inlineBannerPropDescriptions';
@@ -63,7 +62,7 @@ import { LIGHT_ICON_BUTTON_PROP_DESCRIPTIONS } from './lightIconButtonPropDescri
import { LOADER_PROP_DESCRIPTIONS } from './loaderPropDescriptions';
import { SKELETON_PROP_DESCRIPTIONS } from './skeletonPropDescriptions';
import { OVERFLOWING_TEXT_WITH_TOOLTIP_PROP_DESCRIPTIONS } from './overflowingTextWithTooltipPropDescriptions';
-import { PILL_PROP_DESCRIPTIONS } from './pillPropDescriptions';
+import { BADGE_PROP_DESCRIPTIONS } from './badgePropDescriptions';
import { PROGRESS_BAR_PROP_DESCRIPTIONS } from './progressBarPropDescriptions';
import { RESIZE_HANDLE_PROP_DESCRIPTIONS } from './resizeHandlePropDescriptions';
import { SECTION_HEADER_PROP_DESCRIPTIONS } from './sectionHeaderPropDescriptions';
@@ -151,11 +150,13 @@ export const DOCUMENTED_COMPONENTS = [
propDescriptions: COLOR_SAMPLE_PROP_DESCRIPTIONS,
},
{
- name: 'Pill',
- source: 'primitives/data-display/Pill/Pill.tsx',
+ name: 'Badge',
+ nativeProps: 'span',
+ source: 'primitives/data-display/Badge/Badge.tsx',
entryPoint: 'twenty-ui/primitives/data-display',
- slug: 'data-display/pill',
- propDescriptions: PILL_PROP_DESCRIPTIONS,
+ slug: 'data-display/badge',
+ propDescriptions: BADGE_PROP_DESCRIPTIONS,
+ propDefaults: { size: 'sm', color: 'tertiary', shape: 'pill' },
},
{
name: 'Banner',
@@ -801,14 +802,6 @@ export const DOCUMENTED_COMPONENTS = [
slug: 'components/data-display/json-tree',
propDescriptions: JSON_TREE_PROP_DESCRIPTIONS,
},
- {
- name: 'NotificationCounter',
- source:
- 'components/data-display/NotificationCounter/NotificationCounter.tsx',
- entryPoint: 'twenty-ui/components/data-display',
- slug: 'components/data-display/notification-counter',
- propDescriptions: NOTIFICATION_COUNTER_PROP_DESCRIPTIONS,
- },
{
name: 'TintedIconTile',
source: 'components/data-display/TintedIconTile/TintedIconTile.tsx',
diff --git a/packages/twenty-ui/docs/label-ownership.md b/packages/twenty-ui/docs/label-ownership.md
index 168593499af..29a90bef198 100644
--- a/packages/twenty-ui/docs/label-ownership.md
+++ b/packages/twenty-ui/docs/label-ownership.md
@@ -2,27 +2,27 @@
This covers production exports under components, primitives, and icons, including the Dropdown compound API.
-| Surface | Text ownership |
-| --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Callout | `title`, `description`, `icon`, and `action` nodes, plus `closeLabel` (default `Close`). The optional `onDismiss` requests caller-owned visibility changes. |
-| ListItem and Menu item parts | Children, description, action slots, native accessible attributes, and `shortcutJoinLabel` (default `then`). |
-| ListItemButton | Children, description, native accessible attributes, and `shortcutJoinLabel` (default `then`). Independent actions remain sibling controls. |
-| Dropdown | Children name actions, options, titles, sections, empty states, and loading states. `Back` children default to `Back`. Search accepts native placeholder and accessible attributes. Close requires a caller-supplied accessible label and accepts native `aria-labelledby`. Item parts pass `shortcutJoinLabel` to ListItem. |
-| CurrencyPicker | `searchLabel` defaults to `Search` and supplies the search placeholder and accessible name. `emptyLabel` defaults to `No results`. Currency names and codes are caller data; trigger and dropdown accessible names belong to the host. |
-| Legacy menu compositions | MenuItem exposes `text`, contextual slots, and `shortcutJoinLabel` (default `then`). Avatar, draggable, suggestion, and picker presets receive their text from callers; they add no English fallback. Keep this additive option until their separate migration removes the exports. |
-| Button, MainButton, LightButton | Children and native accessible attributes. Applications compose upcoming-feature labels with Pill. Loading preserves the supplied name and marks the button busy; its spinner is decorative. Button hints use the shared Shortcut presentation and remain decorative. `shortcutJoinLabel` supplies the sequence join label. |
-| IconButton and LightIconButton | Caller-supplied accessible label and optional tooltip. Native `aria-labelledby` remains available and takes precedence. |
-| SearchInput | Caller-owned placeholder and native accessible name; `filterButtonAriaLabel` defaults to `Filter`. Referenced labels take precedence over explicit labels and placeholder fallback. |
-| CountrySelect | `searchLabel`, `noCountryLabel`, and `noResultsLabel` default to `Search`, `No country`, and `No results`. The search label names the search input and is its placeholder. Applications supply `label` or native accessible names and the country labels, including translated strings. |
-| PhoneCountryPicker | Callers supply country labels and the trigger accessible name. The popup takes the trigger name unless a `Dropdown.Title` or an explicit `Dropdown.Content` label names it, and the selected country label describes the trigger. `searchLabel` defaults to `Search`; `emptyLabel` defaults to `No results`. Calling codes are supplied as data without a leading plus sign. |
-| ImageInput | `uploadLabel`, `removeLabel`, and `abortLabel` default to `Upload`, `Remove`, and `Abort`. The upload label names the visible upload button, preview button, and hidden file input. Native accessible attributes can supply names and descriptions for the file input. Applications supply `helperText` and `errorMessage`, including validation instructions and translated strings. |
-| Toast and Toaster | Children, description and action slots, `iconLabel`, `cancelLabel` (default `Cancel`), and `closeLabel` (default `Close`). Toaster accepts native accessible attributes over its `Notifications` region default. |
-| Chip and Avatar | Chip content, translated fallbacks and interactive accessible names belong to the caller. Missing children add no label. Avatar's image and default fallback are decorative. `name` supplies the visual initial and colors. Explicit `imageProps.alt` labels the image and default fallback; caller fallback semantics take precedence. Composed buttons and links own their labels and interaction handlers. |
-| JsonTree | Callers supply empty string, array, and object labels and expanded/collapsed arrow names. JSON booleans, null, property names, and values are data. |
-| ResizeHandle and CodeEditor | ResizeHandle accepts native labels over `Resize`. Hosts supply a contextual label, `aria-controls`, and the focus destination when collapsing a panel removes its handle. CodeEditor exposes `resizeLabel` (default `Resize editor`) and Monaco `options`, including its editor accessible label. The loading indicator adds no text. Monaco owns its internal editor messages. |
-| Input, Textarea, Select, Field, Slider, Radio, RadioGroup, Checkbox, Switch, SegmentedControl | Native attributes, compound label/description/error parts, options, and children belong to the caller. Browser validation messages remain browser-owned; Field.Error children or render content can replace them. |
-| Dialog, AlertDialog, Popover, Tooltip, Tabs | Text belongs to title, description, close, trigger, tab, and popup parts. No built-in English action or status strings. |
-| Banner, InlineBanner, SettingsRow, Section, CommandBlock | Content and labels belong to supplied props or children. |
-| Tag, Status, Pill, AvatarGroup, NotificationCounter, ColorSample, TintedIconTile, typography, layout and icon exports | Caller content, data values, native accessible attributes where supported, or decorative output. Loader and progress graphics add no built-in English loading message. |
+| Surface | Text ownership |
+| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Callout | `title`, `description`, `icon`, and `action` nodes, plus `closeLabel` (default `Close`). The optional `onDismiss` requests caller-owned visibility changes. |
+| ListItem and Menu item parts | Children, description, action slots, native accessible attributes, and `shortcutJoinLabel` (default `then`). |
+| ListItemButton | Children, description, native accessible attributes, and `shortcutJoinLabel` (default `then`). Independent actions remain sibling controls. |
+| Dropdown | Children name actions, options, titles, sections, empty states, and loading states. `Back` children default to `Back`. Search accepts native placeholder and accessible attributes. Close requires a caller-supplied accessible label and accepts native `aria-labelledby`. Item parts pass `shortcutJoinLabel` to ListItem. |
+| CurrencyPicker | `searchLabel` defaults to `Search` and supplies the search placeholder and accessible name. `emptyLabel` defaults to `No results`. Currency names and codes are caller data; trigger and dropdown accessible names belong to the host. |
+| Legacy menu compositions | MenuItem exposes `text`, contextual slots, and `shortcutJoinLabel` (default `then`). Avatar, draggable, suggestion, and picker presets receive their text from callers; they add no English fallback. Keep this additive option until their separate migration removes the exports. |
+| Button, MainButton, LightButton | Children and native accessible attributes. Applications compose upcoming-feature labels with Badge. Loading preserves the supplied name and marks the button busy; its spinner is decorative. Button hints use the shared Shortcut presentation and remain decorative. `shortcutJoinLabel` supplies the sequence join label. |
+| IconButton and LightIconButton | Caller-supplied accessible label and optional tooltip. Native `aria-labelledby` remains available and takes precedence. |
+| SearchInput | Caller-owned placeholder and native accessible name; `filterButtonAriaLabel` defaults to `Filter`. Referenced labels take precedence over explicit labels and placeholder fallback. |
+| CountrySelect | `searchLabel`, `noCountryLabel`, and `noResultsLabel` default to `Search`, `No country`, and `No results`. The search label names the search input and is its placeholder. Applications supply `label` or native accessible names and the country labels, including translated strings. |
+| PhoneCountryPicker | Callers supply country labels and the trigger accessible name. The popup takes the trigger name unless a `Dropdown.Title` or an explicit `Dropdown.Content` label names it, and the selected country label describes the trigger. `searchLabel` defaults to `Search`; `emptyLabel` defaults to `No results`. Calling codes are supplied as data without a leading plus sign. |
+| ImageInput | `uploadLabel`, `removeLabel`, and `abortLabel` default to `Upload`, `Remove`, and `Abort`. The upload label names the visible upload button, preview button, and hidden file input. Native accessible attributes can supply names and descriptions for the file input. Applications supply `helperText` and `errorMessage`, including validation instructions and translated strings. |
+| Toast and Toaster | Children, description and action slots, `iconLabel`, `cancelLabel` (default `Cancel`), and `closeLabel` (default `Close`). Toaster accepts native accessible attributes over its `Notifications` region default. |
+| Chip and Avatar | Chip content, translated fallbacks and interactive accessible names belong to the caller. Missing children add no label. Avatar's image and default fallback are decorative. `name` supplies the visual initial and colors. Explicit `imageProps.alt` labels the image and default fallback; caller fallback semantics take precedence. Composed buttons and links own their labels and interaction handlers. |
+| JsonTree | Callers supply empty string, array, and object labels and expanded/collapsed arrow names. JSON booleans, null, property names, and values are data. |
+| ResizeHandle and CodeEditor | ResizeHandle accepts native labels over `Resize`. Hosts supply a contextual label, `aria-controls`, and the focus destination when collapsing a panel removes its handle. CodeEditor exposes `resizeLabel` (default `Resize editor`) and Monaco `options`, including its editor accessible label. The loading indicator adds no text. Monaco owns its internal editor messages. |
+| Input, Textarea, Select, Field, Slider, Radio, RadioGroup, Checkbox, Switch, SegmentedControl | Native attributes, compound label/description/error parts, options, and children belong to the caller. Browser validation messages remain browser-owned; Field.Error children or render content can replace them. |
+| Dialog, AlertDialog, Popover, Tooltip, Tabs | Text belongs to title, description, close, trigger, tab, and popup parts. No built-in English action or status strings. |
+| Banner, InlineBanner, SettingsRow, Section, CommandBlock | Content and labels belong to supplied props or children. |
+| Tag, Status, Badge, AvatarGroup, ColorSample, TintedIconTile, typography, layout and icon exports | Caller content, data values, native accessible attributes where supported, or decorative output. Applications own badge count formatting, clamping, zero visibility, and translated labels. Loader and progress graphics add no built-in English loading message. |
Shortcut owns symbol and separator formatting for visual hints and strings. Flat key arrays represent simultaneous combinations; nested key arrays represent ordered sequences of combinations. Hosts supply `sequenceJoinLabel` (default `then`), optional `combinationSeparator`, and native accessible labels. The `shortcutJoinLabel` props on host controls forward the sequence label.
diff --git a/packages/twenty-ui/docs/module-ownership.json b/packages/twenty-ui/docs/module-ownership.json
index 529041dad8e..1812eeddaae 100644
--- a/packages/twenty-ui/docs/module-ownership.json
+++ b/packages/twenty-ui/docs/module-ownership.json
@@ -3,6 +3,7 @@
"AlertDialog",
"Autocomplete",
"Avatar",
+ "Badge",
"Banner",
"Breadcrumb",
"Button",
@@ -23,7 +24,6 @@
"Menu",
"NumberStepper",
"OverflowingTextWithTooltip",
- "Pill",
"Popover",
"ProgressBar",
"ProgressRing",
@@ -69,7 +69,6 @@
"MenuItemSuggestion",
"MenuPicker",
"MetricRow",
- "NotificationCounter",
"OverflowingList",
"PhoneCountryPicker",
"SearchInput",
diff --git a/packages/twenty-ui/docs/notificationCounterPropDescriptions.ts b/packages/twenty-ui/docs/notificationCounterPropDescriptions.ts
deleted file mode 100644
index 3f482c8e7cc..00000000000
--- a/packages/twenty-ui/docs/notificationCounterPropDescriptions.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { type ComponentProps } from 'react';
-
-import { type NotificationCounter } from '../src/components/data-display/NotificationCounter/NotificationCounter';
-
-export const NOTIFICATION_COUNTER_PROP_DESCRIPTIONS = {
- count: 'Number to display as supplied, without clamping or hiding zero.',
- variant: 'Primary or secondary badge styling.',
- className: 'Class applied to the badge.',
-} satisfies Partial<
- Record<keyof ComponentProps<typeof NotificationCounter>, string>
->;
diff --git a/packages/twenty-ui/docs/pillPropDescriptions.ts b/packages/twenty-ui/docs/pillPropDescriptions.ts
deleted file mode 100644
index 9253f54fdc5..00000000000
--- a/packages/twenty-ui/docs/pillPropDescriptions.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { type ComponentProps } from 'react';
-
-import { type Pill } from '../src/primitives/data-display/Pill/Pill';
-
-export const PILL_PROP_DESCRIPTIONS = {
- label: 'Short text displayed inside the pill.',
- Icon: 'Icon component rendered before the label at 12px. Import icons from `twenty-ui/icon`.',
- className: 'CSS class applied to the pill.',
- size: 'Pill size. `md` uses a larger font, height and icon.',
- color:
- 'Text color. `inherit` takes the parent color and font weight on a tinted background.',
-} satisfies Partial<Record<keyof ComponentProps<typeof Pill>, string>>;
diff --git a/packages/twenty-ui/docs/public-exports.json b/packages/twenty-ui/docs/public-exports.json
index e2e08793ded..017cb827655 100644
--- a/packages/twenty-ui/docs/public-exports.json
+++ b/packages/twenty-ui/docs/public-exports.json
@@ -40,7 +40,6 @@
"getIconTileColorShades": "components/data-display/TintedIconTile/utils/getIconTileColorShades",
"JsonTree": "components/data-display/JsonTree/JsonTree",
"MetricRow": "components/data-display/MetricRow/MetricRow",
- "NotificationCounter": "components/data-display/NotificationCounter/NotificationCounter",
"TintedIconTile": "components/data-display/TintedIconTile/TintedIconTile"
},
"types": {
@@ -723,9 +722,9 @@
"values": {
"Avatar": "primitives/data-display/Avatar/Avatar",
"AVATAR_PROPERTIES_BY_SIZE": "primitives/data-display/Avatar/constants/AvatarPropertiesBySize",
+ "Badge": "primitives/data-display/Badge/Badge",
"Chip": "primitives/data-display/Chip/Chip",
"ColorSample": "primitives/data-display/ColorSample/ColorSample",
- "Pill": "primitives/data-display/Pill/Pill",
"Status": "primitives/data-display/Status/Status",
"Tag": "primitives/data-display/Tag/Tag"
},
@@ -740,6 +739,10 @@
"AvatarRootState": "primitives/data-display/Avatar/types/AvatarRootState",
"AvatarShape": "primitives/data-display/Avatar/types/AvatarShape",
"AvatarSize": "primitives/data-display/Avatar/types/AvatarSize",
+ "BadgeColor": "primitives/data-display/Badge/types/BadgeColor",
+ "BadgeProps": "primitives/data-display/Badge/types/BadgeProps",
+ "BadgeShape": "primitives/data-display/Badge/types/BadgeShape",
+ "BadgeSize": "primitives/data-display/Badge/types/BadgeSize",
"ChipProps": "primitives/data-display/Chip/types/ChipProps",
"ChipSize": "primitives/data-display/Chip/types/ChipSize",
"ChipVariant": "primitives/data-display/Chip/types/ChipVariant",
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index 6ae33d60e8d..31483f51f3a 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -529,44 +529,44 @@
]
},
{
- "name": "Pill",
+ "name": "Badge",
"entryPoint": "twenty-ui/primitives/data-display",
- "slug": "data-display/pill",
+ "slug": "data-display/badge",
"props": [
{
- "name": "className",
- "type": "string",
+ "name": "children",
+ "type": "ReactNode",
"required": false,
"defaultValue": null,
- "description": "CSS class applied to the pill."
+ "description": "Caller-provided text, numbers, icons, or other inline content."
},
{
"name": "color",
- "type": "\"inherit\" | \"tertiary\"",
+ "type": "\"inherit\" | \"primary\" | \"secondary\" | \"tertiary\"",
"required": false,
"defaultValue": "tertiary",
- "description": "Text color. `inherit` takes the parent color and font weight on a tinted background."
+ "description": "Neutral tertiary, inherited text, primary accent, or secondary treatment."
},
{
- "name": "Icon",
- "type": "IconComponent",
+ "name": "render",
+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",
"required": false,
"defaultValue": null,
- "description": "Icon component rendered before the label at 12px. Import icons from `twenty-ui/icon`."
+ "description": "Replaces the default span. Native props, handlers, and the ref target the rendered element."
},
{
- "name": "label",
- "type": "string",
+ "name": "shape",
+ "type": "\"circle\" | \"pill\"",
"required": false,
- "defaultValue": null,
- "description": "Short text displayed inside the pill."
+ "defaultValue": "pill",
+ "description": "Rounded pill label or fixed circle with width equal to its height. Use pill for longer content."
},
{
"name": "size",
- "type": "\"md\" | \"sm\"",
+ "type": "\"md\" | \"sm\" | \"xs\"",
"required": false,
"defaultValue": "sm",
- "description": "Pill size. `md` uses a larger font, height and icon."
+ "description": "Compact height, font size, and spacing: xs, sm, or md."
}
]
},
@@ -11747,34 +11747,6 @@
}
]
},
- {
- "name": "NotificationCounter",
- "entryPoint": "twenty-ui/components/data-display",
- "slug": "components/data-display/notification-counter",
- "props": [
- {
- "name": "className",
- "type": "string",
- "required": false,
- "defaultValue": null,
- "description": "Class applied to the badge."
- },
- {
- "name": "count",
- "type": "number",
- "required": true,
- "defaultValue": null,
- "description": "Number to display as supplied, without clamping or hiding zero."
- },
- {
- "name": "variant",
- "type": "\"primary\" | \"secondary\"",
- "required": false,
- "defaultValue": "primary",
- "description": "Primary or secondary badge styling."
- }
- ]
- },
{
"name": "TintedIconTile",
"entryPoint": "twenty-ui/components/data-display",
diff --git a/packages/twenty-ui/generated/tokens.docs.json b/packages/twenty-ui/generated/tokens.docs.json
index dd1a0c72e38..6ce384ffca5 100644
--- a/packages/twenty-ui/generated/tokens.docs.json
+++ b/packages/twenty-ui/generated/tokens.docs.json
@@ -5830,6 +5830,13 @@
"dark": "color(display-p3 0.4 0.4 0.4)",
"isNumber": false
},
+ {
+ "path": "font.color.onAccent",
+ "cssVariable": "--t-font-color-on-accent",
+ "light": "color(display-p3 1 1 1)",
+ "dark": "color(display-p3 1 1 1)",
+ "isNumber": false
+ },
{
"path": "font.color.primary",
"cssVariable": "--t-font-color-primary",
diff --git a/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx b/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
index 2a5d72e54ca..15a395bd2c3 100644
--- a/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
+++ b/packages/twenty-ui/src/components/__stories__/reading-direction/DirectionalLayoutExample.tsx
@@ -1,5 +1,5 @@
import { AvatarGroup, Callout, JsonTree } from '@ui/components';
-import { Avatar, Pill } from '@ui/primitives/data-display';
+import { Avatar, Badge } from '@ui/primitives/data-display';
import {
Button,
ButtonGroup,
@@ -63,7 +63,7 @@ export const DirectionalLayoutExample = ({
}}
>
Upcoming action
- <Pill label="Soon" />
+ <Badge>Soon</Badge>
</Text>
</Button>
<SegmentedControl
diff --git a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss b/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss
deleted file mode 100644
index b7a95a14c0c..00000000000
--- a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss
+++ /dev/null
@@ -1,21 +0,0 @@
-.notificationCounter {
- width: 14px;
- height: 14px;
- border-radius: 50%;
- corner-shape: round;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: var(--t-font-size-xxs);
- font-weight: var(--t-font-weight-semi-bold);
-}
-
-.primary {
- background: var(--t-color-blue);
- color: white;
-}
-
-.secondary {
- background: var(--t-background-transparent-light);
- color: var(--t-font-color-secondary);
-}
diff --git a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss.d.ts b/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss.d.ts
deleted file mode 100644
index 126e4c25778..00000000000
--- a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.module.scss.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-declare const classNames: {
- readonly notificationCounter: 'notificationCounter';
- readonly primary: 'primary';
- readonly secondary: 'secondary';
-};
-export default classNames;
diff --git a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.tsx b/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.tsx
deleted file mode 100644
index 17d9ff2abfd..00000000000
--- a/packages/twenty-ui/src/components/data-display/NotificationCounter/NotificationCounter.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { clsx } from 'clsx';
-
-import styles from './NotificationCounter.module.scss';
-
-type NotificationCounterProps = {
- count: number;
- variant?: 'primary' | 'secondary';
- className?: string;
-};
-
-export const NotificationCounter = ({
- count,
- variant = 'primary',
- className,
-}: NotificationCounterProps) => {
- return (
- <div
- className={clsx(styles.notificationCounter, styles[variant], className)}
- >
- {count}
- </div>
- );
-};
diff --git a/packages/twenty-ui/src/components/data-display/NotificationCounter/__stories__/NotificationCounter.stories.tsx b/packages/twenty-ui/src/components/data-display/NotificationCounter/__stories__/NotificationCounter.stories.tsx
deleted file mode 100644
index 1082c1f5309..00000000000
--- a/packages/twenty-ui/src/components/data-display/NotificationCounter/__stories__/NotificationCounter.stories.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-import { type Meta, type StoryObj } from '@storybook/react-vite';
-
-import { IconInfoCircle } from '@ui/icon';
-import { Tabs } from '@ui/primitives/navigation/Tabs/Tabs';
-import { ComponentDecorator } from '@ui/testing';
-
-import { NotificationCounter } from '../NotificationCounter';
-
-const meta = {
- title: 'UI/Components/Data display/NotificationCounter',
- component: NotificationCounter,
- tags: ['!autodocs'],
- args: { count: 3, variant: 'secondary' },
-} satisfies Meta<typeof NotificationCounter>;
-
-export default meta;
-
-type Story = StoryObj<typeof meta>;
-
-export const WithIconAndBadge: Story = {
- decorators: [ComponentDecorator],
- parameters: { container: { width: 360 } },
- render: (args) => (
- <Tabs.Root defaultValue="overview">
- <Tabs.List aria-label="Record details">
- <Tabs.Tab
- value="overview"
- startIcon={<IconInfoCircle />}
- badge={<NotificationCounter {...args} />}
- >
- Overview
- </Tabs.Tab>
- <Tabs.Tab value="activity">Activity</Tabs.Tab>
- <Tabs.Tab value="settings">Settings</Tabs.Tab>
- <Tabs.Indicator />
- </Tabs.List>
- <Tabs.Panel value="overview" style={{ padding: 'var(--t-spacing-4)' }}>
- Record overview
- </Tabs.Panel>
- <Tabs.Panel value="activity" style={{ padding: 'var(--t-spacing-4)' }}>
- Recent activity
- </Tabs.Panel>
- <Tabs.Panel value="settings" style={{ padding: 'var(--t-spacing-4)' }}>
- Record settings
- </Tabs.Panel>
- </Tabs.Root>
- ),
-};
diff --git a/packages/twenty-ui/src/components/data-display/index.ts b/packages/twenty-ui/src/components/data-display/index.ts
index 40fd2c50b1b..7873fc0d64a 100644
--- a/packages/twenty-ui/src/components/data-display/index.ts
+++ b/packages/twenty-ui/src/components/data-display/index.ts
@@ -19,7 +19,6 @@ export type { JsonTreeProps } from './JsonTree/types/JsonTreeProps';
export type { ShouldExpandNodeInitiallyProps } from './JsonTree/types/ShouldExpandNodeInitiallyProps';
export { MetricRow } from './MetricRow/MetricRow';
export type { MetricRowProps } from './MetricRow/types/MetricRowProps';
-export { NotificationCounter } from './NotificationCounter/NotificationCounter';
export { TintedIconTile } from './TintedIconTile/TintedIconTile';
export type { TintedIconTileProps } from './TintedIconTile/types/TintedIconTileProps';
export type { IconTileColorShades } from './TintedIconTile/utils/getIconTileColorShades';
diff --git a/packages/twenty-ui/src/components/navigation/TabButton/__stories__/TabButton.stories.tsx b/packages/twenty-ui/src/components/navigation/TabButton/__stories__/TabButton.stories.tsx
index 0dd9eff0d14..66b0712d4d3 100644
--- a/packages/twenty-ui/src/components/navigation/TabButton/__stories__/TabButton.stories.tsx
+++ b/packages/twenty-ui/src/components/navigation/TabButton/__stories__/TabButton.stories.tsx
@@ -9,7 +9,7 @@ import {
IconUser,
} from '@ui/icon';
import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';
-import { Pill } from '@ui/primitives/data-display/Pill/Pill';
+import { Badge } from '@ui/primitives/data-display/Badge/Badge';
import { Tabs } from '@ui/primitives/navigation/Tabs/Tabs';
import {
A11Y_DEFER_COLOR_CONTRAST,
@@ -103,11 +103,11 @@ export const WithLogo: Story = {
),
};
-export const WithStringPill: Story = {
+export const WithBadge: Story = {
args: {
children: 'Messages',
startIcon: <IconMail />,
- badge: <Pill label="12" />,
+ badge: <Badge>12</Badge>,
},
render: (args) => (
<TabContainer>
@@ -212,7 +212,7 @@ export const Catalog: CatalogStory<Story, typeof TabButton> = {
},
{
name: 'Content',
- values: ['icon', 'logo', 'pill'],
+ values: ['icon', 'logo', 'badge'],
props: (content: string) => {
switch (content) {
case 'icon':
@@ -228,8 +228,8 @@ export const Catalog: CatalogStory<Story, typeof TabButton> = {
/>
),
};
- case 'pill':
- return { startIcon: <IconMail />, badge: <Pill label="5" /> };
+ case 'badge':
+ return { startIcon: <IconMail />, badge: <Badge>5</Badge> };
default:
return {};
}
@@ -249,7 +249,7 @@ export const MatchingTabContent: Story = {
args: {
children: 'Messages',
startIcon: <IconMail />,
- badge: <Pill label="12" />,
+ badge: <Badge>12</Badge>,
},
render: (args) => (
<>
diff --git a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss
similarity index 50%
rename from packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss
rename to packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss
index c72eb611826..fcbe40e9ab4 100644
--- a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss
@@ -1,4 +1,6 @@
-.pill {
+.badge[data-badge-size] {
+ --badge-height: var(--t-spacing-4);
+
align-items: center;
background: var(--t-background-transparent-light);
border-radius: var(--t-border-radius-pill);
@@ -9,15 +11,24 @@
font-style: normal;
font-weight: var(--t-font-weight-medium);
gap: var(--t-spacing-1);
- height: var(--t-spacing-4);
- justify-content: flex-end;
+ height: var(--badge-height);
+ justify-content: center;
line-height: var(--t-text-line-height-lg);
padding: 0 var(--t-spacing-2);
- &[data-size='md'] {
+ &[data-badge-size='xs'] {
+ --badge-height: calc(var(--t-spacing-3) + var(--t-spacing-0_5));
+
+ font-size: var(--t-font-size-xxs);
+ font-weight: var(--t-font-weight-semi-bold);
+ padding: 0 var(--t-spacing-1);
+ }
+
+ &[data-badge-size='md'] {
+ --badge-height: calc(var(--t-spacing-4) + var(--t-spacing-0_5));
+
font-size: var(--t-font-size-sm);
gap: var(--t-spacing-0_5);
- height: calc(var(--t-spacing-4) + var(--t-spacing-0_5));
padding: 0 var(--t-spacing-1_5);
& > svg {
@@ -26,10 +37,26 @@
}
}
- &[data-color='inherit'] {
+ &[data-badge-color='inherit'] {
background: color-mix(in srgb, currentColor 16%, transparent);
color: inherit;
font-variant-numeric: tabular-nums;
font-weight: inherit;
}
+
+ &[data-badge-color='primary'] {
+ background: var(--t-color-blue);
+ color: var(--t-font-color-on-accent);
+ }
+
+ &[data-badge-color='secondary'] {
+ color: var(--t-font-color-secondary);
+ }
+
+ &[data-badge-shape='circle'] {
+ border-radius: 50%;
+ flex-shrink: 0;
+ padding: 0;
+ width: var(--badge-height);
+ }
}
diff --git a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss.d.ts b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss.d.ts
similarity index 68%
rename from packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss.d.ts
rename to packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss.d.ts
index a576c6a318b..15bdc0e805a 100644
--- a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.module.scss.d.ts
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.module.scss.d.ts
@@ -1,4 +1,4 @@
declare const classNames: {
- readonly pill: 'pill';
+ readonly badge: 'badge';
};
export default classNames;
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/Badge.tsx b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.tsx
new file mode 100644
index 00000000000..1064930cb43
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/Badge.tsx
@@ -0,0 +1,28 @@
+import { useRender } from '@base-ui/react/use-render';
+import { clsx } from 'clsx';
+
+import { type BadgeProps } from './types/BadgeProps';
+
+import styles from './Badge.module.scss';
+
+export const Badge = ({
+ size = 'sm',
+ color = 'tertiary',
+ shape = 'pill',
+ className,
+ render,
+ ref,
+ ...props
+}: BadgeProps) =>
+ useRender({
+ defaultTagName: 'span',
+ render,
+ ref,
+ props: {
+ ...props,
+ className: clsx(styles.badge, className),
+ 'data-badge-size': size,
+ 'data-badge-color': color,
+ 'data-badge-shape': shape,
+ },
+ });
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/__stories__/Badge.stories.tsx b/packages/twenty-ui/src/primitives/data-display/Badge/__stories__/Badge.stories.tsx
new file mode 100644
index 00000000000..f012de1b3ac
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/__stories__/Badge.stories.tsx
@@ -0,0 +1,336 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { useRef, useState } from 'react';
+import { expect, fn, userEvent, within } from 'storybook/test';
+
+import { IconCoins, IconInfoCircle } from '@ui/icon';
+import { Badge } from '@ui/primitives/data-display/Badge/Badge';
+import { type BadgeColor } from '@ui/primitives/data-display/Badge/types/BadgeColor';
+import { type BadgeShape } from '@ui/primitives/data-display/Badge/types/BadgeShape';
+import { type BadgeSize } from '@ui/primitives/data-display/Badge/types/BadgeSize';
+import { Button } from '@ui/primitives/input/Button/Button';
+import { Tabs } from '@ui/primitives/navigation/Tabs/Tabs';
+import { Text } from '@ui/primitives/typography/Text/Text';
+import {
+ A11Y_DEFER_COLOR_CONTRAST,
+ CatalogDecorator,
+ type CatalogStory,
+ ComponentDecorator,
+} from '@ui/testing';
+
+const meta: Meta<typeof Badge> = {
+ title: 'UI/Data Display/Badge',
+ component: Badge,
+ args: { children: 'Soon' },
+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
+};
+
+export default meta;
+type Story = StoryObj<typeof Badge>;
+
+export const Default: Story = {
+ decorators: [ComponentDecorator],
+ play: async ({ canvasElement }) => {
+ const badge = within(canvasElement).getByText('Soon');
+
+ await expect(badge).toBeVisible();
+ await expect(badge).toHaveAttribute('data-badge-size', 'sm');
+ await expect(badge).toHaveAttribute('data-badge-color', 'tertiary');
+ await expect(badge).toHaveAttribute('data-badge-shape', 'pill');
+ await expect(badge).toHaveStyle({ height: '16px' });
+ },
+};
+
+export const Catalog: CatalogStory<Story, typeof Badge> = {
+ args: { children: 3 },
+ parameters: {
+ catalog: {
+ dimensions: [
+ {
+ name: 'size',
+ values: ['xs', 'sm', 'md'] satisfies BadgeSize[],
+ props: (size: BadgeSize) => ({ size }),
+ },
+ {
+ name: 'color',
+ values: [
+ 'tertiary',
+ 'inherit',
+ 'primary',
+ 'secondary',
+ ] satisfies BadgeColor[],
+ props: (color: BadgeColor) => ({ color }),
+ },
+ {
+ name: 'shape',
+ values: ['pill', 'circle'] satisfies BadgeShape[],
+ props: (shape: BadgeShape) => ({ shape }),
+ },
+ ],
+ },
+ },
+ decorators: [CatalogDecorator],
+ play: async ({ canvasElement }) => {
+ const badges = within(canvasElement).getAllByText('3');
+ await expect(badges).toHaveLength(24);
+
+ for (const badge of badges) {
+ await expect(badge).toBeVisible();
+ const badgeStyle = getComputedStyle(badge);
+ const expectedHeight = { xs: '14px', sm: '16px', md: '18px' }[
+ badge.getAttribute('data-badge-size') as BadgeSize
+ ];
+ await expect(badgeStyle.height).toBe(expectedHeight);
+
+ if (badge.getAttribute('data-badge-shape') === 'circle') {
+ await expect(badgeStyle.width).toBe(expectedHeight);
+ await expect(badgeStyle.borderRadius).toBe('50%');
+ }
+ }
+ },
+};
+
+export const Documentation: Story = {
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 360 } },
+ render: () => (
+ <Tabs.Root defaultValue="overview">
+ <Tabs.List aria-label="Record details">
+ <Tabs.Tab
+ value="overview"
+ startIcon={<IconInfoCircle aria-hidden="true" />}
+ badge={
+ <Badge size="xs" color="secondary" shape="circle">
+ 3
+ </Badge>
+ }
+ >
+ Overview
+ </Tabs.Tab>
+ <Tabs.Tab value="activity" badge={<Badge>Soon</Badge>}>
+ Activity
+ </Tabs.Tab>
+ <Tabs.Indicator />
+ </Tabs.List>
+ <Tabs.Panel value="overview" style={{ padding: 'var(--t-spacing-4)' }}>
+ <Badge color="inherit" size="md">
+ <IconCoins aria-hidden="true" size={12} />
+ +2 credits
+ </Badge>
+ </Tabs.Panel>
+ <Tabs.Panel value="activity">Recent activity</Tabs.Panel>
+ </Tabs.Root>
+ ),
+};
+
+const NativeCompositionExample = () => {
+ const spanRef = useRef<HTMLSpanElement>(null);
+ const buttonRef = useRef<HTMLElement>(null);
+ const linkRef = useRef<HTMLElement>(null);
+ const [result, setResult] = useState('Ready');
+ const [pointerEntries, setPointerEntries] = useState(0);
+ const [spanActivations, setSpanActivations] = useState(0);
+ const [buttonActivations, setButtonActivations] = useState(0);
+ const [renderedButtonActivations, setRenderedButtonActivations] = useState(0);
+ const [linkActivations, setLinkActivations] = useState(0);
+
+ return (
+ <>
+ <Badge
+ ref={spanRef}
+ aria-label="Reward"
+ data-reward="credits"
+ className="consumer-badge"
+ style={{ marginTop: 7 }}
+ onMouseEnter={(event) => {
+ setPointerEntries((entries) => entries + 1);
+ setResult(
+ spanRef.current === event.currentTarget
+ ? 'Span ref confirmed'
+ : 'Unexpected span ref',
+ );
+ }}
+ onClick={(event) => {
+ setSpanActivations((activations) => activations + 1);
+ setResult(
+ spanRef.current === event.currentTarget
+ ? 'Span click ref confirmed'
+ : 'Unexpected span ref',
+ );
+ }}
+ >
+ <IconCoins aria-hidden="true" size={12} />
+ <strong>+2 credits</strong>
+ </Badge>
+ <Badge aria-label="Caller supplied zero">{0}</Badge>
+ <Badge aria-label="Caller formatted count">99+</Badge>
+ <Badge
+ ref={buttonRef}
+ render={
+ <Button
+ size="sm"
+ onClick={() =>
+ setRenderedButtonActivations((activations) => activations + 1)
+ }
+ />
+ }
+ onClick={(event) => {
+ setButtonActivations((activations) => activations + 1);
+ setResult(
+ buttonRef.current === event.currentTarget
+ ? 'Button ref confirmed'
+ : 'Unexpected button ref',
+ );
+ }}
+ >
+ Review credits
+ </Badge>
+ <Badge
+ ref={linkRef}
+ onClick={(event) => {
+ event.preventDefault();
+ setLinkActivations((activations) => activations + 1);
+ setResult(
+ linkRef.current === event.currentTarget
+ ? 'Link ref confirmed'
+ : 'Unexpected link ref',
+ );
+ }}
+ render={(props) => (
+ <a {...props} href="#credits">
+ {props.children}
+ </a>
+ )}
+ >
+ Credit history
+ </Badge>
+ <output aria-label="Native composition result">{result}</output>
+ <output aria-label="Span pointer entries">{pointerEntries}</output>
+ <output aria-label="Span activations">{spanActivations}</output>
+ <output aria-label="Badge button activations">{buttonActivations}</output>
+ <output aria-label="Rendered button activations">
+ {renderedButtonActivations}
+ </output>
+ <output aria-label="Link activations">{linkActivations}</output>
+ </>
+ );
+};
+
+export const NativeComposition: Story = {
+ decorators: [ComponentDecorator],
+ render: () => <NativeCompositionExample />,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const badge = canvas.getByLabelText('Reward');
+ await expect(badge.tagName).toBe('SPAN');
+ await expect(badge).toHaveClass('consumer-badge');
+ await expect(badge).toHaveAttribute('data-reward', 'credits');
+ await expect(badge).toHaveStyle({ marginTop: '7px' });
+ const reward = canvas.getByText('+2 credits');
+ await expect(reward.tagName).toBe('STRONG');
+ await expect(reward).toBeVisible();
+ const zero = canvas.getByLabelText('Caller supplied zero');
+ await expect(zero).toBeVisible();
+ await expect(zero).toHaveTextContent('0');
+ const formattedCount = canvas.getByLabelText('Caller formatted count');
+ await expect(formattedCount).toBeVisible();
+ await expect(formattedCount).toHaveTextContent('99+');
+ await userEvent.hover(badge);
+ await expect(
+ canvas.getByLabelText('Span pointer entries'),
+ ).toHaveTextContent('1');
+ await expect(
+ canvas.getByLabelText('Native composition result'),
+ ).toHaveTextContent('Span ref confirmed');
+ await userEvent.click(badge);
+ await expect(canvas.getByLabelText('Span activations')).toHaveTextContent(
+ '1',
+ );
+ await expect(
+ canvas.getByLabelText('Native composition result'),
+ ).toHaveTextContent('Span click ref confirmed');
+ await expect(badge.tagName).toBe('SPAN');
+ await expect(badge).not.toHaveAttribute('role');
+ await expect(badge).not.toHaveAttribute('tabindex');
+ const button = canvas.getByRole('button', { name: 'Review credits' });
+ button.focus();
+ await userEvent.keyboard('{Enter}');
+ await expect(button).toHaveFocus();
+ await expect(
+ canvas.getByLabelText('Badge button activations'),
+ ).toHaveTextContent('1');
+ await expect(
+ canvas.getByLabelText('Rendered button activations'),
+ ).toHaveTextContent('1');
+ await expect(
+ canvas.getByLabelText('Native composition result'),
+ ).toHaveTextContent('Button ref confirmed');
+ const link = canvas.getByRole('link', { name: 'Credit history' });
+ await expect(link).toHaveAttribute('href', '#credits');
+ await userEvent.click(link);
+ await expect(canvas.getByLabelText('Link activations')).toHaveTextContent(
+ '1',
+ );
+ await expect(
+ canvas.getByLabelText('Native composition result'),
+ ).toHaveTextContent('Link ref confirmed');
+ await userEvent.keyboard('{Enter}');
+ await expect(link).toHaveFocus();
+ await expect(canvas.getByLabelText('Link activations')).toHaveTextContent(
+ '2',
+ );
+ },
+};
+
+export const ComposedAppearance: Story = {
+ decorators: [ComponentDecorator],
+ args: {
+ children: 3,
+ size: 'xs',
+ color: 'primary',
+ shape: 'pill',
+ ref: fn(),
+ onClick: fn(),
+ },
+ render: (args) => (
+ <Text style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
+ <Badge
+ size={args.size}
+ color={args.color}
+ shape={args.shape}
+ aria-label="Available credits"
+ >
+ {args.children}
+ </Badge>
+ <Badge
+ {...args}
+ render={<Button />}
+ aria-label="Review credits"
+ data-credit="available"
+ />
+ </Text>
+ ),
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const reference = canvas.getByLabelText('Available credits');
+ const button = canvas.getByRole('button', { name: 'Review credits' });
+ const referenceStyle = getComputedStyle(reference);
+ const buttonStyle = getComputedStyle(button);
+
+ await expect(button).toBeVisible();
+ await expect(button).toHaveAttribute('data-credit', 'available');
+ await expect(args.ref).toHaveBeenCalledWith(button);
+ await expect(buttonStyle.height).toBe('14px');
+ await expect(buttonStyle.fontSize).toBe(referenceStyle.fontSize);
+ await expect(buttonStyle.backgroundColor).toBe(
+ referenceStyle.backgroundColor,
+ );
+ await expect(buttonStyle.color).toBe(referenceStyle.color);
+ await expect(buttonStyle.borderRadius).toBe(referenceStyle.borderRadius);
+ await expect(buttonStyle.paddingInlineStart).toBe(
+ referenceStyle.paddingInlineStart,
+ );
+ button.focus();
+ await userEvent.keyboard('{Enter}');
+ await expect(args.onClick).toHaveBeenCalledOnce();
+ },
+};
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/__tests__/Badge.test.tsx b/packages/twenty-ui/src/primitives/data-display/Badge/__tests__/Badge.test.tsx
new file mode 100644
index 00000000000..cf8f59a6ac6
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/__tests__/Badge.test.tsx
@@ -0,0 +1,12 @@
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { Badge } from '../Badge';
+import styles from '../Badge.module.scss';
+
+runComponentConformance({
+ name: 'Badge',
+ element: <Badge>Soon</Badge>,
+ refInstanceOf: HTMLSpanElement,
+ ownClassName: styles.badge,
+ renderPropTagName: 'button',
+});
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeColor.ts b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeColor.ts
new file mode 100644
index 00000000000..39ab5c1d317
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeColor.ts
@@ -0,0 +1 @@
+export type BadgeColor = 'tertiary' | 'inherit' | 'primary' | 'secondary';
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeProps.ts b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeProps.ts
new file mode 100644
index 00000000000..bf289d2baa4
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeProps.ts
@@ -0,0 +1,11 @@
+import { type useRender } from '@base-ui/react/use-render';
+
+import { type BadgeColor } from './BadgeColor';
+import { type BadgeShape } from './BadgeShape';
+import { type BadgeSize } from './BadgeSize';
+
+export type BadgeProps = Omit<useRender.ComponentProps<'span'>, 'color'> & {
+ size?: BadgeSize;
+ color?: BadgeColor;
+ shape?: BadgeShape;
+};
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeShape.ts b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeShape.ts
new file mode 100644
index 00000000000..a7ead6e4fc2
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeShape.ts
@@ -0,0 +1 @@
+export type BadgeShape = 'pill' | 'circle';
diff --git a/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeSize.ts b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeSize.ts
new file mode 100644
index 00000000000..b8f33184aef
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/data-display/Badge/types/BadgeSize.ts
@@ -0,0 +1 @@
+export type BadgeSize = 'xs' | 'sm' | 'md';
diff --git a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.tsx b/packages/twenty-ui/src/primitives/data-display/Pill/Pill.tsx
deleted file mode 100644
index b6bab7b3d99..00000000000
--- a/packages/twenty-ui/src/primitives/data-display/Pill/Pill.tsx
+++ /dev/null
@@ -1,31 +0,0 @@
-import { type IconComponent } from '@ui/icon';
-import { clsx } from 'clsx';
-
-import styles from './Pill.module.scss';
-
-type PillProps = {
- className?: string;
- label?: string;
- Icon?: IconComponent;
- size?: 'sm' | 'md';
- color?: 'tertiary' | 'inherit';
-};
-
-export const Pill = ({
- className,
- label,
- Icon,
- size = 'sm',
- color = 'tertiary',
-}: PillProps) => {
- return (
- <span
- className={clsx(styles.pill, className)}
- data-size={size}
- data-color={color}
- >
- {Icon && <Icon size={12} />}
- {label}
- </span>
- );
-};
diff --git a/packages/twenty-ui/src/primitives/data-display/Pill/__stories__/Pill.stories.ts b/packages/twenty-ui/src/primitives/data-display/Pill/__stories__/Pill.stories.ts
deleted file mode 100644
index 3a34862bba0..00000000000
--- a/packages/twenty-ui/src/primitives/data-display/Pill/__stories__/Pill.stories.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { type Meta, type StoryObj } from '@storybook/react-vite';
-import { expect, within } from 'storybook/test';
-
-import { IconCoins } from '@ui/icon';
-import { Pill } from '@ui/primitives/data-display/Pill/Pill';
-import {
- A11Y_DEFER_COLOR_CONTRAST,
- CatalogDecorator,
- type CatalogStory,
- ComponentDecorator,
-} from '@ui/testing';
-
-const meta: Meta<typeof Pill> = {
- title: 'UI/Data Display/Pill',
- component: Pill,
- args: {
- label: 'Soon',
- },
-};
-
-export default meta;
-type Story = StoryObj<typeof Pill>;
-
-export const Default: Story = {
- decorators: [ComponentDecorator],
- parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
-};
-
-export const Catalog: CatalogStory<Story, typeof Pill> = {
- args: { label: '+2', Icon: IconCoins },
- parameters: {
- a11y: A11Y_DEFER_COLOR_CONTRAST,
- catalog: {
- dimensions: [
- {
- name: 'sizes',
- values: ['sm', 'md'],
- props: (size: 'sm' | 'md') => ({ size }),
- },
- {
- name: 'colors',
- values: ['tertiary', 'inherit'],
- props: (color: 'tertiary' | 'inherit') => ({ color }),
- },
- ],
- },
- },
- decorators: [CatalogDecorator],
- play: async ({ canvasElement }) => {
- const pills = await within(canvasElement).findAllByText('+2');
-
- await expect(pills).toHaveLength(4);
-
- for (const pill of pills) {
- await expect(pill).toBeVisible();
- }
- },
-};
diff --git a/packages/twenty-ui/src/primitives/data-display/index.ts b/packages/twenty-ui/src/primitives/data-display/index.ts
index f73a1b498a8..696e904dd36 100644
--- a/packages/twenty-ui/src/primitives/data-display/index.ts
+++ b/packages/twenty-ui/src/primitives/data-display/index.ts
@@ -19,6 +19,11 @@ export type { AvatarRootProps } from './Avatar/types/AvatarRootProps';
export type { AvatarRootState } from './Avatar/types/AvatarRootState';
export type { AvatarShape } from './Avatar/types/AvatarShape';
export type { AvatarSize } from './Avatar/types/AvatarSize';
+export { Badge } from './Badge/Badge';
+export type { BadgeColor } from './Badge/types/BadgeColor';
+export type { BadgeProps } from './Badge/types/BadgeProps';
+export type { BadgeShape } from './Badge/types/BadgeShape';
+export type { BadgeSize } from './Badge/types/BadgeSize';
export { Chip } from './Chip/Chip';
export type { ChipProps } from './Chip/types/ChipProps';
export type { ChipSize } from './Chip/types/ChipSize';
@@ -26,7 +31,6 @@ export type { ChipVariant } from './Chip/types/ChipVariant';
export { ColorSample } from './ColorSample/ColorSample';
export type { ColorSampleProps } from './ColorSample/types/ColorSampleProps';
export type { ColorSampleVariant } from './ColorSample/types/ColorSampleVariant';
-export { Pill } from './Pill/Pill';
export { Status } from './Status/Status';
export type { StatusProps } from './Status/types/StatusProps';
export type { StatusState } from './Status/types/StatusState';
diff --git a/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx b/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
index 28d7b2e7914..657ec42b478 100644
--- a/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
+++ b/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react';
import { expect, fn, userEvent, within } from 'storybook/test';
import { IconArrowRight, IconDownload, IconPlus } from '@ui/icon';
-import { Pill } from '@ui/primitives/data-display';
+import { Badge } from '@ui/primitives/data-display';
import { Text } from '@ui/primitives/typography';
import {
A11Y_DEFER_COLOR_CONTRAST,
@@ -66,7 +66,7 @@ export const Soon: Story = {
}}
>
{children}
- <Pill label="Coming soon" />
+ <Badge>Coming soon</Badge>
</Text>
</Button>
),
diff --git a/packages/twenty-ui/src/theme/constants/ThemeDark.ts b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
index 11360517f8f..ffcf100a64e 100644
--- a/packages/twenty-ui/src/theme/constants/ThemeDark.ts
+++ b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
@@ -179,6 +179,7 @@ export const THEME_DARK: typeof THEME_LIGHT = {
light: 'color(display-p3 0.4 0.4 0.4)',
extraLight: 'color(display-p3 0.298 0.298 0.298)',
inverted: 'color(display-p3 0.09 0.09 0.09)',
+ onAccent: 'color(display-p3 1 1 1)',
danger: 'color(display-p3 0.83 0.329 0.324)',
},
size: {
diff --git a/packages/twenty-ui/src/theme/constants/ThemeLight.ts b/packages/twenty-ui/src/theme/constants/ThemeLight.ts
index 5a774042055..eb249b42fa5 100644
--- a/packages/twenty-ui/src/theme/constants/ThemeLight.ts
+++ b/packages/twenty-ui/src/theme/constants/ThemeLight.ts
@@ -178,6 +178,7 @@ export const THEME_LIGHT = {
light: 'color(display-p3 0.702 0.702 0.702)',
extraLight: 'color(display-p3 0.8 0.8 0.8)',
inverted: 'color(display-p3 1 1 1)',
+ onAccent: 'color(display-p3 1 1 1)',
danger: 'color(display-p3 0.83 0.329 0.324)',
},
size: {
diff --git a/packages/twenty-ui/src/theme/theme-dark.css b/packages/twenty-ui/src/theme/theme-dark.css
index c5fe0877d5c..d6721de6d30 100644
--- a/packages/twenty-ui/src/theme/theme-dark.css
+++ b/packages/twenty-ui/src/theme/theme-dark.css
@@ -163,6 +163,7 @@
--t-font-color-light: color(display-p3 0.4 0.4 0.4);
--t-font-color-extra-light: color(display-p3 0.298 0.298 0.298);
--t-font-color-inverted: color(display-p3 0.09 0.09 0.09);
+ --t-font-color-on-accent: color(display-p3 1 1 1);
--t-font-color-danger: color(display-p3 0.83 0.329 0.324);
--t-font-size-xxs: 0.625rem;
--t-font-size-xs: 0.85rem;
diff --git a/packages/twenty-ui/src/theme/theme-light.css b/packages/twenty-ui/src/theme/theme-light.css
index 814668ebc05..e124dd3c920 100644
--- a/packages/twenty-ui/src/theme/theme-light.css
+++ b/packages/twenty-ui/src/theme/theme-light.css
@@ -167,6 +167,7 @@
--t-font-color-light: color(display-p3 0.702 0.702 0.702);
--t-font-color-extra-light: color(display-p3 0.8 0.8 0.8);
--t-font-color-inverted: color(display-p3 1 1 1);
+ --t-font-color-on-accent: color(display-p3 1 1 1);
--t-font-color-danger: color(display-p3 0.83 0.329 0.324);
--t-font-size-xxs: 0.625rem;
--t-font-size-xs: 0.85rem;
diff --git a/packages/twenty-ui/src/theme/themeCssVariables.ts b/packages/twenty-ui/src/theme/themeCssVariables.ts
index e5680103700..8df218e0819 100644
--- a/packages/twenty-ui/src/theme/themeCssVariables.ts
+++ b/packages/twenty-ui/src/theme/themeCssVariables.ts
@@ -208,6 +208,7 @@ export const themeCssVariables = {
light: 'var(--t-font-color-light)',
extraLight: 'var(--t-font-color-extra-light)',
inverted: 'var(--t-font-color-inverted)',
+ onAccent: 'var(--t-font-color-on-accent)',
danger: 'var(--t-font-color-danger)',
},
size: {
diff --git a/packages/twenty-ui/src/theme/themeTypes.ts b/packages/twenty-ui/src/theme/themeTypes.ts
index e4e4e3d6a5c..7546a22c61a 100644
--- a/packages/twenty-ui/src/theme/themeTypes.ts
+++ b/packages/twenty-ui/src/theme/themeTypes.ts
@@ -207,6 +207,7 @@ export type ThemeType = {
light: string;
extraLight: string;
inverted: string;
+ onAccent: string;
danger: string;
};
size: {