The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Document data display primitives (#25980)
Raphaël Bosi82e015159138
diff --git a/packages/twenty-docs/docs.json b/packages/twenty-docs/docs.jsonindex da66be85925..c288de634cf 100644--- a/packages/twenty-docs/docs.json+++ b/packages/twenty-docs/docs.json@@ -510,6 +510,15 @@"ui/accessibility"]},+ {+ "group": "Data display",+ "pages": [+ "ui/components/data-display/avatar",+ "ui/components/data-display/chip",+ "ui/components/data-display/tag",+ "ui/components/data-display/status"+ ]+ },{"group": "Forms","pages": [diff --git a/packages/twenty-docs/navigation/base-structure.json b/packages/twenty-docs/navigation/base-structure.jsonindex e5407e8f2a6..c26460db52a 100644--- a/packages/twenty-docs/navigation/base-structure.json+++ b/packages/twenty-docs/navigation/base-structure.json@@ -518,6 +518,16 @@"ui/accessibility"]},+ {+ "key": "uiDataDisplay",+ "label": "Data display",+ "pages": [+ "ui/components/data-display/avatar",+ "ui/components/data-display/chip",+ "ui/components/data-display/tag",+ "ui/components/data-display/status"+ ]+ },{"key": "uiForms","label": "Forms",diff --git a/packages/twenty-docs/navigation/navigation.template.json b/packages/twenty-docs/navigation/navigation.template.jsonindex ec8a4e2f2a6..532c673609f 100644--- a/packages/twenty-docs/navigation/navigation.template.json+++ b/packages/twenty-docs/navigation/navigation.template.json@@ -203,6 +203,9 @@"uiGuides": {"label": "Guides"},+ "uiDataDisplay": {+ "label": "Data display"+ },"uiForms": {"label": "Forms"},diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdxnew file mode 100644index 00000000000..d8d6bbc694b--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/data-display/avatar.mdx@@ -0,0 +1,81 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | 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="backgroundColor" type="string">+ Background color override for a first-letter fallback.+</ParamField>++<ParamField body="borderColor" type="string">+ Border color override for the outline fallback.+</ParamField>++<ParamField body="className" type="string | ((state: AvatarRootState) => string | undefined)">+ CSS class applied to the element, or a function that+ returns a class based on the component's state.+</ParamField>++<ParamField body="color" type="string">+ Text color override for a first-letter fallback.+</ParamField>++<ParamField body="colorSeed" type="string">+ Stable value used to choose fallback colors. Defaults to `name`.+</ParamField>++<ParamField body="disabled" type="boolean" default="false">+ Applies disabled styling and disables activation when `onClick` is supplied.+</ParamField>++<ParamField body="icon" type="ReactNode">+ Icon rendered instead of the image and first-letter fallback.+</ParamField>++<ParamField body="name" type="string">+ Name used for the first-letter fallback and the default accessible name when clickable.+</ParamField>++<ParamField body="nativeButton" type="boolean" default="true">+ Set to `false` when a clickable avatar uses `render` with an element other than a native button.+</ParamField>++<ParamField body="pulsing" type="boolean" default="false">+ Animates the avatar opacity. Respects reduced-motion preferences.+</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, AvatarRootState>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="shape" type=""circle" | "square" | "rounded-square"" default="square">+ Shape of the avatar and its fallback.+</ParamField>++<ParamField body="size" type=""sm" | "md" | "lg" | "xl" | "xs"" default="md">+ Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).+</ParamField>++<ParamField body="src" type="string | null">+ Image URL. A missing or failed image shows the fallback.+</ParamField>++<ParamField body="style" type="CSSProperties | ((state: AvatarRootState) => CSSProperties | undefined)">+ Style applied to the element, or a function that+ returns a style object based on the component's state.+</ParamField>++<ParamField body="variant" type=""outline" | "soft"" default="soft">+ Visual treatment of the fallback.+</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdxnew file mode 100644index 00000000000..97651374594--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/data-display/chip.mdx@@ -0,0 +1,91 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | 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="alwaysShowTooltip" type="boolean" default="false">+ Shows the string-label tooltip even when the label is not truncated.+</ParamField>++<ParamField body="clickable" type="boolean" default="isDefined(onClick)">+ Enables hover and pointer styling. Defaults to whether `onClick` is supplied; does not add button semantics by itself.+</ParamField>++<ParamField body="color" type=""primary" | "secondary"" default="primary">+ Primary or secondary text color.+</ParamField>++<ParamField body="disabled" type="boolean" default="false">+ Applies disabled styling and disables activation when `onClick` is supplied.+</ParamField>++<ParamField body="emptyLabel" type="string" default="Untitled">+ Placeholder shown when children are missing, empty, or false, unless `forceEmptyText` is enabled.+</ParamField>++<ParamField body="endElement" type="ReactNode">+ Content after the label. Avoid interactive content when the chip itself is a button.+</ParamField>++<ParamField body="endElementDivider" type="boolean" default="false">+ Adds a divider before `endElement` when that slot has content.+</ParamField>++<ParamField body="forceEmptyText" type="boolean" default="false">+ Suppresses the empty label when children are missing, empty, or false.+</ParamField>++<ParamField body="isLabelHidden" type="boolean" default="false">+ Hides the label while keeping the start and end elements. Supply an accessible name for an interactive chip.+</ParamField>++<ParamField body="maxWidth" type="number">+ Maximum chip width in pixels, used to constrain and truncate the label.+</ParamField>++<ParamField body="nativeButton" type="boolean" default="true">+ Set to `false` when a clickable chip uses `render` with an element other than a native button.+</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="shape" type=""square" | "round"" default="square">+ Square or round corners.+</ParamField>++<ParamField body="size" type=""sm" | "md"" default="sm">+ Visual size of the chip.+</ParamField>++<ParamField body="startElement" type="ReactNode">+ Content before the label, such as an avatar or icon.+</ParamField>++<ParamField body="tooltipLabel" type="string">+ Tooltip content for a string label. Defaults to the label text.+</ParamField>++<ParamField body="tooltipPlace" type=""top" | "left" | "right" | "bottom"">+ Position of the string-label tooltip.+</ParamField>++<ParamField body="variant" type=""solid" | "soft" | "ghost"" default="ghost">+ Background treatment of the chip.+</ParamField>++<ParamField body="weight" type=""regular" | "medium"" default="regular">+ Font weight of the label.+</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/status.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/status.mdxnew file mode 100644index 00000000000..2d7f9002e54--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/data-display/status.mdx@@ -0,0 +1,40 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | 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="color" type=""ruby" | "red" | "crimson" | "tomato" | "orange" | "amber" | "yellow" | "lime" | "grass" | "green" | "jade" | "mint" | "turquoise" | "cyan" | "sky" | "blue" | "iris" | "violet" | "purple" | "plum" | "pink" | "bronze" | "gold" | "brown" | "gray"" required>+ Theme color used for the status background, text, and loader.+</ParamField>++<ParamField body="disabled" type="boolean" default="false">+ Applies disabled styling and disables activation when `onClick` is supplied.+</ParamField>++<ParamField body="loading" type="boolean" default="false">+ Shows a loader after the label. Does not disable the control or announce a status change by itself.+</ParamField>++<ParamField body="nativeButton" type="boolean" default="true">+ Set to `false` when using `render` with an element other than a native button.+</ParamField>++<ParamField body="onClick" type="MouseEventHandler<HTMLButtonElement> | MouseEventHandler<HTMLElement>">+ Handles activation and renders a native button by default. Without it, the default element is a span.+</ParamField>++<ParamField body="render" type="NonNullable<ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}> | undefined>">+ Replaces the default element. Required when `nativeButton` is `false`.+</ParamField>++<ParamField body="weight" type=""regular" | "medium"" default="regular">+ Font weight of the label.+</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/data-display/tag.mdx b/packages/twenty-docs/snippets/ui/generated/data-display/tag.mdxnew file mode 100644index 00000000000..b4db8ae0149--- /dev/null+++ b/packages/twenty-docs/snippets/ui/generated/data-display/tag.mdx@@ -0,0 +1,55 @@+{/*+ * _____ _+ *|_ _|_ _____ _ __ | |_ _ _+ * | | \ \ /\ / / _ \ '_ \| __| | | | 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="borderStyle" type=""solid" | "dashed"" default="solid">+ Border style used by the outline variant.+</ParamField>++<ParamField body="color" type=""ruby" | "red" | "crimson" | "tomato" | "orange" | "amber" | "yellow" | "lime" | "grass" | "green" | "jade" | "mint" | "turquoise" | "cyan" | "sky" | "blue" | "iris" | "violet" | "purple" | "plum" | "pink" | "bronze" | "gold" | "brown" | "gray" | "transparent"" required>+ Theme color for the tag, or `transparent` for an unfilled label.+</ParamField>++<ParamField body="disabled" type="boolean" default="false">+ Applies disabled styling and prevents pointer and keyboard activation.+</ParamField>++<ParamField body="nativeButton" type="boolean" default="true">+ Set to `false` when a clickable tag uses `render` with an element other than a native button.+</ParamField>++<ParamField body="preventPadding" type="boolean" default="false">+ Removes the tag padding.+</ParamField>++<ParamField body="preventShrink" type="boolean" default="false">+ Keeps the tag from shrinking and disables string-label truncation and its tooltip.+</ParamField>++<ParamField body="render" type="ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>">+ Allows you to replace the component's HTML element+ with a different tag, or compose it with another component.++ Accepts a `ReactElement` or a function that returns the element to render.+</ParamField>++<ParamField body="startIcon" type="ReactNode">+ Decorative icon before the label. Hidden from assistive technology.+</ParamField>++<ParamField body="variant" type=""solid" | "outline" | "soft" | "ghost"" default="soft">+ Visual treatment of the tag background and border.+</ParamField>++<ParamField body="weight" type=""regular" | "medium"" default="regular">+ Font weight of the label.+</ParamField>diff --git a/packages/twenty-docs/ui/components/data-display/avatar.mdx b/packages/twenty-docs/ui/components/data-display/avatar.mdxnew file mode 100644index 00000000000..5010291024f--- /dev/null+++ b/packages/twenty-docs/ui/components/data-display/avatar.mdx@@ -0,0 +1,78 @@+---+title: Avatar+description: Represent a person or record with an image, initial, or icon.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';++import AvatarReference from '/snippets/ui/generated/data-display/avatar.mdx';++`Avatar` shows an image with a first-letter fallback. Use it beside a record name or inside a [Chip](/ui/components/data-display/chip).++<StoryEmbed storyId="ui-data-display-avatar--app" title="Avatar example" />++## Image and fallback++```tsx+import { Avatar } from 'twenty-ui/primitives/data-display';++type PersonAvatarProps = { name: string; imageUrl?: string | null };++export const PersonAvatar = ({ name, imageUrl }: PersonAvatarProps) => (+ <span style={{ display: 'inline-flex', alignItems: 'center', gap: 8 }}>+ <Avatar src={imageUrl} name={name} shape="circle" size="lg" />+ {name}+ </span>+);+```++When the image is absent or fails to load, the fallback shows the first letter of the trimmed name in uppercase. An empty name shows `-`. `colorSeed` chooses stable fallback colors and defaults to `name`; use a record identifier to keep the color stable when the name changes.++The image and fallback are decorative. Keep the visible name beside the avatar, as above. For a standalone avatar that conveys information, supply `role="img"` and an `aria-label`.++## Shape and appearance++`shape` accepts `square`, `rounded-square`, or `circle`. Sizes run from `xs` (12px) to `xl` (40px); `md` is 16px. `variant="outline"` adds a border to the fallback. The `color`, `backgroundColor`, and `borderColor` overrides customize the fallback, while a loaded image keeps its original appearance.++```tsx+import { IconUser } from 'twenty-ui/icon';+import { Avatar } from 'twenty-ui/primitives/data-display';++export const ContactIcon = () => (+ <Avatar+ icon={<IconUser />}+ shape="rounded-square"+ size="xl"+ role="img"+ aria-label="Contact"+ />+);+```++An `icon` takes precedence over both the image and the first-letter fallback. `pulsing` animates opacity and respects reduced-motion preferences.++## Open a profile++```tsx+import { Avatar } from 'twenty-ui/primitives/data-display';++type ProfileAvatarProps = { onOpenProfile: () => void };++export const ProfileAvatar = ({ onOpenProfile }: ProfileAvatarProps) => (+ <Avatar+ name="Jane"+ shape="circle"+ size="lg"+ aria-label="Open Jane's profile"+ onClick={onOpenProfile}+ />+);+```++Supplying `onClick` renders a button with pointer, Enter, and Space activation. Use `disabled` to prevent activation. The default accessible name comes from `name`, but an action-specific `aria-label` makes the purpose clearer. When replacing the button through `render`, set `nativeButton={false}` for a non-button element.++## Props++Types and defaults are generated from the public component types. Native attributes and event handlers are also accepted.++<AvatarReference />diff --git a/packages/twenty-docs/ui/components/data-display/chip.mdx b/packages/twenty-docs/ui/components/data-display/chip.mdxnew file mode 100644index 00000000000..27db04bd831--- /dev/null+++ b/packages/twenty-docs/ui/components/data-display/chip.mdx@@ -0,0 +1,80 @@+---+title: Chip+description: Show a compact record label with optional leading and trailing content.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';++import ChipReference from '/snippets/ui/generated/data-display/chip.mdx';++Use `Chip` for compact references to people, records, or files. Use [Tag](/ui/components/data-display/tag) for colored categories and [Status](/ui/components/data-display/status) for workflow states.++<StoryEmbed+ storyId="ui-data-display-chip--with-left-avatar"+ title="Chip example"+/>++## Record label++```tsx+import { Avatar, Chip } from 'twenty-ui/primitives/data-display';++export const AssigneeChip = () => (+ <Chip+ variant="soft"+ startElement={<Avatar name="Jane" size="sm" shape="circle" />}+ >+ Jane+ </Chip>+);+```++Use `startElement` and `endElement` for avatars, icons, or other content. `endElementDivider` adds a separator before the trailing content. The default chip is a `div`; its slots can contain an action when the chip itself is not interactive.++## Open a record++```tsx+import { Avatar, Chip } from 'twenty-ui/primitives/data-display';++type AssigneeActionProps = { onOpenAssignee: () => void };++export const AssigneeAction = ({ onOpenAssignee }: AssigneeActionProps) => (+ <Chip+ onClick={onOpenAssignee}+ aria-label="Open Jane's record"+ startElement={<Avatar name="Jane" size="sm" shape="circle" />}+ >+ Jane+ </Chip>+);+```++`onClick` renders a button with keyboard activation. `clickable` controls hover and pointer styling only; setting it alone does not create a button or add an action. `disabled` prevents activation of the button. Do not nest buttons or links inside an interactive chip.++Use `render` to replace the root element. If an `onClick` chip renders a non-button element, set `nativeButton={false}`. When `isLabelHidden` hides the label, give an interactive chip an `aria-label`.++## Width and empty labels++```tsx+import { Chip } from 'twenty-ui/primitives/data-display';++export const FileChip = () => (+ <Chip variant="soft" maxWidth={180}>+ Quarterly customer research.pdf+ </Chip>+);+```++`maxWidth` constrains the chip in pixels. String labels truncate and show their full text in a tooltip on hover. `tooltipLabel` changes the tooltip text; `alwaysShowTooltip` also enables it when the label fits. Keep essential information available without relying on hover.++Missing, empty-string, or `false` children show `emptyLabel`, which defaults to `Untitled`. `forceEmptyText` suppresses that placeholder. `isLabelHidden` hides both the content label and the placeholder while preserving the slots.++## Appearance++`size` accepts `sm` or `md`. `variant` accepts `ghost`, `soft`, or `solid`; `ghost` is the default. Use `shape="round"` for a pill, `weight="medium"` for emphasis, and `color="secondary"` for secondary text.++## Props++Types and defaults are generated from the public component types. Native attributes and event handlers are also accepted.++<ChipReference />diff --git a/packages/twenty-docs/ui/components/data-display/status.mdx b/packages/twenty-docs/ui/components/data-display/status.mdxnew file mode 100644index 00000000000..ae32472e49e--- /dev/null+++ b/packages/twenty-docs/ui/components/data-display/status.mdx@@ -0,0 +1,74 @@+---+title: Status+description: Show a named state with a colored indicator and optional loading feedback.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';++import StatusReference from '/snippets/ui/generated/data-display/status.mdx';++`Status` combines a colored dot, a text label, and an optional loader. Use it for workflow or record states. Use [Tag](/ui/components/data-display/tag) for a category without the status indicator.++<StoryEmbed storyId="ui-data-display-status--default" title="Status example" />++## Record state++```tsx+import { Status } from 'twenty-ui/primitives/data-display';++export const RecordStatus = () => <Status color="green">Active</Status>;+```++`color` is required and uses the theme palette. The label communicates the meaning independently of the color. The default element is a `span`; `weight="medium"` emphasizes its text.++## Loading and announcements++```tsx+import { Status } from 'twenty-ui/primitives/data-display';++type SaveStatusProps = { isSaving: boolean };++export const SaveStatus = ({ isSaving }: SaveStatusProps) => (+ <div role="status">+ <Status color={isSaving ? 'blue' : 'green'} loading={isSaving}>+ {isSaving ? 'Saving' : 'Saved'}+ </Status>+ </div>+);+```++`loading` shows a loader after the label. The component does not add a live region or change its text automatically. Keep a `role="status"` container mounted when updates should be announced to assistive technology, and provide a label that describes the current state.++## Change a state++```tsx+import { Status } from 'twenty-ui/primitives/data-display';++type ChangeStatusActionProps = {+ isUpdating: boolean;+ onChangeStatus: () => void;+};++export const ChangeStatusAction = ({+ isUpdating,+ onChangeStatus,+}: ChangeStatusActionProps) => (+ <Status+ color="blue"+ loading={isUpdating}+ disabled={isUpdating}+ onClick={onChangeStatus}+ aria-label="Change record status"+ >+ {isUpdating ? 'Updating' : 'In progress'}+ </Status>+);+```++`onClick` renders a native button with pointer, Enter, and Space activation. `loading` does not prevent repeat activation; pass `disabled` when the action should wait. If `render` replaces the button with a non-button element, set `nativeButton={false}`.++## Props++Types and defaults are generated from the public component types. Native attributes and event handlers are also accepted.++<StatusReference />diff --git a/packages/twenty-docs/ui/components/data-display/tag.mdx b/packages/twenty-docs/ui/components/data-display/tag.mdxnew file mode 100644index 00000000000..6800bd2ed98--- /dev/null+++ b/packages/twenty-docs/ui/components/data-display/tag.mdx@@ -0,0 +1,81 @@+---+title: Tag+description: Label a category or attribute with a theme color and optional icon.+---++import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';++import TagReference from '/snippets/ui/generated/data-display/tag.mdx';++Use `Tag` for categories, priorities, or other short attributes. Keep a text label so the meaning does not depend on color. Use [Status](/ui/components/data-display/status) when you need a state indicator and loading feedback.++<StoryEmbed storyId="ui-data-display-tag--default" title="Tag example" />++## Category label++```tsx+import { Tag } from 'twenty-ui/primitives/data-display';++export const PriorityTag = () => <Tag color="red">Urgent</Tag>;+```++`color` is required and accepts a theme color or `transparent`. The default element is a `span`. Add a decorative icon with `startIcon`; the label supplies its accessible meaning.++## Variants++```tsx+import { Tag } from 'twenty-ui/primitives/data-display';++export const CategoryTags = () => (+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 8 }}>+ <Tag color="blue" variant="soft">+ Customer+ </Tag>+ <Tag color="green" variant="solid">+ Partner+ </Tag>+ <Tag color="orange" variant="outline">+ Prospect+ </Tag>+ <Tag color="transparent" variant="outline" borderStyle="dashed">+ Unassigned+ </Tag>+ </div>+);+```++`soft` is the default treatment. `solid` emphasizes the label, `outline` adds a border, and `ghost` removes the background. Use `borderStyle="dashed"` with `outline` and `weight="medium"` for a stronger label.++## Filter by a tag++```tsx+import { Tag } from 'twenty-ui/primitives/data-display';++type CategoryFilterProps = {+ selected: boolean;+ onToggle: () => void;+};++export const CategoryFilter = ({ selected, onToggle }: CategoryFilterProps) => (+ <Tag+ color="blue"+ variant={selected ? 'solid' : 'outline'}+ aria-pressed={selected}+ onClick={onToggle}+ >+ Customer+ </Tag>+);+```++Supplying `onClick` renders a button. Selection state belongs to your application; use `aria-pressed` for a toggle and a visible treatment for the selected state. `disabled` prevents pointer and keyboard activation. When `render` replaces an interactive tag with a non-button element, set `nativeButton={false}`.++## Long labels++By default, constrained string labels truncate and expose their full text in a tooltip on hover. `preventShrink` keeps the full label width and turns off that tooltip, so make sure the surrounding layout can accommodate it. `preventPadding` removes the horizontal padding for custom layouts.++## Props++Types and defaults are generated from the public component types. Native attributes and event handlers are also accepted.++<TagReference />diff --git a/packages/twenty-docs/ui/getting-started.mdx b/packages/twenty-docs/ui/getting-started.mdxindex 55a39ef9f25..904ea133d5d 100644--- a/packages/twenty-docs/ui/getting-started.mdx+++ b/packages/twenty-docs/ui/getting-started.mdx@@ -86,10 +86,11 @@ Import individual icons, such as `IconCheck`, from `twenty-ui/icon`. The dynamicEach page includes usage examples, interaction guidance, and a generated API reference.-| Family | Components |-| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |-| Forms | [Field](/ui/components/input/field), [Input](/ui/components/input/input), [InputGroup](/ui/components/input/input-group), [Textarea](/ui/components/input/textarea), [Checkbox](/ui/components/input/checkbox), [Radio](/ui/components/input/radio), [RadioGroup](/ui/components/input/radio-group), [Select](/ui/components/input/select), [Slider](/ui/components/input/slider), [Switch](/ui/components/input/switch) |-| Navigation | [ListItem](/ui/components/navigation/list-item), [Tabs](/ui/components/navigation/tabs) |-| Surfaces | [AlertDialog](/ui/components/surfaces/alert-dialog), [Menu](/ui/components/surfaces/menu), [Popover](/ui/components/surfaces/popover) |-| Feedback | [Toast](/ui/components/feedback/toast) |-| Typography | [Text](/ui/components/typography/text) |+| Family | Components |+| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| Data display | [Avatar](/ui/components/data-display/avatar), [Chip](/ui/components/data-display/chip), [Tag](/ui/components/data-display/tag), [Status](/ui/components/data-display/status) |+| Forms | [Field](/ui/components/input/field), [Input](/ui/components/input/input), [InputGroup](/ui/components/input/input-group), [Textarea](/ui/components/input/textarea), [Checkbox](/ui/components/input/checkbox), [Radio](/ui/components/input/radio), [RadioGroup](/ui/components/input/radio-group), [Select](/ui/components/input/select), [Slider](/ui/components/input/slider), [Switch](/ui/components/input/switch) |+| Navigation | [ListItem](/ui/components/navigation/list-item), [Tabs](/ui/components/navigation/tabs) |+| Surfaces | [AlertDialog](/ui/components/surfaces/alert-dialog), [Menu](/ui/components/surfaces/menu), [Popover](/ui/components/surfaces/popover) |+| Feedback | [Toast](/ui/components/feedback/toast) |+| Typography | [Text](/ui/components/typography/text) |diff --git a/packages/twenty-shared/src/constants/DocumentationPaths.ts b/packages/twenty-shared/src/constants/DocumentationPaths.tsindex 1f953551cb0..c0641763af5 100644--- a/packages/twenty-shared/src/constants/DocumentationPaths.ts+++ b/packages/twenty-shared/src/constants/DocumentationPaths.ts@@ -128,6 +128,10 @@ export const DOCUMENTATION_PATHS = {GETTING_STARTED_KEY_FEATURES: '/getting-started/key-features',GETTING_STARTED_QUICKSTART: '/getting-started/quickstart',UI_ACCESSIBILITY: '/ui/accessibility',+ UI_COMPONENTS_DATA_DISPLAY_AVATAR: '/ui/components/data-display/avatar',+ UI_COMPONENTS_DATA_DISPLAY_CHIP: '/ui/components/data-display/chip',+ UI_COMPONENTS_DATA_DISPLAY_STATUS: '/ui/components/data-display/status',+ UI_COMPONENTS_DATA_DISPLAY_TAG: '/ui/components/data-display/tag',UI_COMPONENTS_FEEDBACK_TOAST: '/ui/components/feedback/toast',UI_COMPONENTS_INPUT_CHECKBOX: '/ui/components/input/checkbox',UI_COMPONENTS_INPUT_FIELD: '/ui/components/input/field',diff --git a/packages/twenty-ui/docs/avatarPropDescriptions.ts b/packages/twenty-ui/docs/avatarPropDescriptions.tsnew file mode 100644index 00000000000..5a69ddddd33--- /dev/null+++ b/packages/twenty-ui/docs/avatarPropDescriptions.ts@@ -0,0 +1,19 @@+import { type AvatarProps } from '../src/primitives/data-display/Avatar/types/AvatarProps';++export const AVATAR_PROP_DESCRIPTIONS = {+ src: 'Image URL. A missing or failed image shows the fallback.',+ name: 'Name used for the first-letter fallback and the default accessible name when clickable.',+ colorSeed: 'Stable value used to choose fallback colors. Defaults to `name`.',+ size: 'Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px).',+ shape: 'Shape of the avatar and its fallback.',+ variant: 'Visual treatment of the fallback.',+ icon: 'Icon rendered instead of the image and first-letter fallback.',+ color: 'Text color override for a first-letter fallback.',+ backgroundColor: 'Background color override for a first-letter fallback.',+ borderColor: 'Border color override for the outline fallback.',+ pulsing: 'Animates the avatar opacity. Respects reduced-motion preferences.',+ disabled:+ 'Applies disabled styling and disables activation when `onClick` is supplied.',+ nativeButton:+ 'Set to `false` when a clickable avatar uses `render` with an element other than a native button.',+} satisfies Partial<Record<keyof AvatarProps, string>>;diff --git a/packages/twenty-ui/docs/chipPropDescriptions.ts b/packages/twenty-ui/docs/chipPropDescriptions.tsnew file mode 100644index 00000000000..d46d4503624--- /dev/null+++ b/packages/twenty-ui/docs/chipPropDescriptions.ts@@ -0,0 +1,33 @@+import { type ChipProps } from '../src/primitives/data-display/Chip/types/ChipProps';++export const CHIP_PROP_DESCRIPTIONS = {+ size: 'Visual size of the chip.',+ variant: 'Background treatment of the chip.',+ color: 'Primary or secondary text color.',+ shape: 'Square or round corners.',+ weight: 'Font weight of the label.',+ disabled:+ 'Applies disabled styling and disables activation when `onClick` is supplied.',+ clickable:+ 'Enables hover and pointer styling. Defaults to whether `onClick` is supplied; does not add button semantics by itself.',+ nativeButton:+ 'Set to `false` when a clickable chip uses `render` with an element other than a native button.',+ startElement: 'Content before the label, such as an avatar or icon.',+ endElement:+ 'Content after the label. Avoid interactive content when the chip itself is a button.',+ endElementDivider:+ 'Adds a divider before `endElement` when that slot has content.',+ maxWidth:+ 'Maximum chip width in pixels, used to constrain and truncate the label.',+ tooltipLabel:+ 'Tooltip content for a string label. Defaults to the label text.',+ tooltipPlace: 'Position of the string-label tooltip.',+ alwaysShowTooltip:+ 'Shows the string-label tooltip even when the label is not truncated.',+ isLabelHidden:+ 'Hides the label while keeping the start and end elements. Supply an accessible name for an interactive chip.',+ forceEmptyText:+ 'Suppresses the empty label when children are missing, empty, or false.',+ emptyLabel:+ 'Placeholder shown when children are missing, empty, or false, unless `forceEmptyText` is enabled.',+} satisfies Partial<Record<keyof ChipProps, string>>;diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex 91fc95bc391..843c8233d80 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -1,3 +1,8 @@+import { AVATAR_PROP_DESCRIPTIONS } from './avatarPropDescriptions';+import { CHIP_PROP_DESCRIPTIONS } from './chipPropDescriptions';+import { STATUS_PROP_DESCRIPTIONS } from './statusPropDescriptions';+import { TAG_PROP_DESCRIPTIONS } from './tagPropDescriptions';+export const DOCUMENTED_COMPONENTS = [{name: 'Field',@@ -101,4 +106,32 @@ export const DOCUMENTED_COMPONENTS = [entryPoint: 'twenty-ui/primitives/typography',slug: 'typography/text',},+ {+ name: 'Avatar',+ source: 'primitives/data-display/Avatar/Avatar.tsx',+ entryPoint: 'twenty-ui/primitives/data-display',+ slug: 'data-display/avatar',+ propDescriptions: AVATAR_PROP_DESCRIPTIONS,+ },+ {+ name: 'Chip',+ source: 'primitives/data-display/Chip/Chip.tsx',+ entryPoint: 'twenty-ui/primitives/data-display',+ slug: 'data-display/chip',+ propDescriptions: CHIP_PROP_DESCRIPTIONS,+ },+ {+ name: 'Tag',+ source: 'primitives/data-display/Tag/Tag.tsx',+ entryPoint: 'twenty-ui/primitives/data-display',+ slug: 'data-display/tag',+ propDescriptions: TAG_PROP_DESCRIPTIONS,+ },+ {+ name: 'Status',+ source: 'primitives/data-display/Status/Status.tsx',+ entryPoint: 'twenty-ui/primitives/data-display',+ slug: 'data-display/status',+ propDescriptions: STATUS_PROP_DESCRIPTIONS,+ },] as const;diff --git a/packages/twenty-ui/docs/statusPropDescriptions.ts b/packages/twenty-ui/docs/statusPropDescriptions.tsnew file mode 100644index 00000000000..072d4d39e0c--- /dev/null+++ b/packages/twenty-ui/docs/statusPropDescriptions.ts@@ -0,0 +1,16 @@+import { type StatusProps } from '../src/primitives/data-display/Status/types/StatusProps';++export const STATUS_PROP_DESCRIPTIONS = {+ color: 'Theme color used for the status background, text, and loader.',+ weight: 'Font weight of the label.',+ disabled:+ 'Applies disabled styling and disables activation when `onClick` is supplied.',+ loading:+ 'Shows a loader after the label. Does not disable the control or announce a status change by itself.',+ onClick:+ 'Handles activation and renders a native button by default. Without it, the default element is a span.',+ nativeButton:+ 'Set to `false` when using `render` with an element other than a native button.',+ render:+ 'Replaces the default element. Required when `nativeButton` is `false`.',+} satisfies Partial<Record<keyof StatusProps, string>>;diff --git a/packages/twenty-ui/docs/tagPropDescriptions.ts b/packages/twenty-ui/docs/tagPropDescriptions.tsnew file mode 100644index 00000000000..bfb231da903--- /dev/null+++ b/packages/twenty-ui/docs/tagPropDescriptions.ts@@ -0,0 +1,17 @@+import { type TagProps } from '../src/primitives/data-display/Tag/types/TagProps';++export const TAG_PROP_DESCRIPTIONS = {+ color: 'Theme color for the tag, or `transparent` for an unfilled label.',+ weight: 'Font weight of the label.',+ disabled:+ 'Applies disabled styling and prevents pointer and keyboard activation.',+ nativeButton:+ 'Set to `false` when a clickable tag uses `render` with an element other than a native button.',+ variant: 'Visual treatment of the tag background and border.',+ startIcon:+ 'Decorative icon before the label. Hidden from assistive technology.',+ preventShrink:+ 'Keeps the tag from shrinking and disables string-label truncation and its tooltip.',+ preventPadding: 'Removes the tag padding.',+ borderStyle: 'Border style used by the outline variant.',+} satisfies Partial<Record<keyof TagProps, string>>;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex f8d8d2aa341..d0ce2374fae 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -3779,5 +3779,397 @@"description": "Truncates overflowing text on one line with an ellipsis. Cannot be\ncombined with `lineClamp`."}]+ },+ {+ "name": "Avatar",+ "entryPoint": "twenty-ui/primitives/data-display",+ "slug": "data-display/avatar",+ "props": [+ {+ "name": "backgroundColor",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Background color override for a first-letter fallback."+ },+ {+ "name": "borderColor",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Border color override for the outline fallback."+ },+ {+ "name": "className",+ "type": "string | ((state: AvatarRootState) => string | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "CSS class applied to the element, or a function that\nreturns a class based on the component's state."+ },+ {+ "name": "color",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Text color override for a first-letter fallback."+ },+ {+ "name": "colorSeed",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Stable value used to choose fallback colors. Defaults to `name`."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Applies disabled styling and disables activation when `onClick` is supplied."+ },+ {+ "name": "icon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Icon rendered instead of the image and first-letter fallback."+ },+ {+ "name": "name",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Name used for the first-letter fallback and the default accessible name when clickable."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set to `false` when a clickable avatar uses `render` with an element other than a native button."+ },+ {+ "name": "pulsing",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Animates the avatar opacity. Respects reduced-motion preferences."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, AvatarRootState>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "shape",+ "type": "\"circle\" | \"square\" | \"rounded-square\"",+ "required": false,+ "defaultValue": "square",+ "description": "Shape of the avatar and its fallback."+ },+ {+ "name": "size",+ "type": "\"sm\" | \"md\" | \"lg\" | \"xl\" | \"xs\"",+ "required": false,+ "defaultValue": "md",+ "description": "Avatar size: `xs` (12px), `sm` (14px), `md` (16px), `lg` (24px), or `xl` (40px)."+ },+ {+ "name": "src",+ "type": "string | null",+ "required": false,+ "defaultValue": null,+ "description": "Image URL. A missing or failed image shows the fallback."+ },+ {+ "name": "style",+ "type": "CSSProperties | ((state: AvatarRootState) => CSSProperties | undefined)",+ "required": false,+ "defaultValue": null,+ "description": "Style applied to the element, or a function that\nreturns a style object based on the component's state."+ },+ {+ "name": "variant",+ "type": "\"outline\" | \"soft\"",+ "required": false,+ "defaultValue": "soft",+ "description": "Visual treatment of the fallback."+ }+ ]+ },+ {+ "name": "Chip",+ "entryPoint": "twenty-ui/primitives/data-display",+ "slug": "data-display/chip",+ "props": [+ {+ "name": "alwaysShowTooltip",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Shows the string-label tooltip even when the label is not truncated."+ },+ {+ "name": "clickable",+ "type": "boolean",+ "required": false,+ "defaultValue": "isDefined(onClick)",+ "description": "Enables hover and pointer styling. Defaults to whether `onClick` is supplied; does not add button semantics by itself."+ },+ {+ "name": "color",+ "type": "\"primary\" | \"secondary\"",+ "required": false,+ "defaultValue": "primary",+ "description": "Primary or secondary text color."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Applies disabled styling and disables activation when `onClick` is supplied."+ },+ {+ "name": "emptyLabel",+ "type": "string",+ "required": false,+ "defaultValue": "Untitled",+ "description": "Placeholder shown when children are missing, empty, or false, unless `forceEmptyText` is enabled."+ },+ {+ "name": "endElement",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Content after the label. Avoid interactive content when the chip itself is a button."+ },+ {+ "name": "endElementDivider",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Adds a divider before `endElement` when that slot has content."+ },+ {+ "name": "forceEmptyText",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Suppresses the empty label when children are missing, empty, or false."+ },+ {+ "name": "isLabelHidden",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Hides the label while keeping the start and end elements. Supply an accessible name for an interactive chip."+ },+ {+ "name": "maxWidth",+ "type": "number",+ "required": false,+ "defaultValue": null,+ "description": "Maximum chip width in pixels, used to constrain and truncate the label."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set to `false` when a clickable chip uses `render` with an element other than a native button."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "shape",+ "type": "\"square\" | \"round\"",+ "required": false,+ "defaultValue": "square",+ "description": "Square or round corners."+ },+ {+ "name": "size",+ "type": "\"sm\" | \"md\"",+ "required": false,+ "defaultValue": "sm",+ "description": "Visual size of the chip."+ },+ {+ "name": "startElement",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Content before the label, such as an avatar or icon."+ },+ {+ "name": "tooltipLabel",+ "type": "string",+ "required": false,+ "defaultValue": null,+ "description": "Tooltip content for a string label. Defaults to the label text."+ },+ {+ "name": "tooltipPlace",+ "type": "\"top\" | \"left\" | \"right\" | \"bottom\"",+ "required": false,+ "defaultValue": null,+ "description": "Position of the string-label tooltip."+ },+ {+ "name": "variant",+ "type": "\"solid\" | \"soft\" | \"ghost\"",+ "required": false,+ "defaultValue": "ghost",+ "description": "Background treatment of the chip."+ },+ {+ "name": "weight",+ "type": "\"regular\" | \"medium\"",+ "required": false,+ "defaultValue": "regular",+ "description": "Font weight of the label."+ }+ ]+ },+ {+ "name": "Tag",+ "entryPoint": "twenty-ui/primitives/data-display",+ "slug": "data-display/tag",+ "props": [+ {+ "name": "borderStyle",+ "type": "\"solid\" | \"dashed\"",+ "required": false,+ "defaultValue": "solid",+ "description": "Border style used by the outline variant."+ },+ {+ "name": "color",+ "type": "\"ruby\" | \"red\" | \"crimson\" | \"tomato\" | \"orange\" | \"amber\" | \"yellow\" | \"lime\" | \"grass\" | \"green\" | \"jade\" | \"mint\" | \"turquoise\" | \"cyan\" | \"sky\" | \"blue\" | \"iris\" | \"violet\" | \"purple\" | \"plum\" | \"pink\" | \"bronze\" | \"gold\" | \"brown\" | \"gray\" | \"transparent\"",+ "required": true,+ "defaultValue": null,+ "description": "Theme color for the tag, or `transparent` for an unfilled label."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Applies disabled styling and prevents pointer and keyboard activation."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set to `false` when a clickable tag uses `render` with an element other than a native button."+ },+ {+ "name": "preventPadding",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Removes the tag padding."+ },+ {+ "name": "preventShrink",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Keeps the tag from shrinking and disables string-label truncation and its tooltip."+ },+ {+ "name": "render",+ "type": "ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}>",+ "required": false,+ "defaultValue": null,+ "description": "Allows you to replace the component's HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."+ },+ {+ "name": "startIcon",+ "type": "ReactNode",+ "required": false,+ "defaultValue": null,+ "description": "Decorative icon before the label. Hidden from assistive technology."+ },+ {+ "name": "variant",+ "type": "\"solid\" | \"outline\" | \"soft\" | \"ghost\"",+ "required": false,+ "defaultValue": "soft",+ "description": "Visual treatment of the tag background and border."+ },+ {+ "name": "weight",+ "type": "\"regular\" | \"medium\"",+ "required": false,+ "defaultValue": "regular",+ "description": "Font weight of the label."+ }+ ]+ },+ {+ "name": "Status",+ "entryPoint": "twenty-ui/primitives/data-display",+ "slug": "data-display/status",+ "props": [+ {+ "name": "color",+ "type": "\"ruby\" | \"red\" | \"crimson\" | \"tomato\" | \"orange\" | \"amber\" | \"yellow\" | \"lime\" | \"grass\" | \"green\" | \"jade\" | \"mint\" | \"turquoise\" | \"cyan\" | \"sky\" | \"blue\" | \"iris\" | \"violet\" | \"purple\" | \"plum\" | \"pink\" | \"bronze\" | \"gold\" | \"brown\" | \"gray\"",+ "required": true,+ "defaultValue": null,+ "description": "Theme color used for the status background, text, and loader."+ },+ {+ "name": "disabled",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Applies disabled styling and disables activation when `onClick` is supplied."+ },+ {+ "name": "loading",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Shows a loader after the label. Does not disable the control or announce a status change by itself."+ },+ {+ "name": "nativeButton",+ "type": "boolean",+ "required": false,+ "defaultValue": "true",+ "description": "Set to `false` when using `render` with an element other than a native button."+ },+ {+ "name": "onClick",+ "type": "MouseEventHandler<HTMLButtonElement> | MouseEventHandler<HTMLElement>",+ "required": false,+ "defaultValue": null,+ "description": "Handles activation and renders a native button by default. Without it, the default element is a span."+ },+ {+ "name": "render",+ "type": "NonNullable<ReactElement<unknown, string | JSXElementConstructor<any>> | ComponentRenderFn<HTMLProps, {}> | undefined>",+ "required": false,+ "defaultValue": null,+ "description": "Replaces the default element. Required when `nativeButton` is `false`."+ },+ {+ "name": "weight",+ "type": "\"regular\" | \"medium\"",+ "required": false,+ "defaultValue": "regular",+ "description": "Font weight of the label."+ }+ ]}]diff --git a/packages/twenty-ui/scripts/generateDocsData.ts b/packages/twenty-ui/scripts/generateDocsData.tsindex c4dd894bd99..0c48dec6fcc 100644--- a/packages/twenty-ui/scripts/generateDocsData.ts+++ b/packages/twenty-ui/scripts/generateDocsData.ts@@ -73,10 +73,15 @@ const parser = new DocumentationParser(program, {propFilter: (prop) => !isReactNativeAttribute(prop) && !isHiddenProp(prop),});-const extractProps = (- symbol: ts.Symbol,- name: string,-): ComponentDocumentation['props'] => {+const extractProps = ({+ symbol,+ name,+ propDescriptions = {},+}: {+ symbol: ts.Symbol;+ name: string;+ propDescriptions?: Partial<Record<string, string>>;+}): ComponentDocumentation['props'] => {const declaration = symbol.valueDeclaration;if (!declaration) {@@ -96,11 +101,13 @@ const extractProps = (return Object.values(parsed.props).sort((left, right) => left.name.localeCompare(right.name, 'en')).map((prop) => {- const description = prop.description.trim();+ const description = (+ propDescriptions[prop.name] ?? prop.description+ ).trim();if (description.length === 0 && isDeclaredInTwentyUi(prop)) {throw new Error(- `Missing JSDoc description for ${name}.${prop.name}. Document the prop in its props type.`,+ `Missing description for ${name}.${prop.name}. Document the prop in its props type or documentation metadata.`,);}@@ -142,7 +149,17 @@ const components: ComponentDocumentation[] = DOCUMENTED_COMPONENTS.map(};if (type.getCallSignatures().length > 0) {- return { ...metadata, props: extractProps(symbol, component.name) };+ return {+ ...metadata,+ props: extractProps({+ symbol,+ name: component.name,+ propDescriptions:+ 'propDescriptions' in component+ ? component.propDescriptions+ : undefined,+ }),+ };}const parts = type.getProperties().map((part) => {@@ -164,7 +181,10 @@ const components: ComponentDocumentation[] = DOCUMENTED_COMPONENTS.map(return {name: part.name,- props: extractProps(partSymbol, `${component.name}.${part.name}`),+ props: extractProps({+ symbol: partSymbol,+ name: `${component.name}.${part.name}`,+ }),};});