Skip to content

The open alternative to Salesforce, designed for AI.

Add ListItem to twenty-ui (#25596)

Raphaël Bosi18272fa04d1f
diff --git a/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss b/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss
new file mode 100644
index 00000000000..847a819c5d1
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss
@@ -0,0 +1,136 @@
+.root {
+ --tw-list-item-color: var(--t-font-color-secondary);
+ --tw-list-item-background: transparent;
+ --tw-list-item-hover-background: var(--t-background-transparent-light);
+
+ align-items: center;
+ background: var(--tw-list-item-background);
+ border-radius: calc(var(--t-border-radius-md) - var(--t-spacing-1));
+ color: var(--tw-list-item-color);
+ cursor: pointer;
+ display: flex;
+ font-family: var(--t-font-family);
+ font-size: var(--t-font-size-md);
+ font-weight: var(--t-font-weight-regular);
+ gap: var(--t-spacing-2);
+ inline-size: 100%;
+ min-block-size: 32px;
+ padding-block: 0;
+ padding-inline: var(--t-spacing-1);
+ position: relative;
+ transition: background duration(instant) ease;
+ user-select: none;
+
+ @include focus-ring;
+
+ @include hover-capable {
+ &:hover {
+ --tw-list-item-background: var(--tw-list-item-hover-background);
+ }
+ }
+
+ &[data-highlighted],
+ &[data-selected][data-indicator='none'] {
+ --tw-list-item-background: var(--t-background-transparent-light);
+ }
+
+ &[data-color='danger'] {
+ --tw-list-item-color: var(--t-font-color-danger);
+ --tw-list-item-hover-background: var(--t-background-transparent-danger);
+ }
+
+ &[data-disabled] {
+ --tw-list-item-color: var(--t-font-color-tertiary);
+ --tw-list-item-hover-background: transparent;
+
+ cursor: default;
+ transition: none;
+ }
+}
+
+.startIcon,
+.endIcon {
+ align-items: center;
+ display: inline-flex;
+ flex: none;
+
+ > svg {
+ block-size: calc(var(--t-icon-size-md) * 1px);
+ inline-size: calc(var(--t-icon-size-md) * 1px);
+ stroke-width: var(--t-icon-stroke-sm);
+ }
+}
+
+.label {
+ align-items: baseline;
+ display: flex;
+ flex: 1;
+ gap: var(--t-spacing-1);
+ min-inline-size: 0;
+ overflow: hidden;
+ white-space: nowrap;
+}
+
+.text {
+ flex-shrink: 0;
+ max-inline-size: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+
+.description {
+ color: var(--t-font-color-light);
+ min-inline-size: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.inlineDescription::before {
+ content: '·';
+ margin-inline-end: var(--t-spacing-1);
+}
+
+.endDescription {
+ flex-shrink: 1;
+ text-align: end;
+}
+
+.hotkeys {
+ display: inline-flex;
+ flex: none;
+ font-size: var(--t-font-size-sm);
+}
+
+.actions {
+ align-items: center;
+ display: inline-flex;
+ flex: none;
+ transition: opacity duration(instant) ease;
+}
+
+@include hover-capable {
+ .actions {
+ opacity: 0;
+ }
+
+ .root:hover .actions,
+ .root:focus-within .actions {
+ opacity: 1;
+ }
+}
+
+.checkIndicator {
+ block-size: calc(var(--t-icon-size-md) * 1px);
+ flex: none;
+ inline-size: calc(var(--t-icon-size-md) * 1px);
+ stroke-width: var(--t-icon-stroke-sm);
+}
+
+.submenuIcon {
+ block-size: calc(var(--t-icon-size-sm) * 1px);
+ color: var(--t-font-color-light);
+ flex: none;
+ inline-size: calc(var(--t-icon-size-sm) * 1px);
+ stroke-width: var(--t-icon-stroke-sm);
+}
diff --git a/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss.d.ts b/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss.d.ts
new file mode 100644
index 00000000000..697e1b7f6c7
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/ListItem.module.scss.d.ts
@@ -0,0 +1,15 @@
+declare const classNames: {
+ readonly root: 'root';
+ readonly actions: 'actions';
+ readonly startIcon: 'startIcon';
+ readonly endIcon: 'endIcon';
+ readonly label: 'label';
+ readonly text: 'text';
+ readonly description: 'description';
+ readonly inlineDescription: 'inlineDescription';
+ readonly endDescription: 'endDescription';
+ readonly hotkeys: 'hotkeys';
+ readonly checkIndicator: 'checkIndicator';
+ readonly submenuIcon: 'submenuIcon';
+};
+export default classNames;
diff --git a/packages/twenty-ui/src/navigation/ListItem/ListItem.tsx b/packages/twenty-ui/src/navigation/ListItem/ListItem.tsx
new file mode 100644
index 00000000000..334d0a24197
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/ListItem.tsx
@@ -0,0 +1,98 @@
+import { useRender } from '@base-ui/react/use-render';
+import { isNonEmptyArray } from '@sniptt/guards';
+import { clsx } from 'clsx';
+import { type MouseEvent } from 'react';
+
+import { IconCheck, IconChevronRight } from '@ui/icon';
+import { MenuItemHotKeys } from '@ui/navigation/MenuItemHotKeys/MenuItemHotKeys';
+
+import { isRenderableSlot } from './internal/isRenderableSlot';
+import { ListItemCheckboxIndicator } from './internal/ListItemCheckboxIndicator';
+import styles from './ListItem.module.scss';
+import { type ListItemProps } from './types/ListItemProps';
+
+export const ListItem = ({
+ color = 'neutral',
+ selected = false,
+ focused = false,
+ disabled = false,
+ indicator = 'none',
+ startIcon,
+ endIcon,
+ description,
+ descriptionPlacement = 'inline',
+ actions,
+ hotkeys,
+ submenu = false,
+ className,
+ children,
+ render,
+ ref,
+ onClick,
+ ...props
+}: ListItemProps) => {
+ const hasDescription = isRenderableSlot(description);
+
+ const handleClick = (event: MouseEvent<HTMLDivElement>) => {
+ if (disabled) {
+ event.preventDefault();
+ return;
+ }
+
+ onClick?.(event);
+ };
+
+ return useRender({
+ render,
+ ref,
+ state: { color, indicator, selected, highlighted: focused, disabled },
+ props: {
+ ...props,
+ className: clsx(styles.root, className),
+ 'aria-disabled': disabled || undefined,
+ onClick: handleClick,
+ children: (
+ <>
+ {indicator === 'checkbox' && (
+ <ListItemCheckboxIndicator checked={selected} disabled={disabled} />
+ )}
+ {isRenderableSlot(startIcon) && (
+ <div className={styles.startIcon}>{startIcon}</div>
+ )}
+ <div className={styles.label}>
+ <div className={styles.text}>{children}</div>
+ {hasDescription && descriptionPlacement === 'inline' && (
+ <div
+ className={clsx(styles.description, styles.inlineDescription)}
+ >
+ {description}
+ </div>
+ )}
+ </div>
+ {hasDescription && descriptionPlacement === 'end' && (
+ <div className={clsx(styles.description, styles.endDescription)}>
+ {description}
+ </div>
+ )}
+ {isRenderableSlot(actions) && (
+ <div className={styles.actions}>{actions}</div>
+ )}
+ {isNonEmptyArray(hotkeys) && (
+ <div className={styles.hotkeys}>
+ <MenuItemHotKeys hotKeys={hotkeys} />
+ </div>
+ )}
+ {isRenderableSlot(endIcon) && (
+ <div className={styles.endIcon}>{endIcon}</div>
+ )}
+ {indicator === 'check' && selected && (
+ <IconCheck className={styles.checkIndicator} aria-hidden />
+ )}
+ {submenu && (
+ <IconChevronRight className={styles.submenuIcon} aria-hidden />
+ )}
+ </>
+ ),
+ },
+ });
+};
diff --git a/packages/twenty-ui/src/navigation/ListItem/__stories__/ListItem.stories.tsx b/packages/twenty-ui/src/navigation/ListItem/__stories__/ListItem.stories.tsx
new file mode 100644
index 00000000000..505b5bbfc6e
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/__stories__/ListItem.stories.tsx
@@ -0,0 +1,189 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { action } from 'storybook/actions';
+
+import {
+ A11Y_DEFER_COLOR_CONTRAST,
+ CatalogDecorator,
+ type CatalogStory,
+ ComponentDecorator,
+} from '@ui/testing';
+
+import { IconBell, IconEdit, IconSettings, IconTrash } from '@ui/icon';
+import { LightIconButton } from '@ui/input/LightIconButton/LightIconButton';
+import { ListItem } from '@ui/navigation/ListItem/ListItem';
+import { type ListItemColor } from '@ui/navigation/ListItem/types/ListItemColor';
+import { type ListItemIndicator } from '@ui/navigation/ListItem/types/ListItemIndicator';
+import { type ListItemProps } from '@ui/navigation/ListItem/types/ListItemProps';
+
+const meta: Meta<typeof ListItem> = {
+ title: 'UI/Navigation/ListItem',
+ component: ListItem,
+ args: { children: 'List item' },
+};
+
+export default meta;
+
+type Story = StoryObj<typeof ListItem>;
+
+const START_ICON = <IconBell />;
+
+const ACTIONS = (
+ <>
+ <LightIconButton
+ Icon={IconEdit}
+ aria-label="Edit"
+ onClick={action('Edit')}
+ />
+ <LightIconButton
+ Icon={IconTrash}
+ aria-label="Delete"
+ onClick={action('Delete')}
+ />
+ </>
+);
+
+export const Default: Story = {
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 240 } },
+ args: { startIcon: START_ICON },
+};
+
+export const WithDescription: Story = {
+ decorators: [ComponentDecorator],
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ container: { width: 240 },
+ },
+ args: { startIcon: START_ICON, description: 'Description' },
+};
+
+export const WithActions: Story = {
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 240 } },
+ args: { startIcon: START_ICON, actions: ACTIONS },
+};
+
+export const WithCheckbox: Story = {
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 240 } },
+ args: { indicator: 'checkbox', selected: true },
+};
+
+type ListItemCatalogState =
+ | 'default'
+ | 'hover'
+ | 'highlighted'
+ | 'selected'
+ | 'disabled';
+
+const LIST_ITEM_CATALOG_STATE_PROPS: Record<
+ ListItemCatalogState,
+ Partial<ListItemProps>
+> = {
+ default: {},
+ hover: { className: 'hover' },
+ highlighted: { focused: true },
+ selected: { selected: true },
+ disabled: { disabled: true },
+};
+
+export const Catalog: CatalogStory<Story, typeof ListItem> = {
+ args: { startIcon: START_ICON },
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ pseudo: { hover: ['.hover'] },
+ catalog: {
+ dimensions: [
+ {
+ name: 'color',
+ values: ['neutral', 'danger'] satisfies ListItemColor[],
+ props: (color: ListItemColor) => ({ color }),
+ },
+ {
+ name: 'state',
+ values: [
+ 'default',
+ 'hover',
+ 'highlighted',
+ 'selected',
+ 'disabled',
+ ] satisfies ListItemCatalogState[],
+ props: (state: ListItemCatalogState) =>
+ LIST_ITEM_CATALOG_STATE_PROPS[state],
+ },
+ {
+ name: 'indicator',
+ values: ['none', 'check', 'checkbox'] satisfies ListItemIndicator[],
+ props: (indicator: ListItemIndicator) => ({ indicator }),
+ },
+ ],
+ options: {
+ elementContainer: { style: { width: 180 } },
+ },
+ },
+ },
+ decorators: [CatalogDecorator],
+};
+
+type ListItemCatalogSlot =
+ | 'startIcon'
+ | 'endIcon'
+ | 'description'
+ | 'endDescription'
+ | 'hotkeys'
+ | 'actions'
+ | 'submenu';
+
+const LIST_ITEM_CATALOG_SLOT_PROPS: Record<
+ ListItemCatalogSlot,
+ Partial<ListItemProps>
+> = {
+ startIcon: { startIcon: START_ICON },
+ endIcon: { endIcon: <IconSettings /> },
+ description: { description: 'Description' },
+ endDescription: { description: '3 selected', descriptionPlacement: 'end' },
+ hotkeys: { hotkeys: ['⌘', 'K'] },
+ actions: { actions: ACTIONS },
+ submenu: { submenu: true },
+};
+
+export const SlotsCatalog: CatalogStory<Story, typeof ListItem> = {
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ pseudo: { hover: ['.hover'] },
+ catalog: {
+ dimensions: [
+ {
+ name: 'state',
+ values: ['default', 'hover'] satisfies ListItemCatalogState[],
+ props: (state: ListItemCatalogState) =>
+ LIST_ITEM_CATALOG_STATE_PROPS[state],
+ },
+ {
+ name: 'slot',
+ values: [
+ 'startIcon',
+ 'endIcon',
+ 'description',
+ 'endDescription',
+ 'hotkeys',
+ 'actions',
+ 'submenu',
+ ] satisfies ListItemCatalogSlot[],
+ props: (slot: ListItemCatalogSlot) =>
+ LIST_ITEM_CATALOG_SLOT_PROPS[slot],
+ },
+ ],
+ options: {
+ elementContainer: { style: { width: 180 } },
+ },
+ },
+ },
+ decorators: [CatalogDecorator],
+};
+
+export const CatalogDark: CatalogStory<Story, typeof ListItem> = {
+ ...Catalog,
+ tags: ['!autodocs'],
+ globals: { colorScheme: 'dark' },
+};
diff --git a/packages/twenty-ui/src/navigation/ListItem/__tests__/ListItem.test.tsx b/packages/twenty-ui/src/navigation/ListItem/__tests__/ListItem.test.tsx
new file mode 100644
index 00000000000..9b449d9140c
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/__tests__/ListItem.test.tsx
@@ -0,0 +1,234 @@
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { vi } from 'vitest';
+
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { ListItem } from '../ListItem';
+import styles from '../ListItem.module.scss';
+
+runComponentConformance({
+ name: 'ListItem',
+ element: <ListItem>Item</ListItem>,
+ refInstanceOf: HTMLDivElement,
+ ownClassName: styles.root,
+});
+
+describe('ListItem', () => {
+ it('renders its children, icons and inline description', () => {
+ render(
+ <ListItem
+ startIcon={<span>start</span>}
+ endIcon={<span>end</span>}
+ description="Description"
+ >
+ Item
+ </ListItem>,
+ );
+
+ expect(screen.getByText('Item')).toBeInTheDocument();
+ expect(screen.getByText('start')).toBeInTheDocument();
+ expect(screen.getByText('end')).toBeInTheDocument();
+ expect(screen.getByText('Description')).toHaveClass(
+ styles.inlineDescription,
+ );
+ });
+
+ it('places the description at the end on demand', () => {
+ render(
+ <ListItem description="Description" descriptionPlacement="end">
+ Item
+ </ListItem>,
+ );
+
+ expect(screen.getByText('Description')).toHaveClass(styles.endDescription);
+ });
+
+ it('renders every hotkey', () => {
+ render(<ListItem hotkeys={['⌘', 'K']}>Item</ListItem>);
+
+ expect(screen.getByText('⌘')).toBeInTheDocument();
+ expect(screen.getByText('K')).toBeInTheDocument();
+ });
+
+ it('renders a chevron only when it opens a submenu', () => {
+ const { container, rerender } = render(<ListItem>Item</ListItem>);
+
+ expect(container.querySelector('svg')).toBeNull();
+
+ rerender(<ListItem submenu>Item</ListItem>);
+
+ expect(container.querySelectorAll('svg')).toHaveLength(1);
+ });
+
+ it('calls onClick and lets the click bubble without preventing its default', async () => {
+ const user = userEvent.setup();
+ const onClick = vi.fn();
+ const onAncestorClick = vi.fn();
+
+ const { container } = render(<ListItem onClick={onClick}>Item</ListItem>);
+
+ container.addEventListener('click', onAncestorClick);
+
+ await user.click(screen.getByText('Item'));
+
+ expect(onClick).toHaveBeenCalledTimes(1);
+ expect(onClick.mock.calls[0][0].defaultPrevented).toBe(false);
+ expect(onAncestorClick).toHaveBeenCalledTimes(1);
+ });
+
+ it('ignores clicks and exposes its state when disabled', async () => {
+ const user = userEvent.setup();
+ const onClick = vi.fn();
+
+ render(
+ <ListItem disabled onClick={onClick} data-testid="item">
+ Item
+ </ListItem>,
+ );
+
+ const item = screen.getByTestId('item');
+
+ await user.click(item);
+
+ expect(onClick).not.toHaveBeenCalled();
+ expect(item).toHaveAttribute('aria-disabled', 'true');
+ expect(item).toHaveAttribute('data-disabled');
+ });
+
+ it('cancels the native action of a disabled polymorphic root', async () => {
+ const user = userEvent.setup();
+ const onClick = vi.fn();
+ const onAncestorClick = vi.fn();
+
+ const { container } = render(
+ <ListItem
+ disabled
+ onClick={onClick}
+ render={<a href="#target" aria-label="Item link" />}
+ >
+ Item
+ </ListItem>,
+ );
+
+ container.addEventListener('click', onAncestorClick);
+
+ await user.click(screen.getByText('Item'));
+
+ expect(screen.getByText('Item').closest('a')).toHaveAttribute(
+ 'href',
+ '#target',
+ );
+ expect(onClick).not.toHaveBeenCalled();
+ expect(onAncestorClick.mock.calls[0][0].defaultPrevented).toBe(true);
+ });
+
+ it('exposes its state as data attributes', () => {
+ const { rerender } = render(<ListItem data-testid="item">Item</ListItem>);
+
+ const item = screen.getByTestId('item');
+
+ expect(item).not.toHaveAttribute('data-selected');
+ expect(item).not.toHaveAttribute('data-highlighted');
+ expect(item).not.toHaveAttribute('data-disabled');
+ expect(item).toHaveAttribute('data-color', 'neutral');
+ expect(item).toHaveAttribute('data-indicator', 'none');
+
+ rerender(
+ <ListItem
+ data-testid="item"
+ selected
+ focused
+ color="danger"
+ indicator="check"
+ >
+ Item
+ </ListItem>,
+ );
+
+ expect(item).toHaveAttribute('data-selected');
+ expect(item).toHaveAttribute('data-highlighted');
+ expect(item).toHaveAttribute('data-color', 'danger');
+ expect(item).toHaveAttribute('data-indicator', 'check');
+ });
+
+ it('passes its state to a render function', () => {
+ render(
+ <ListItem
+ focused
+ render={(props, state) => (
+ <div
+ {...props}
+ data-testid="item"
+ data-render-highlighted={state.highlighted}
+ />
+ )}
+ >
+ Item
+ </ListItem>,
+ );
+
+ expect(screen.getByTestId('item')).toHaveAttribute(
+ 'data-render-highlighted',
+ 'true',
+ );
+ });
+
+ it('shows the check indicator only when selected', () => {
+ const { container, rerender } = render(
+ <ListItem indicator="check">Item</ListItem>,
+ );
+
+ expect(container.querySelector('svg')).toBeNull();
+
+ rerender(
+ <ListItem indicator="check" selected>
+ Item
+ </ListItem>,
+ );
+
+ expect(container.querySelectorAll('svg')).toHaveLength(1);
+ });
+
+ it('renders a decorative checkbox that follows the selected state', () => {
+ const { container, rerender } = render(
+ <ListItem indicator="checkbox">Item</ListItem>,
+ );
+
+ expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(container.querySelector('[data-checked]')).toBeNull();
+
+ rerender(
+ <ListItem indicator="checkbox" selected>
+ Item
+ </ListItem>,
+ );
+
+ expect(screen.queryByRole('checkbox')).toBeNull();
+ expect(container.querySelector('[data-checked]')).not.toBeNull();
+ });
+
+ it('lets an action click reach both the action and the item', async () => {
+ const user = userEvent.setup();
+ const onClick = vi.fn();
+ const onActionClick = vi.fn();
+
+ render(
+ <ListItem
+ onClick={onClick}
+ actions={
+ <button type="button" onClick={onActionClick}>
+ Delete
+ </button>
+ }
+ >
+ Item
+ </ListItem>,
+ );
+
+ await user.click(screen.getByRole('button', { name: 'Delete' }));
+
+ expect(onActionClick).toHaveBeenCalledTimes(1);
+ expect(onClick).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx b/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx
new file mode 100644
index 00000000000..863a9dec703
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/internal/ListItemCheckboxIndicator.tsx
@@ -0,0 +1,35 @@
+import { clsx } from 'clsx';
+
+import { IconCheck } from '@ui/icon';
+import checkboxStyles from '@ui/input/Checkbox/Checkbox.module.scss';
+
+type ListItemCheckboxIndicatorProps = {
+ checked: boolean;
+ disabled: boolean;
+};
+
+export const ListItemCheckboxIndicator = ({
+ checked,
+ disabled,
+}: ListItemCheckboxIndicatorProps) => (
+ <span
+ aria-hidden
+ className={clsx(
+ checkboxStyles.root,
+ checkboxStyles.primary,
+ checkboxStyles.small,
+ checkboxStyles.squared,
+ checkboxStyles.blue,
+ )}
+ data-checked={checked || undefined}
+ data-disabled={disabled || undefined}
+ >
+ <span className={checkboxStyles.box}>
+ {checked && (
+ <span className={checkboxStyles.indicator}>
+ <IconCheck aria-hidden />
+ </span>
+ )}
+ </span>
+ </span>
+);
diff --git a/packages/twenty-ui/src/navigation/ListItem/internal/isRenderableSlot.ts b/packages/twenty-ui/src/navigation/ListItem/internal/isRenderableSlot.ts
new file mode 100644
index 00000000000..43cb770c0aa
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/internal/isRenderableSlot.ts
@@ -0,0 +1,7 @@
+import { isBoolean } from '@sniptt/guards';
+import { type ReactNode } from 'react';
+
+import { isDefined } from '@ui/utilities/utils/isDefined';
+
+export const isRenderableSlot = (slot: ReactNode) =>
+ isDefined(slot) && !isBoolean(slot) && slot !== '';
diff --git a/packages/twenty-ui/src/navigation/ListItem/types/ListItemColor.ts b/packages/twenty-ui/src/navigation/ListItem/types/ListItemColor.ts
new file mode 100644
index 00000000000..57feba73f81
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/types/ListItemColor.ts
@@ -0,0 +1 @@
+export type ListItemColor = 'neutral' | 'danger';
diff --git a/packages/twenty-ui/src/navigation/ListItem/types/ListItemDescriptionPlacement.ts b/packages/twenty-ui/src/navigation/ListItem/types/ListItemDescriptionPlacement.ts
new file mode 100644
index 00000000000..4bf7a3e5b21
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/types/ListItemDescriptionPlacement.ts
@@ -0,0 +1 @@
+export type ListItemDescriptionPlacement = 'inline' | 'end';
diff --git a/packages/twenty-ui/src/navigation/ListItem/types/ListItemIndicator.ts b/packages/twenty-ui/src/navigation/ListItem/types/ListItemIndicator.ts
new file mode 100644
index 00000000000..8c95f9622bf
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/types/ListItemIndicator.ts
@@ -0,0 +1 @@
+export type ListItemIndicator = 'none' | 'check' | 'checkbox';
diff --git a/packages/twenty-ui/src/navigation/ListItem/types/ListItemProps.ts b/packages/twenty-ui/src/navigation/ListItem/types/ListItemProps.ts
new file mode 100644
index 00000000000..7fa21f209b5
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/types/ListItemProps.ts
@@ -0,0 +1,25 @@
+import { type useRender } from '@base-ui/react/use-render';
+import { type ReactNode } from 'react';
+
+import { type ListItemColor } from './ListItemColor';
+import { type ListItemDescriptionPlacement } from './ListItemDescriptionPlacement';
+import { type ListItemIndicator } from './ListItemIndicator';
+import { type ListItemState } from './ListItemState';
+
+export type ListItemProps = Omit<
+ useRender.ComponentProps<'div', ListItemState>,
+ 'color'
+> & {
+ color?: ListItemColor;
+ selected?: boolean;
+ focused?: boolean;
+ disabled?: boolean;
+ indicator?: ListItemIndicator;
+ startIcon?: ReactNode;
+ endIcon?: ReactNode;
+ description?: ReactNode;
+ descriptionPlacement?: ListItemDescriptionPlacement;
+ actions?: ReactNode;
+ hotkeys?: string[];
+ submenu?: boolean;
+};
diff --git a/packages/twenty-ui/src/navigation/ListItem/types/ListItemState.ts b/packages/twenty-ui/src/navigation/ListItem/types/ListItemState.ts
new file mode 100644
index 00000000000..726aa01f1a5
--- /dev/null
+++ b/packages/twenty-ui/src/navigation/ListItem/types/ListItemState.ts
@@ -0,0 +1,10 @@
+import { type ListItemColor } from './ListItemColor';
+import { type ListItemIndicator } from './ListItemIndicator';
+
+export type ListItemState = {
+ color: ListItemColor;
+ indicator: ListItemIndicator;
+ selected: boolean;
+ highlighted: boolean;
+ disabled: boolean;
+};
diff --git a/packages/twenty-ui/src/navigation/index.ts b/packages/twenty-ui/src/navigation/index.ts
index 481fa892005..4566879b381 100644
--- a/packages/twenty-ui/src/navigation/index.ts
+++ b/packages/twenty-ui/src/navigation/index.ts
@@ -13,6 +13,12 @@ export { GithubVersionLink } from './GithubVersionLink/GithubVersionLink';
export { CAL_LINK } from './Link/constants/Cal';
export { GITHUB_LINK } from './Link/constants/GithubLink';
export { TWENTY_PRICING_LINK } from './Link/constants/TwentyPricingLink';
+export { ListItem } from './ListItem/ListItem';
+export type { ListItemColor } from './ListItem/types/ListItemColor';
+export type { ListItemDescriptionPlacement } from './ListItem/types/ListItemDescriptionPlacement';
+export type { ListItemIndicator } from './ListItem/types/ListItemIndicator';
+export type { ListItemProps } from './ListItem/types/ListItemProps';
+export type { ListItemState } from './ListItem/types/ListItemState';
export type { ColorLabels } from './MenuItem/constants/DefaultColorLabels';
export { DEFAULT_COLOR_LABELS } from './MenuItem/constants/DefaultColorLabels';
export type { MenuItemIconButton, MenuItemProps } from './MenuItem/MenuItem';