Skip to content

The open alternative to Salesforce, designed for AI.

Make retained UI strings overridable (#26804)

Raphaël Bosi1c8198887e6c
diff --git a/packages/twenty-docs/snippets/ui/generated/components/callout.mdx b/packages/twenty-docs/snippets/ui/generated/components/callout.mdx
index fb695016df5..3ce61129a29 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/callout.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/callout.mdx
@@ -15,6 +15,10 @@
Optional footer action with a label and onClick callback.
</ParamField>
+<ParamField body="closeLabel" type="string" default="Close">
+ Accessible name of the dismiss button. Defaults to `Close`.
+</ParamField>
+
<ParamField body="description" type="string">
Optional supporting text. Empty strings are hidden.
</ParamField>
diff --git a/packages/twenty-docs/snippets/ui/generated/components/color-scheme-picker.mdx b/packages/twenty-docs/snippets/ui/generated/components/color-scheme-picker.mdx
index b3e502b49e5..3dad807446b 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/color-scheme-picker.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/color-scheme-picker.mdx
@@ -16,11 +16,11 @@
</ParamField>
<ParamField body="darkLabel" type="string" required>
- Visible caption for the dark scheme. The control’s accessible name remains Dark.
+ Visible label and accessible name of the dark choice.
</ParamField>
<ParamField body="lightLabel" type="string" required>
- Visible caption for the light scheme. The control’s accessible name remains Light.
+ Visible label and accessible name of the light choice.
</ParamField>
<ParamField body="onChange" type="(value: ColorScheme) =&gt; void" required>
@@ -28,7 +28,7 @@
</ParamField>
<ParamField body="systemLabel" type="string" required>
- Visible caption for the system scheme. The control’s accessible name remains System.
+ Visible label and accessible name of the system choice.
</ParamField>
<ParamField body="value" type="&quot;Dark&quot; | &quot;Light&quot; | &quot;System&quot;" required>
diff --git a/packages/twenty-docs/snippets/ui/generated/components/dropdown.mdx b/packages/twenty-docs/snippets/ui/generated/components/dropdown.mdx
index 362e844065d..61be4edcb18 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/dropdown.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/dropdown.mdx
@@ -206,6 +206,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="ActionItem.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="ActionItem.nativeButton" type="boolean" default="true when render is omitted; false otherwise">
Whether the component renders a native `<button>` element when replacing it
via the `render` prop.
@@ -268,6 +272,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="OptionItem.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="OptionItem.indicator" type="&quot;check&quot; | &quot;checkbox&quot; | &quot;none&quot;">
Selection indicator: a check icon after the content, a checkbox before it, or none. Defaults to `checkbox` when `multiple` is set, otherwise `check`.
</ParamField>
@@ -432,6 +440,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="Back.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="Back.nativeButton" type="boolean" default="true when render is omitted; false otherwise">
Whether the component renders a native `<button>` element when replacing it
via the `render` prop.
@@ -520,6 +532,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="SubmenuTrigger.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="SubmenuTrigger.nativeButton" type="boolean" default="true when render is omitted; false otherwise">
Whether the component renders a native `<button>` element when replacing it
via the `render` prop.
diff --git a/packages/twenty-docs/snippets/ui/generated/components/menu-item.mdx b/packages/twenty-docs/snippets/ui/generated/components/menu-item.mdx
index 5af379b4c35..73ec240d7c5 100644
--- a/packages/twenty-docs/snippets/ui/generated/components/menu-item.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/components/menu-item.mdx
@@ -43,6 +43,10 @@
Visible shortcut hints. Register handlers in the application.
</ParamField>
+<ParamField body="hotKeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="iconButtons" type="ReactNode">
Trailing action elements.
</ParamField>
diff --git a/packages/twenty-docs/snippets/ui/generated/navigation/list-item.mdx b/packages/twenty-docs/snippets/ui/generated/navigation/list-item.mdx
index 510476c82c2..ca09278b73c 100644
--- a/packages/twenty-docs/snippets/ui/generated/navigation/list-item.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/navigation/list-item.mdx
@@ -53,6 +53,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`; pass an empty string to omit it.
+</ParamField>
+
<ParamField body="indicator" type="&quot;check&quot; | &quot;checkbox&quot; | &quot;none&quot;" default="none">
Selection indicator: a check icon after the content or a checkbox before
it.
diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx
index 6f121cc9c95..81fe85c0f01 100644
--- a/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/menu.mdx
@@ -245,6 +245,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="Item.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="Item.label" type="string">
Overrides the text label to use when the item is matched during keyboard text navigation.
</ParamField>
@@ -324,6 +328,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="CheckboxItem.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="CheckboxItem.label" type="string">
Overrides the text label to use when the item is matched during keyboard text navigation.
</ParamField>
@@ -438,6 +446,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="RadioItem.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="RadioItem.label" type="string">
Overrides the text label to use when the item is matched during keyboard text navigation.
</ParamField>
@@ -639,6 +651,10 @@
shortcut is up to the application.
</ParamField>
+<ParamField body="SubmenuTrigger.hotkeysJoinLabel" type="string">
+ Text between shortcut keys. Defaults to `then`.
+</ParamField>
+
<ParamField body="SubmenuTrigger.label" type="string">
Overrides the text label to use when the item is matched during keyboard text navigation.
</ParamField>
diff --git a/packages/twenty-docs/ui/components/callout.mdx b/packages/twenty-docs/ui/components/callout.mdx
index d19b2529305..a64d6f97dbc 100644
--- a/packages/twenty-docs/ui/components/callout.mdx
+++ b/packages/twenty-docs/ui/components/callout.mdx
@@ -18,6 +18,7 @@ export const ImportNotice = ({ onReview }: { onReview: () => void }) => (
description="Review the missing email addresses before importing."
action={{ label: 'Review records', onClick: onReview }}
isClosable
+ closeLabel="Dismiss import notice"
/>
);
```
@@ -32,6 +33,12 @@ The component does not add live-region semantics or forward native attributes. P
height={280}
/>
+## Labels and dismissal
+
+Your application owns `title`, `description`, and `action.label`. Set `isClosable` to show a dismiss button and pass `closeLabel` for its accessible name. The default is `Close`.
+
+Pass labels from your application's localization system. Twenty UI does not require an i18n provider.
+
## Props
<CalloutReference />
diff --git a/packages/twenty-docs/ui/components/color-scheme-picker.mdx b/packages/twenty-docs/ui/components/color-scheme-picker.mdx
index 744afd249bb..4fb7688b45f 100644
--- a/packages/twenty-docs/ui/components/color-scheme-picker.mdx
+++ b/packages/twenty-docs/ui/components/color-scheme-picker.mdx
@@ -3,10 +3,17 @@ title: ColorSchemePicker
description: Choose light, dark, or the system color scheme.
---
+import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
import ColorSchemePickerReference from '/snippets/ui/generated/components/color-scheme-picker.mdx';
`ColorSchemePicker` is controlled through `value` and `onChange`. Supply the three labels from your application. Selecting a scheme does not persist it or change a theme provider automatically.
+<StoryEmbed
+ storyId="ui-input-colorschemepicker--default"
+ title="Color scheme choices"
+ height={260}
+/>
+
```tsx
import { useState } from 'react';
import { ColorSchemePicker } from 'twenty-ui/components';
@@ -27,7 +34,9 @@ export const AppearanceChoice = () => {
};
```
-`ColorScheme` values are capitalized, while [ThemeProvider](/ui/theming) expects `light` or `dark`. Map `Light` and `Dark` to their lowercase names and resolve `System` from the system preference before passing the result to the provider. The three previews are separate button controls with Enter and Space activation. Their accessible names are `Light`, `Dark`, and `System`; the label props change only the visible captions. The selected checkmark is visual.
+`ColorScheme` values are capitalized, while [ThemeProvider](/ui/theming) expects `light` or `dark`. Map `Light` and `Dark` to their lowercase names and resolve `System` from the system preference before passing the result to the provider. The three previews are separate button controls with Enter and Space activation. The selected checkmark is visual.
+
+Each label is both visible text and the accessible name of its choice. Supply localized `lightLabel`, `darkLabel`, and `systemLabel` values. Selection callbacks still receive `Light`, `Dark`, or `System`.
## Props
diff --git a/packages/twenty-docs/ui/components/dropdown.mdx b/packages/twenty-docs/ui/components/dropdown.mdx
index 6f5a00e714b..ca85f1990aa 100644
--- a/packages/twenty-docs/ui/components/dropdown.mdx
+++ b/packages/twenty-docs/ui/components/dropdown.mdx
@@ -229,6 +229,10 @@ Use `type="panel"` for form inputs. Input interaction keeps the panel open; a sa
Escape dismisses the popup and restores focus to its trigger. Outside interaction also dismisses it, and the click that dismisses it doesn't activate what it lands on. Keys pressed inside the popup stay inside it, except Ctrl or Cmd shortcuts the dropdown doesn't handle, so page-level shortcuts keep working. `Content` accepts focus and portal options from Popover, including an explicit return-focus target for editor workflows.
+## Labels
+
+Each part owns its text: supply `Search.placeholder` and native accessible names, `Close` accessible attributes, and children for `Back`, `Loading`, and `Empty`. `Back` defaults to `Back`; loading and empty states have no built-in message. Item parts accept `hotkeysJoinLabel` to replace the default `then` between shortcut keys. Native `aria-labelledby` takes precedence over `aria-label`.
+
## Props
<DropdownReference />
diff --git a/packages/twenty-docs/ui/primitives/navigation/list-item.mdx b/packages/twenty-docs/ui/primitives/navigation/list-item.mdx
index f6b0bbc89cf..6c89dce3787 100644
--- a/packages/twenty-docs/ui/primitives/navigation/list-item.mdx
+++ b/packages/twenty-docs/ui/primitives/navigation/list-item.mdx
@@ -209,6 +209,10 @@ export const ContactRow = ({ onOpen }: ContactRowProps) => (
);
```
+## Labels
+
+Use `hotkeysJoinLabel` to customize the text between shortcut keys. It defaults to `then`; an empty string removes the join text. The same prop is available on `Menu` and `Dropdown` item parts. The legacy `MenuItem` composition uses `hotKeysJoinLabel` alongside `hotKeys`.
+
## Props
The reference is generated from the public component types. Native attributes, including accessible names and event handlers, are also accepted on parts that render elements.
diff --git a/packages/twenty-docs/ui/primitives/surfaces/menu.mdx b/packages/twenty-docs/ui/primitives/surfaces/menu.mdx
index b1c0bf366b8..60a55d364c1 100644
--- a/packages/twenty-docs/ui/primitives/surfaces/menu.mdx
+++ b/packages/twenty-docs/ui/primitives/surfaces/menu.mdx
@@ -228,6 +228,10 @@ Arrow keys move through the items, including disabled ones, which receive focus
It uses the [theme's portal container](/ui/theming) by default.
+## Labels
+
+Supply labels through each part’s children and native accessible attributes. `Item`, `CheckboxItem`, `RadioItem`, and `SubmenuTrigger` accept `hotkeysJoinLabel` to replace the default `then` between shortcut keys.
+
## Props
The reference is generated from the public component types. Native attributes, including accessible names and event handlers, are also accepted on parts that render elements.
diff --git a/packages/twenty-front-component-renderer/src/__stories__/LabelOverrides.stories.tsx b/packages/twenty-front-component-renderer/src/__stories__/LabelOverrides.stories.tsx
new file mode 100644
index 00000000000..3dc3a23b4e1
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/LabelOverrides.stories.tsx
@@ -0,0 +1,31 @@
+import { type Meta } from '@storybook/react-vite';
+
+import {
+ FRONT_COMPONENT_STORY_DEFAULT_ARGS,
+ resetFrontComponentStoryMocks,
+} from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
+import { type TwentyUiGalleryStory as Story } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryStory';
+import { createGalleryStory } from '@/__stories__/twenty-ui-gallery/utils/createGalleryStory';
+import { labelOverridesTest } from '@/__stories__/twenty-ui-gallery/utils/labelOverridesTest';
+import { FrontComponentRenderer } from '@/host/components/FrontComponentRenderer';
+
+const meta: Meta<typeof FrontComponentRenderer> = {
+ title: 'FrontComponent/Label overrides',
+ component: FrontComponentRenderer,
+ args: FRONT_COMPONENT_STORY_DEFAULT_ARGS,
+ beforeEach: resetFrontComponentStoryMocks,
+};
+
+export default meta;
+
+export const React: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-label-overrides',
+ runtime: 'react',
+ play: labelOverridesTest,
+});
+
+export const Preact: Story = createGalleryStory({
+ frontComponentBundleName: 'twenty-ui-label-overrides',
+ runtime: 'preact',
+ play: labelOverridesTest,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dropdown.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dropdown.front-component.tsx
index 841987cc917..6b27a38167b 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dropdown.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-dropdown.front-component.tsx
@@ -23,7 +23,11 @@ const DropdownExample = () => {
<Dropdown.Content aria-label="Assignee actions">
<Dropdown.Page id="root">
<Dropdown.Section>
- <Dropdown.ActionItem page="assignees">
+ <Dropdown.ActionItem
+ page="assignees"
+ hotkeys={['G', 'A']}
+ hotkeysJoinLabel="followed by"
+ >
Assign person
</Dropdown.ActionItem>
<Dropdown.ActionItem onClick={() => setSelection('Unassigned')}>
@@ -44,6 +48,8 @@ const DropdownExample = () => {
<Dropdown.OptionItem
key={assignee}
selected={selection === assignee}
+ hotkeys={['G', assignee.charAt(0)]}
+ hotkeysJoinLabel="next"
onSelect={() => setSelection(assignee)}
>
{assignee}
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx
new file mode 100644
index 00000000000..84eb84a2da4
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-label-overrides.front-component.tsx
@@ -0,0 +1,49 @@
+import { useState } from 'react';
+import { defineFrontComponent } from 'twenty-sdk/define';
+import { Callout, ColorSchemePicker, MenuItem } from 'twenty-ui/components';
+import { type ColorScheme } from 'twenty-ui/primitives/input';
+import { ListItem } from 'twenty-ui/primitives/navigation';
+import { Text } from 'twenty-ui/primitives/typography';
+
+import { TwentyUiGalleryCard } from '@/__stories__/shared/front-components/twenty-ui-gallery-card';
+
+const LabelOverrides = () => {
+ const [colorScheme, setColorScheme] = useState<ColorScheme>('Light');
+
+ return (
+ <TwentyUiGalleryCard title="Label overrides">
+ <Callout variant="info" title="Default notice" isClosable />
+ <Callout
+ variant="info"
+ title="Supplied notice"
+ isClosable
+ closeLabel="Dismiss notice"
+ />
+ <ColorSchemePicker
+ value={colorScheme}
+ onChange={setColorScheme}
+ lightLabel="Day appearance"
+ darkLabel="Night appearance"
+ systemLabel="Device appearance"
+ />
+ <Text role="status">Appearance: {colorScheme}</Text>
+ <ListItem hotkeys={['G', 'D']}>Default shortcut</ListItem>
+ <ListItem hotkeys={['G', 'S']} hotkeysJoinLabel="followed by">
+ Supplied shortcut
+ </ListItem>
+ <MenuItem
+ text="Legacy shortcut"
+ hotKeys={['G', 'L']}
+ hotKeysJoinLabel="next"
+ />
+ </TwentyUiGalleryCard>
+ );
+};
+
+export default defineFrontComponent({
+ universalIdentifier: '5fbc0790-28ac-4d43-9e43-ea246f0da4da',
+ name: 'twenty-ui-label-overrides',
+ description:
+ 'Caller-owned text and accessible names in both renderer runtimes',
+ component: LabelOverrides,
+});
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx
index a31ea7ffa7f..e35a4197647 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-menu.front-component.tsx
@@ -14,7 +14,11 @@ const MenuExample = () => {
<Menu.Popup>
<Menu.Group>
<Menu.GroupLabel>Record</Menu.GroupLabel>
- <Menu.Item onClick={() => setAction('duplicated')}>
+ <Menu.Item
+ hotkeys={['G', 'A']}
+ hotkeysJoinLabel="followed by"
+ onClick={() => setAction('duplicated')}
+ >
Duplicate
</Menu.Item>
<Menu.Item disabled onClick={() => setAction('archived')}>
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/labelOverridesTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/labelOverridesTest.ts
new file mode 100644
index 00000000000..80416feddc5
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/labelOverridesTest.ts
@@ -0,0 +1,38 @@
+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 labelOverridesTest: TwentyUiGalleryPlayFunction = async ({
+ canvasElement,
+}) => {
+ const canvas = within(canvasElement);
+ await expectFrontComponentMounted(canvas);
+
+ expect(canvas.getByRole('button', { name: 'Close' })).toBeVisible();
+ for (const label of [
+ 'Day appearance',
+ 'Night appearance',
+ 'Device appearance',
+ ]) {
+ expect(canvas.getByText(label)).toBeVisible();
+ expect(canvas.getByRole('button', { name: label })).toBeVisible();
+ }
+ for (const label of ['then', 'followed by', 'next']) {
+ expect(canvas.getByText(label)).toBeVisible();
+ }
+
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Night appearance' }),
+ );
+ await waitFor(() =>
+ expect(canvas.getByRole('status')).toHaveTextContent('Appearance: Dark'),
+ );
+ await userEvent.click(canvas.getByRole('button', { name: 'Dismiss notice' }));
+ await waitFor(() =>
+ expect(canvas.queryByText('Supplied notice')).not.toBeInTheDocument(),
+ );
+ expect(canvas.getByText('Default notice')).toBeVisible();
+ expect(errorHandler).not.toHaveBeenCalled();
+};
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx
index 88dec1a6e8b..5440767fc2c 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItem.tsx
@@ -1,3 +1,4 @@
+import { useLingui } from '@lingui/react/macro';
import { isNonEmptyString } from '@sniptt/guards';
import { type ReactNode } from 'react';
import { MenuItem } from 'twenty-ui/components';
@@ -40,6 +41,7 @@ export const CommandMenuItem = ({
isSubMenuOpened = false,
disabled = false,
}: CommandMenuItemProps) => {
+ const { t } = useLingui();
const { onItemClick } = useCommandMenuOnItemClick();
if (isNonEmptyString(to) && !Icon) {
@@ -60,6 +62,7 @@ export const CommandMenuItem = ({
contextualText={description}
contextualTextPosition={contextualTextPosition}
hotKeys={hotKeys}
+ hotKeysJoinLabel={t`then`}
onClick={
onClick || to
? () =>
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
index c6b6df4955b..d3cbe7a6fe7 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/form-action/components/WorkflowEditActionFormBuilder.tsx
@@ -247,6 +247,7 @@ export const WorkflowEditActionFormBuilder = ({
title={t`This form will appear in workflow runs.`}
description={t`Because this workflow is not using a manual trigger, the form will not open on top of the interface. To fill it, open the corresponding workflow run and complete the form there.`}
isClosable
+ closeLabel={t`Close`}
onClose={() => setIsCalloutVisible(false)}
action={{
label: t`Learn more`,
diff --git a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
index 94a5792d936..a6b75d51170 100644
--- a/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/components/SettingsClaimApplicationSection.tsx
@@ -241,6 +241,7 @@ export const SettingsClaimApplicationSection = () => {
),
}}
isClosable
+ closeLabel={t`Close`}
onClose={dismissClaimError}
/>
</StyledCalloutContainer>
diff --git a/packages/twenty-ui/CHANGELOG.md b/packages/twenty-ui/CHANGELOG.md
index c8a923d3979..a2cc640fa7e 100644
--- a/packages/twenty-ui/CHANGELOG.md
+++ b/packages/twenty-ui/CHANGELOG.md
@@ -21,6 +21,8 @@ Keep `twenty-ui`, `twenty-sdk`, and `twenty-client-sdk` versions aligned when up
### Added
+- `Callout.closeLabel` customizes the dismiss button name. `ListItem`, `Menu` items, and `Dropdown` items accept `hotkeysJoinLabel` (default `then`); the legacy `MenuItem` uses `hotKeysJoinLabel`. `ColorSchemePicker` uses its supplied visible labels as accessible names.
+
- `twenty-ui/utilities` exports `useMediaQuery`, `MOBILE_MEDIA_QUERY`, and `TOUCH_DEVICE_MEDIA_QUERY`. `twenty-ui/testing` exports `overrideMediaQueryMatches`.
### Fixed
diff --git a/packages/twenty-ui/docs/calloutPropDescriptions.ts b/packages/twenty-ui/docs/calloutPropDescriptions.ts
index e73f9fe5e16..fb7fdf205b2 100644
--- a/packages/twenty-ui/docs/calloutPropDescriptions.ts
+++ b/packages/twenty-ui/docs/calloutPropDescriptions.ts
@@ -11,5 +11,6 @@ export const CALLOUT_PROP_DESCRIPTIONS = {
action: 'Optional footer action with a label and onClick callback.',
isClosable:
'Shows a close button that hides the callout until it is remounted.',
+ closeLabel: 'Accessible name of the dismiss button. Defaults to `Close`.',
onClose: 'Called after the close button hides the callout.',
} satisfies Partial<Record<keyof ComponentProps<typeof Callout>, string>>;
diff --git a/packages/twenty-ui/docs/colorSchemePickerPropDescriptions.ts b/packages/twenty-ui/docs/colorSchemePickerPropDescriptions.ts
index 079b516f439..2df68246ac6 100644
--- a/packages/twenty-ui/docs/colorSchemePickerPropDescriptions.ts
+++ b/packages/twenty-ui/docs/colorSchemePickerPropDescriptions.ts
@@ -7,12 +7,9 @@ export const COLOR_SCHEME_PICKER_PROP_DESCRIPTIONS = {
'Selected scheme: Light, Dark, or System. The application resolves system to a concrete theme.',
className: 'Class applied to the outer container.',
onChange: 'Called with the newly selected color scheme.',
- lightLabel:
- 'Visible caption for the light scheme. The control’s accessible name remains Light.',
- darkLabel:
- 'Visible caption for the dark scheme. The control’s accessible name remains Dark.',
- systemLabel:
- 'Visible caption for the system scheme. The control’s accessible name remains System.',
+ lightLabel: 'Visible label and accessible name of the light choice.',
+ darkLabel: 'Visible label and accessible name of the dark choice.',
+ systemLabel: 'Visible label and accessible name of the system choice.',
} satisfies Partial<
Record<keyof ComponentProps<typeof ColorSchemePicker>, string>
>;
diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.ts
index 936b2275c05..c4b9a4a3f3d 100644
--- a/packages/twenty-ui/docs/components.ts
+++ b/packages/twenty-ui/docs/components.ts
@@ -279,6 +279,8 @@ export const DOCUMENTED_COMPONENTS = [
entryPoint: 'twenty-ui/primitives/navigation',
slug: 'navigation/list-item',
propDescriptions: {
+ hotkeysJoinLabel:
+ 'Text between shortcut keys. Defaults to `then`; pass an empty string to omit it.',
actionsVisibility:
'When trailing actions are visible: on hover and focus, or always.',
},
@@ -330,7 +332,17 @@ export const DOCUMENTED_COMPONENTS = [
entryPoint: 'twenty-ui/primitives/surfaces',
slug: 'surfaces/menu',
partPropDescriptions: {
+ Item: {
+ hotkeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
+ },
+ CheckboxItem: {
+ hotkeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
+ },
+ RadioItem: {
+ hotkeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
+ },
SubmenuTrigger: {
+ hotkeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
onClick: 'The click handler for the submenu trigger.',
},
},
diff --git a/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts b/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts
index 05e79fe653b..d09969150ff 100644
--- a/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts
+++ b/packages/twenty-ui/docs/dropdownPartPropDescriptions.ts
@@ -23,6 +23,7 @@ const DROPDOWN_ROOT_PROP_DESCRIPTIONS = {
} satisfies Partial<Record<keyof DropdownRootProps, string>>;
const DROPDOWN_ITEM_PROP_DESCRIPTIONS = {
+ hotkeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
className: 'CSS class applied to the row.',
style: 'Inline styles applied to the row.',
render:
diff --git a/packages/twenty-ui/docs/label-ownership.md b/packages/twenty-ui/docs/label-ownership.md
new file mode 100644
index 00000000000..d6dccfe096e
--- /dev/null
+++ b/packages/twenty-ui/docs/label-ownership.md
@@ -0,0 +1,22 @@
+# Retained UI label ownership
+
+This covers production exports under components, primitives, and icons, including the Dropdown compound API.
+
+| Surface | Text ownership |
+| ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Callout | `title`, `description`, `action.label`, and `closeLabel` (default `Close`). |
+| ColorSchemePicker | Required `lightLabel`, `darkLabel`, and `systemLabel` supply visible and accessible names. `Aa` is the decorative appearance sample. Scheme values remain `Light`, `Dark`, and `System`. |
+| ListItem and Menu item parts | Children, description, action slots, native accessible attributes, and `hotkeysJoinLabel` (default `then`). |
+| 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 `hotkeysJoinLabel` to ListItem. |
+| Legacy menu compositions | MenuItem exposes `text`, contextual slots, and `hotKeysJoinLabel` (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, native accessible attributes, and `soonLabel` (default `Soon`). Loading preserves the supplied name and marks the button busy; its spinner is decorative. Button shortcut key combinations contain no word separator. |
+| 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. |
+| 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 `emptyLabel` defaults to `Untitled`. Avatar accepts native accessible names over its interactive fallback of the supplied name or `Avatar`. The visual initial or dash is hidden from assistive technology; the image has empty alternative text. |
+| 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`. 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, Info, CardPicker, SettingsRow, Section, NavigationBar, RoundedLink, ClickToActionLink, 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. |
diff --git a/packages/twenty-ui/docs/menuItemPropDescriptions.ts b/packages/twenty-ui/docs/menuItemPropDescriptions.ts
index 6193e7ba813..86cd7536598 100644
--- a/packages/twenty-ui/docs/menuItemPropDescriptions.ts
+++ b/packages/twenty-ui/docs/menuItemPropDescriptions.ts
@@ -29,5 +29,6 @@ export const MENU_ITEM_PROP_DESCRIPTIONS = {
focused: 'Applies focused appearance without moving DOM focus.',
selected: 'Applies selected appearance without owning selection state.',
hotKeys: 'Visible shortcut hints. Register handlers in the application.',
+ hotKeysJoinLabel: 'Text between shortcut keys. Defaults to `then`.',
isSubMenuOpened: 'Applies the open treatment to the submenu chevron.',
} satisfies Partial<Record<keyof ComponentProps<typeof MenuItem>, string>>;
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index 890520d1f46..c2c0361b4db 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -3136,6 +3136,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`; pass an empty string to omit it."
+ },
{
"name": "indicator",
"type": "\"check\" | \"checkbox\" | \"none\"",
@@ -4514,6 +4521,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "label",
"type": "string",
@@ -4631,6 +4645,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "label",
"type": "string",
@@ -4802,6 +4823,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "label",
"type": "string",
@@ -5093,6 +5121,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "label",
"type": "string",
@@ -7034,6 +7069,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "nativeButton",
"type": "boolean",
@@ -7137,6 +7179,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "indicator",
"type": "\"check\" | \"checkbox\" | \"none\"",
@@ -7391,6 +7440,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "nativeButton",
"type": "boolean",
@@ -7541,6 +7597,13 @@
"defaultValue": null,
"description": "Keyboard shortcut keys displayed at the end of the row. Registering the\nshortcut is up to the application."
},
+ {
+ "name": "hotkeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "nativeButton",
"type": "boolean",
@@ -8204,6 +8267,13 @@
"defaultValue": null,
"description": "Optional footer action with a label and onClick callback."
},
+ {
+ "name": "closeLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": "Close",
+ "description": "Accessible name of the dismiss button. Defaults to `Close`."
+ },
{
"name": "description",
"type": "string",
@@ -8503,14 +8573,14 @@
"type": "string",
"required": true,
"defaultValue": null,
- "description": "Visible caption for the dark scheme. The control’s accessible name remains Dark."
+ "description": "Visible label and accessible name of the dark choice."
},
{
"name": "lightLabel",
"type": "string",
"required": true,
"defaultValue": null,
- "description": "Visible caption for the light scheme. The control’s accessible name remains Light."
+ "description": "Visible label and accessible name of the light choice."
},
{
"name": "onChange",
@@ -8524,7 +8594,7 @@
"type": "string",
"required": true,
"defaultValue": null,
- "description": "Visible caption for the system scheme. The control’s accessible name remains System."
+ "description": "Visible label and accessible name of the system choice."
},
{
"name": "value",
@@ -8715,6 +8785,13 @@
"defaultValue": null,
"description": "Visible shortcut hints. Register handlers in the application."
},
+ {
+ "name": "hotKeysJoinLabel",
+ "type": "string",
+ "required": false,
+ "defaultValue": null,
+ "description": "Text between shortcut keys. Defaults to `then`."
+ },
{
"name": "iconButtons",
"type": "ReactNode",
diff --git a/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
new file mode 100644
index 00000000000..82fa370055d
--- /dev/null
+++ b/packages/twenty-ui/src/components/__stories__/LabelOverrides.stories.tsx
@@ -0,0 +1,270 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
+
+import {
+ Callout,
+ Dropdown,
+ MenuItem,
+ SearchInput,
+ Toaster,
+ ToastProvider,
+} from '@ui/components';
+import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';
+import { Button } from '@ui/primitives/input/Button/Button';
+import { ResizeHandle } from '@ui/primitives/layout/ResizeHandle/ResizeHandle';
+import { ListItem } from '@ui/primitives/navigation/ListItem/ListItem';
+import { Menu } from '@ui/primitives/surfaces/Menu/Menu';
+import { Text } from '@ui/primitives/typography/Text/Text';
+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
+
+const meta: Meta = {
+ title: 'UI/Accessibility/Label overrides',
+ decorators: [ComponentDecorator],
+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
+};
+
+export default meta;
+type Story = StoryObj;
+
+export const CalloutDismissal: Story = {
+ render: () => (
+ <>
+ <Callout variant="info" title="Default notice" isClosable />
+ <Callout
+ variant="info"
+ title="Supplied notice"
+ isClosable
+ closeLabel="Dismiss notice"
+ />
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ expect(canvas.getByRole('button', { name: 'Close' })).toBeVisible();
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Dismiss notice' }),
+ );
+ expect(canvas.queryByText('Supplied notice')).not.toBeInTheDocument();
+ expect(canvas.getByText('Default notice')).toBeVisible();
+ },
+};
+
+export const ShortcutLabels: Story = {
+ render: () => (
+ <>
+ <ListItem hotkeys={['G', 'D']}>Default shortcut</ListItem>
+ <ListItem hotkeys={['G', 'S']} hotkeysJoinLabel="followed by">
+ Supplied shortcut
+ </ListItem>
+ <MenuItem
+ text="Legacy shortcut"
+ hotKeys={['G', 'L']}
+ hotKeysJoinLabel="next"
+ />
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+
+ expect(canvas.getByText('then')).toBeVisible();
+ expect(canvas.getByText('followed by')).toBeVisible();
+ expect(canvas.getByText('next')).toBeVisible();
+ },
+};
+
+export const NativeNames: Story = {
+ render: () => (
+ <>
+ <Text id="search-label">Find contacts</Text>
+ <SearchInput
+ value=""
+ onChange={fn()}
+ placeholder="Search everything"
+ aria-label="Fallback search"
+ aria-labelledby="search-label"
+ filterDropdown={(button) => button}
+ filterButtonAriaLabel="Filter contacts"
+ />
+ <Text id="avatar-label">Open profile</Text>
+ <Avatar
+ onClick={fn()}
+ aria-label="Fallback avatar"
+ aria-labelledby="avatar-label"
+ />
+ <Text id="resize-label">Resize details</Text>
+ <ResizeHandle
+ aria-label="Fallback resize"
+ aria-labelledby="resize-label"
+ />
+ <Text id="notifications-label">Workspace notifications</Text>
+ <ToastProvider>
+ <Toaster
+ aria-label="Fallback notifications"
+ aria-labelledby="notifications-label"
+ />
+ </ToastProvider>
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const body = within(canvasElement.ownerDocument.body);
+
+ expect(
+ canvas.getByRole('textbox', { name: 'Find contacts' }),
+ ).toHaveAttribute('placeholder', 'Search everything');
+ expect(
+ canvas.getByRole('button', { name: 'Filter contacts' }),
+ ).toBeVisible();
+ expect(canvas.getByRole('button', { name: 'Open profile' })).toBeVisible();
+ expect(
+ canvas.getByRole('separator', { name: 'Resize details' }),
+ ).toBeVisible();
+ expect(
+ body.getByRole('region', { name: 'Workspace notifications' }),
+ ).toBeInTheDocument();
+ },
+};
+
+export const MenuShortcutLabels: Story = {
+ render: () => (
+ <Menu.Root>
+ <Menu.Trigger render={<Button>Open shortcuts</Button>} />
+ <Menu.Popup aria-label="Shortcuts">
+ <Menu.Item hotkeys={['G', 'D']}>Default</Menu.Item>
+ <Menu.Item hotkeys={['G', 'A']} hotkeysJoinLabel="followed by">
+ Action
+ </Menu.Item>
+ <Menu.CheckboxItem hotkeys={['G', 'C']} hotkeysJoinLabel="next">
+ Checkbox
+ </Menu.CheckboxItem>
+ <Menu.RadioGroup value="radio">
+ <Menu.RadioItem
+ value="radio"
+ hotkeys={['G', 'R']}
+ hotkeysJoinLabel="afterwards"
+ >
+ Radio
+ </Menu.RadioItem>
+ </Menu.RadioGroup>
+ <Menu.SubmenuRoot>
+ <Menu.SubmenuTrigger hotkeys={['G', 'S']} hotkeysJoinLabel="and">
+ Submenu
+ </Menu.SubmenuTrigger>
+ <Menu.Popup>
+ <Menu.Item>Nested action</Menu.Item>
+ </Menu.Popup>
+ </Menu.SubmenuRoot>
+ </Menu.Popup>
+ </Menu.Root>
+ ),
+ play: async ({ canvasElement }) => {
+ await userEvent.click(
+ within(canvasElement).getByRole('button', { name: 'Open shortcuts' }),
+ );
+ const body = within(canvasElement.ownerDocument.body);
+ const menu = within(await body.findByRole('menu'));
+
+ for (const label of ['then', 'followed by', 'next', 'afterwards', 'and']) {
+ await waitFor(() => expect(menu.getByText(label)).toBeVisible());
+ }
+ },
+};
+
+export const DropdownLabels: Story = {
+ render: () => (
+ <Dropdown.Root type="menu">
+ <Dropdown.Trigger render={<Button>Open labeled dropdown</Button>} />
+ <Dropdown.Content aria-label="Label examples">
+ <Dropdown.Page id="root">
+ <Dropdown.ActionItem page="details">Details</Dropdown.ActionItem>
+ </Dropdown.Page>
+ <Dropdown.Page id="details" type="picker">
+ <Dropdown.Header>
+ <Dropdown.Title>Detail choices</Dropdown.Title>
+ <Text id="close-dropdown-label">Dismiss choices</Text>
+ <Dropdown.Close
+ aria-label="Fallback close"
+ aria-labelledby="close-dropdown-label"
+ />
+ </Dropdown.Header>
+ <Dropdown.Back />
+ <Dropdown.Back>Return to choices</Dropdown.Back>
+ <Text id="dropdown-search-label">Find choices</Text>
+ <Dropdown.Search
+ aria-label="Fallback search"
+ aria-labelledby="dropdown-search-label"
+ placeholder="Type a choice"
+ />
+ <Dropdown.Empty>No matching choices</Dropdown.Empty>
+ <Dropdown.Loading>Fetching choices</Dropdown.Loading>
+ <Dropdown.ActionItem hotkeys={['G', 'D']}>
+ Default shortcut
+ </Dropdown.ActionItem>
+ <Dropdown.ActionItem
+ hotkeys={['G', 'A']}
+ hotkeysJoinLabel="followed by"
+ >
+ Action
+ </Dropdown.ActionItem>
+ <Dropdown.OptionItem
+ selected={false}
+ hotkeys={['G', 'O']}
+ hotkeysJoinLabel="next"
+ >
+ Option
+ </Dropdown.OptionItem>
+ <Dropdown.Submenu>
+ <Dropdown.SubmenuTrigger
+ hotkeys={['G', 'S']}
+ hotkeysJoinLabel="afterwards"
+ >
+ Submenu
+ </Dropdown.SubmenuTrigger>
+ <Dropdown.Content aria-label="Nested choices">
+ <Dropdown.ActionItem>Nested action</Dropdown.ActionItem>
+ </Dropdown.Content>
+ </Dropdown.Submenu>
+ </Dropdown.Page>
+ </Dropdown.Content>
+ </Dropdown.Root>
+ ),
+ play: async ({ canvasElement }) => {
+ const body = within(canvasElement.ownerDocument.body);
+
+ await userEvent.click(
+ within(canvasElement).getByRole('button', {
+ name: 'Open labeled dropdown',
+ }),
+ );
+ await userEvent.click(
+ await body.findByRole('menuitem', { name: 'Details' }),
+ );
+ expect(await body.findByRole('button', { name: 'Back' })).toBeVisible();
+ expect(
+ body.getByRole('button', { name: 'Return to choices' }),
+ ).toBeVisible();
+ expect(
+ body.getByRole('searchbox', { name: 'Find choices' }),
+ ).toHaveAttribute('placeholder', 'Type a choice');
+ expect(body.getByText('No matching choices')).toHaveAttribute(
+ 'role',
+ 'status',
+ );
+ expect(body.getByText('Fetching choices')).toHaveAttribute(
+ 'aria-busy',
+ 'true',
+ );
+
+ for (const label of ['then', 'followed by', 'next', 'afterwards']) {
+ expect(body.getByText(label)).toBeVisible();
+ }
+
+ await userEvent.click(
+ body.getByRole('button', { name: 'Dismiss choices' }),
+ );
+ await waitFor(() =>
+ expect(body.queryByRole('dialog')).not.toBeInTheDocument(),
+ );
+ },
+};
diff --git a/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx b/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
index 2a1c4d0d97b..23871f798db 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
+++ b/packages/twenty-ui/src/components/feedback/Callout/Callout.tsx
@@ -34,6 +34,7 @@ export const Callout = ({
Icon = IconHelp,
action,
isClosable = false,
+ closeLabel = 'Close',
onClose,
}: CalloutProps) => {
const [isVisible, setIsVisible] = useState(true);
@@ -75,7 +76,7 @@ export const Callout = ({
className={styles.closeButton}
variant="ghost"
size="sm"
- aria-label="Close"
+ aria-label={closeLabel}
onClick={handleClose}
/>
)}
diff --git a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
index c171abdc64f..f8003f3685b 100644
--- a/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
+++ b/packages/twenty-ui/src/components/feedback/Callout/types/CalloutProps.ts
@@ -12,5 +12,6 @@ export type CalloutProps = {
onClick: () => void;
};
isClosable?: boolean;
+ closeLabel?: string;
onClose?: () => void;
};
diff --git a/packages/twenty-ui/src/components/input/ColorSchemePicker/ColorSchemePicker.tsx b/packages/twenty-ui/src/components/input/ColorSchemePicker/ColorSchemePicker.tsx
index a1716d62beb..cdb04d583f9 100644
--- a/packages/twenty-ui/src/components/input/ColorSchemePicker/ColorSchemePicker.tsx
+++ b/packages/twenty-ui/src/components/input/ColorSchemePicker/ColorSchemePicker.tsx
@@ -19,6 +19,7 @@ export const ColorSchemePicker = ({
className={styles.card}
onClick={() => onChange('Light')}
variant="Light"
+ aria-label={lightLabel}
selected={value === 'Light'}
/>
<span className={styles.label}>{lightLabel}</span>
@@ -28,6 +29,7 @@ export const ColorSchemePicker = ({
className={styles.card}
onClick={() => onChange('Dark')}
variant="Dark"
+ aria-label={darkLabel}
selected={value === 'Dark'}
/>
<span className={styles.label}>{darkLabel}</span>
@@ -37,6 +39,7 @@ export const ColorSchemePicker = ({
className={styles.card}
onClick={() => onChange('System')}
variant="System"
+ aria-label={systemLabel}
selected={value === 'System'}
/>
<span className={styles.label}>{systemLabel}</span>
diff --git a/packages/twenty-ui/src/components/input/ColorSchemePicker/__stories__/ColorSchemePicker.stories.tsx b/packages/twenty-ui/src/components/input/ColorSchemePicker/__stories__/ColorSchemePicker.stories.tsx
new file mode 100644
index 00000000000..254d5fd8c37
--- /dev/null
+++ b/packages/twenty-ui/src/components/input/ColorSchemePicker/__stories__/ColorSchemePicker.stories.tsx
@@ -0,0 +1,46 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, fn, userEvent, within } from 'storybook/test';
+
+import { ComponentDecorator } from '@ui/testing';
+
+import { ColorSchemePicker } from '../ColorSchemePicker';
+
+const meta: Meta<typeof ColorSchemePicker> = {
+ title: 'UI/Input/ColorSchemePicker',
+ component: ColorSchemePicker,
+ decorators: [ComponentDecorator],
+ args: {
+ value: 'Light',
+ lightLabel: 'Light',
+ darkLabel: 'Dark',
+ systemLabel: 'System',
+ onChange: fn(),
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof ColorSchemePicker>;
+
+export const Default: Story = {};
+
+export const SuppliedLabels: Story = {
+ args: {
+ lightLabel: 'Day appearance',
+ darkLabel: 'Night appearance',
+ systemLabel: 'Device appearance',
+ },
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+
+ for (const label of [args.lightLabel, args.darkLabel, args.systemLabel]) {
+ expect(canvas.getByText(label)).toBeVisible();
+ expect(canvas.getByRole('button', { name: label })).toBeVisible();
+ }
+
+ await userEvent.click(canvas.getByRole('button', { name: args.darkLabel }));
+ expect(args.onChange).toHaveBeenLastCalledWith('Dark');
+ canvas.getByRole('button', { name: args.systemLabel }).focus();
+ await userEvent.keyboard('{Enter}');
+ expect(args.onChange).toHaveBeenLastCalledWith('System');
+ },
+};
diff --git a/packages/twenty-ui/src/components/input/ColorSchemePicker/internal/ColorSchemeCard/ColorSchemeCard.tsx b/packages/twenty-ui/src/components/input/ColorSchemePicker/internal/ColorSchemeCard/ColorSchemeCard.tsx
index 3944b79f4e6..6d79a9537e6 100644
--- a/packages/twenty-ui/src/components/input/ColorSchemePicker/internal/ColorSchemeCard/ColorSchemeCard.tsx
+++ b/packages/twenty-ui/src/components/input/ColorSchemePicker/internal/ColorSchemeCard/ColorSchemeCard.tsx
@@ -11,7 +11,7 @@ import { isDefined } from '@ui/utilities/utils/isDefined';
import styles from './ColorSchemeCard.module.scss';
-export type ColorSchemeSegmentProps = {
+type ColorSchemeSegmentProps = {
variant: ColorScheme;
className?: string;
} & React.ComponentPropsWithoutRef<'div'>;
@@ -23,6 +23,7 @@ const ColorSchemeSegment = ({
onClick,
onMouseEnter,
onMouseLeave,
+ 'aria-label': ariaLabel,
}: ColorSchemeSegmentProps) => {
const grayScale = variant === 'Dark' ? GRAY_SCALE_DARK : GRAY_SCALE_LIGHT;
@@ -43,7 +44,7 @@ const ColorSchemeSegment = ({
style={segmentStyle}
role="button"
tabIndex={0}
- aria-label={variant}
+ aria-label={ariaLabel ?? variant}
onClick={onClick}
onKeyDown={handleClickableElementKeyDown}
onMouseEnter={onMouseEnter}
@@ -66,7 +67,7 @@ const ColorSchemeSegment = ({
);
};
-export type ColorSchemeCardProps = {
+type ColorSchemeCardProps = {
variant: ColorScheme;
selected?: boolean;
} & React.ComponentPropsWithoutRef<'div'>;
@@ -76,6 +77,7 @@ export const ColorSchemeCard = ({
selected,
onClick,
className,
+ 'aria-label': ariaLabel,
}: ColorSchemeCardProps) => {
const mixedSegments = (
<>
@@ -98,7 +100,7 @@ export const ColorSchemeCard = ({
className={styles.mixedColorSchemeSegment}
role="button"
tabIndex={0}
- aria-label={variant}
+ aria-label={ariaLabel ?? variant}
onClick={onClick}
onKeyDown={handleClickableElementKeyDown}
>
@@ -119,7 +121,11 @@ export const ColorSchemeCard = ({
return (
<div className={clsx(styles.container, className)}>
- <ColorSchemeSegment variant={variant} onClick={onClick} />
+ <ColorSchemeSegment
+ variant={variant}
+ onClick={onClick}
+ aria-label={ariaLabel}
+ />
<div
className={styles.checkmarkContainer}
data-selected={selected || undefined}
diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownActionItem.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownActionItem.tsx
index 2cf95e0de0d..83b151c0e87 100644
--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownActionItem.tsx
+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownActionItem.tsx
@@ -17,6 +17,7 @@ export const DropdownActionItem = ({
description,
descriptionPlacement,
hotkeys,
+ hotkeysJoinLabel,
hasSubmenu,
children,
render,
@@ -93,6 +94,7 @@ export const DropdownActionItem = ({
description={description}
descriptionPlacement={descriptionPlacement}
hotkeys={hotkeys}
+ hotkeysJoinLabel={hotkeysJoinLabel}
hasSubmenu={hasSubmenu ?? isDefined(page)}
>
{children}
diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownOptionItem.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownOptionItem.tsx
index afdfe317ba1..3250f169b28 100644
--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownOptionItem.tsx
+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownOptionItem.tsx
@@ -19,6 +19,7 @@ export const DropdownOptionItem = ({
description,
descriptionPlacement,
hotkeys,
+ hotkeysJoinLabel,
hasSubmenu,
children,
render,
@@ -79,6 +80,7 @@ export const DropdownOptionItem = ({
description={description}
descriptionPlacement={descriptionPlacement}
hotkeys={hotkeys}
+ hotkeysJoinLabel={hotkeysJoinLabel}
hasSubmenu={hasSubmenu}
>
{children}
diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSubmenuTrigger.tsx b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSubmenuTrigger.tsx
index 63ef20944fe..99715d22fd7 100644
--- a/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSubmenuTrigger.tsx
+++ b/packages/twenty-ui/src/components/navigation/Dropdown/internal/DropdownSubmenuTrigger.tsx
@@ -18,6 +18,7 @@ export const DropdownSubmenuTrigger = ({
description,
descriptionPlacement,
hotkeys,
+ hotkeysJoinLabel,
hasSubmenu = true,
children,
render,
@@ -97,6 +98,7 @@ export const DropdownSubmenuTrigger = ({
description={description}
descriptionPlacement={descriptionPlacement}
hotkeys={hotkeys}
+ hotkeysJoinLabel={hotkeysJoinLabel}
hasSubmenu={hasSubmenu}
>
{children}
diff --git a/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownActionItemProps.ts b/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownActionItemProps.ts
index 0831ff6cba4..bac19f79860 100644
--- a/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownActionItemProps.ts
+++ b/packages/twenty-ui/src/components/navigation/Dropdown/types/DropdownActionItemProps.ts
@@ -15,6 +15,7 @@ export type DropdownActionItemProps = Omit<
| 'description'
| 'descriptionPlacement'
| 'hotkeys'
+ | 'hotkeysJoinLabel'
| 'hasSubmenu'
> & {
render?: ReactElement;
diff --git a/packages/twenty-ui/src/components/navigation/MenuItem/MenuItem.tsx b/packages/twenty-ui/src/components/navigation/MenuItem/MenuItem.tsx
index 81d1c38da29..c786540b3a7 100644
--- a/packages/twenty-ui/src/components/navigation/MenuItem/MenuItem.tsx
+++ b/packages/twenty-ui/src/components/navigation/MenuItem/MenuItem.tsx
@@ -37,6 +37,7 @@ export const MenuItem = ({
focused = false,
selected = false,
hotKeys,
+ hotKeysJoinLabel,
isSubMenuOpened = false,
}: MenuItemProps) => {
const theme = useTheme();
@@ -78,7 +79,9 @@ export const MenuItem = ({
{iconButtons}
</StyledMenuItemRightContent>
)}
- {hotKeys && <MenuItemHotKeys hotKeys={hotKeys} />}
+ {hotKeys && (
+ <MenuItemHotKeys hotKeys={hotKeys} joinLabel={hotKeysJoinLabel} />
+ )}
{RightIcon && (
<RightIcon size={theme.icon.size.md} stroke={theme.icon.stroke.sm} />
)}
diff --git a/packages/twenty-ui/src/components/navigation/MenuItem/types/MenuItemProps.ts b/packages/twenty-ui/src/components/navigation/MenuItem/types/MenuItemProps.ts
index a085ff9366b..68672c23a80 100644
--- a/packages/twenty-ui/src/components/navigation/MenuItem/types/MenuItemProps.ts
+++ b/packages/twenty-ui/src/components/navigation/MenuItem/types/MenuItemProps.ts
@@ -29,5 +29,6 @@ export type MenuItemProps = {
focused?: boolean;
selected?: boolean;
hotKeys?: Nullable<string[]>;
+ hotKeysJoinLabel?: string;
isSubMenuOpened?: boolean;
};
diff --git a/packages/twenty-ui/src/primitives/navigation/ListItem/ListItem.tsx b/packages/twenty-ui/src/primitives/navigation/ListItem/ListItem.tsx
index 0f4b5d6b8e7..aea618ea03a 100644
--- a/packages/twenty-ui/src/primitives/navigation/ListItem/ListItem.tsx
+++ b/packages/twenty-ui/src/primitives/navigation/ListItem/ListItem.tsx
@@ -26,6 +26,7 @@ export const ListItem = ({
actions,
actionsVisibility = 'hover',
hotkeys,
+ hotkeysJoinLabel,
hasSubmenu = false,
className,
children,
@@ -94,7 +95,7 @@ export const ListItem = ({
)}
{isNonEmptyArray(hotkeys) && (
<span className={styles.hotkeys}>
- <MenuItemHotKeys hotKeys={hotkeys} />
+ <MenuItemHotKeys hotKeys={hotkeys} joinLabel={hotkeysJoinLabel} />
</span>
)}
{isRenderableSlot(endIcon) && (
diff --git a/packages/twenty-ui/src/primitives/navigation/ListItem/types/ListItemProps.ts b/packages/twenty-ui/src/primitives/navigation/ListItem/types/ListItemProps.ts
index 1a25bf50e72..edbbf92f6f6 100644
--- a/packages/twenty-ui/src/primitives/navigation/ListItem/types/ListItemProps.ts
+++ b/packages/twenty-ui/src/primitives/navigation/ListItem/types/ListItemProps.ts
@@ -45,6 +45,7 @@ export type ListItemProps = Omit<
* shortcut is up to the application.
*/
hotkeys?: string[];
+ hotkeysJoinLabel?: string;
/** Shows a chevron indicating that the item opens a submenu. */
hasSubmenu?: boolean;
};
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuCheckboxItem.tsx b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuCheckboxItem.tsx
index 607bd6118d6..088697d217f 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuCheckboxItem.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuCheckboxItem.tsx
@@ -9,6 +9,12 @@ export const MenuCheckboxItem = (props: MenuCheckboxItemProps) => (
{...getMenuListItemProps<
MenuPrimitive.CheckboxItem.State,
MenuCheckboxItemProps
- >(props, (state) => ({ indicator: 'checkbox', selected: state.checked }))}
+ >({
+ props,
+ getListItemState: (state) => ({
+ indicator: 'checkbox',
+ selected: state.checked,
+ }),
+ })}
/>
);
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuItem.tsx b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuItem.tsx
index ad7d76301a3..90c845e0b1f 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuItem.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuItem.tsx
@@ -6,8 +6,8 @@ import { getMenuListItemProps } from './getMenuListItemProps';
export const MenuItem = (props: MenuActionItemProps) => (
<MenuPrimitive.Item
- {...getMenuListItemProps<MenuPrimitive.Item.State, MenuActionItemProps>(
+ {...getMenuListItemProps<MenuPrimitive.Item.State, MenuActionItemProps>({
props,
- )}
+ })}
/>
);
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuRadioItem.tsx b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuRadioItem.tsx
index a351ac695b4..72c4e28b425 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuRadioItem.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuRadioItem.tsx
@@ -7,8 +7,13 @@ import { getMenuListItemProps } from './getMenuListItemProps';
export const MenuRadioItem = (props: MenuRadioItemProps) => (
<MenuPrimitive.RadioItem
{...getMenuListItemProps<MenuPrimitive.RadioItem.State, MenuRadioItemProps>(
- props,
- (state) => ({ indicator: 'check', selected: state.checked }),
+ {
+ props,
+ getListItemState: (state) => ({
+ indicator: 'check',
+ selected: state.checked,
+ }),
+ },
)}
/>
);
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuSubmenuTrigger.tsx b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuSubmenuTrigger.tsx
index 8c754aa0e60..24c114fc91a 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuSubmenuTrigger.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/MenuSubmenuTrigger.tsx
@@ -9,6 +9,6 @@ export const MenuSubmenuTrigger = (props: MenuSubmenuTriggerProps) => (
{...getMenuListItemProps<
MenuPrimitive.SubmenuTrigger.State,
MenuSubmenuTriggerProps
- >(props, () => ({ hasSubmenu: true }))}
+ >({ props, getListItemState: () => ({ hasSubmenu: true }) })}
/>
);
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/getMenuListItemProps.tsx b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/getMenuListItemProps.tsx
index 9bd0612c303..d1e491c7451 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/internal/getMenuListItemProps.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/internal/getMenuListItemProps.tsx
@@ -16,23 +16,27 @@ type MenuListItemProps<TState> = MenuItemSlotProps & {
export const getMenuListItemProps = <
TState,
TProps extends MenuListItemProps<TState>,
->(
- {
+>({
+ props: {
color = 'neutral',
startIcon,
endIcon,
description,
descriptionPlacement,
hotkeys,
+ hotkeysJoinLabel,
disabled = false,
children,
render,
...props
- }: TProps,
+ },
+ getListItemState,
+}: {
+ props: TProps;
getListItemState?: (
state: TState,
- ) => Pick<ListItemProps, 'indicator' | 'selected' | 'hasSubmenu'>,
-) => ({
+ ) => Pick<ListItemProps, 'indicator' | 'selected' | 'hasSubmenu'>;
+}) => ({
...props,
disabled,
render: (renderProps: HTMLProps, state: TState) => (
@@ -50,6 +54,7 @@ export const getMenuListItemProps = <
description={description}
descriptionPlacement={descriptionPlacement}
hotkeys={hotkeys}
+ hotkeysJoinLabel={hotkeysJoinLabel}
{...getListItemState?.(state)}
>
{children}
diff --git a/packages/twenty-ui/src/primitives/surfaces/Menu/types/MenuItemSlotProps.ts b/packages/twenty-ui/src/primitives/surfaces/Menu/types/MenuItemSlotProps.ts
index 7714986a523..192e684e32d 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Menu/types/MenuItemSlotProps.ts
+++ b/packages/twenty-ui/src/primitives/surfaces/Menu/types/MenuItemSlotProps.ts
@@ -8,4 +8,5 @@ export type MenuItemSlotProps = Pick<
| 'description'
| 'descriptionPlacement'
| 'hotkeys'
+ | 'hotkeysJoinLabel'
>;