Skip to content

The open alternative to Salesforce, designed for AI.

Keep Skeleton corners round (#28299)

Raphaël Bosifaab32911b1a
diff --git a/packages/twenty-docs/snippets/ui/generated/feedback/skeleton.mdx b/packages/twenty-docs/snippets/ui/generated/feedback/skeleton.mdx
index 4b067e33f43..c50bf9c707f 100644
--- a/packages/twenty-docs/snippets/ui/generated/feedback/skeleton.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/feedback/skeleton.mdx
@@ -24,7 +24,7 @@
</ParamField>
<ParamField body="borderRadius" type="BorderRadius&lt;string | number&gt;">
- Corner radius in pixels or a CSS length. Defaults to 0.25rem and inherits the surrounding corner shape.
+ Round corner radius in pixels or a CSS length. Defaults to the 4px smRound theme token. Use mdRound for 8px corners or a custom radius for circles and capsules.
</ParamField>
<ParamField body="className" type="string">
diff --git a/packages/twenty-docs/ui/primitives/feedback/skeleton.mdx b/packages/twenty-docs/ui/primitives/feedback/skeleton.mdx
index b393499fe42..87152ca27ef 100644
--- a/packages/twenty-docs/ui/primitives/feedback/skeleton.mdx
+++ b/packages/twenty-docs/ui/primitives/feedback/skeleton.mdx
@@ -28,12 +28,8 @@ export const LoadingProfile = () => (
render={<div />}
style={{ display: 'flex', flexDirection: 'column', gap: 8 }}
>
- <Skeleton borderRadius={4} width={180} height={SKELETON_HEIGHT_SIZES.s} />
- <Skeleton
- borderRadius={4}
- width={120}
- height={SKELETON_HEIGHT_SIZES.xs}
- />
+ <Skeleton width={180} height={SKELETON_HEIGHT_SIZES.s} />
+ <Skeleton width={120} height={SKELETON_HEIGHT_SIZES.xs} />
</Text>
</Text>
);
@@ -63,7 +59,7 @@ The highlight moves from left to right on a 1.5-second ease-in-out loop and is h
Native props, `className`, `style` and `ref` target the placeholder span. Use `render` to compose another element. Explicit native styles override dimension and color props.
-The base and highlight colors default to the theme tertiary background and lighter transparent background. Use `baseColor`, `highlightColor` and `borderRadius` to override them. The default radius is `0.25rem` and the corner shape follows the surrounding styles. No skeleton-specific provider or stylesheet import is needed after loading `twenty-ui/style.css` and the UI theme.
+The base and highlight colors default to the theme tertiary background and lighter transparent background. Use `baseColor`, `highlightColor` and `borderRadius` to override them. Corners stay round, including when the theme uses squircles. The default radius uses the `smRound` theme token (4px). Pass `themeCssVariables.border.radius.mdRound` from `twenty-ui/theme` for 8px corners. Custom pixel and CSS radii remain supported, including `borderRadius={80}` for a narrow capsule and `borderRadius="50%"` for a circle. No skeleton-specific provider or stylesheet import is needed after loading `twenty-ui/style.css` and the UI theme.
## Props
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
index 4d0de2211c0..e2fd9f7d890 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-feedback-gallery.front-component.tsx
@@ -9,7 +9,7 @@ import {
} from 'twenty-ui/primitives/feedback';
import { isDefined } from 'twenty-shared/utils';
import 'twenty-ui/style.css';
-import { ThemeProvider } from 'twenty-ui/theme';
+import { ThemeProvider, themeCssVariables } from 'twenty-ui/theme';
import {
ComponentGallery,
@@ -92,12 +92,40 @@ const FEEDBACK_ENTRIES: GalleryEntry[] = [
},
{
name: 'Skeleton',
- node: <Skeleton width={180} height={16} />,
+ node: <Skeleton width={180} height={16} data-testid="round-skeleton" />,
+ },
+ {
+ name: 'MediumRoundSkeleton',
+ node: (
+ <Skeleton
+ width={180}
+ height={16}
+ borderRadius={themeCssVariables.border.radius.mdRound}
+ data-testid="medium-round-skeleton"
+ />
+ ),
+ },
+ {
+ name: 'CapsuleSkeleton',
+ node: (
+ <Skeleton
+ width={24}
+ height={84}
+ borderRadius={80}
+ data-testid="capsule-skeleton"
+ />
+ ),
},
{
name: 'StaticSkeleton',
node: (
- <Skeleton width={40} height={40} borderRadius="50%" animated={false} />
+ <Skeleton
+ width={40}
+ height={40}
+ borderRadius="50%"
+ animated={false}
+ data-testid="circle-skeleton"
+ />
),
},
];
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts
index eb6ddc3593e..19ea1095a71 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/calloutTest.ts
@@ -3,9 +3,11 @@ import { expect, userEvent, waitFor, within } from 'storybook/test';
import { errorHandler } from '@/__stories__/shared/test-utils/createFrontComponentStoryMeta';
import { type TwentyUiGalleryPlayFunction } from '@/__stories__/twenty-ui-gallery/types/TwentyUiGalleryPlayFunction';
import { bannerTest } from '@/__stories__/twenty-ui-gallery/utils/bannerTest';
+import { expectSkeletonRoundCorners } from '@/__stories__/twenty-ui-gallery/utils/expectSkeletonRoundCorners';
export const calloutTest: TwentyUiGalleryPlayFunction = async (context) => {
await bannerTest(context);
+ await expectSkeletonRoundCorners(context.canvasElement);
const canvas = within(context.canvasElement);
const progress = canvas.getByRole('progressbar', { name: 'Progress' });
expect(progress).toHaveAttribute('aria-valuenow', '50');
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSkeletonRoundCorners.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSkeletonRoundCorners.ts
new file mode 100644
index 00000000000..3dccb51811d
--- /dev/null
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/expectSkeletonRoundCorners.ts
@@ -0,0 +1,26 @@
+import { expect, within } from 'storybook/test';
+
+export const expectSkeletonRoundCorners = async (
+ canvasElement: HTMLElement,
+) => {
+ const canvas = within(canvasElement);
+ const radii = {
+ 'round-skeleton': '4px',
+ 'medium-round-skeleton': '8px',
+ 'capsule-skeleton': '80px',
+ 'circle-skeleton': '50%',
+ };
+
+ for (const [name, radius] of Object.entries(radii)) {
+ const placeholder = canvas.getByTestId(name);
+
+ await expect(placeholder).toBeVisible();
+ await expect(getComputedStyle(placeholder).borderRadius).toBe(radius);
+
+ if (CSS.supports('corner-shape', 'squircle')) {
+ await expect(
+ getComputedStyle(placeholder).getPropertyValue('corner-shape'),
+ ).toBe('round');
+ }
+ }
+};
diff --git a/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx b/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
index 03e23089ed7..4a21724a2d1 100644
--- a/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/activities/components/SkeletonLoader.tsx
@@ -26,10 +26,6 @@ const StyledSkeletonSubSectionContent = styled.div`
justify-content: center;
`;
-const StyledSkeletonColumn = styled(SkeletonLine)`
- corner-shape: round;
-`;
-
const SKELETON_COLUMN_HEIGHTS = {
short: 84,
tall: 120,
@@ -50,7 +46,7 @@ export const SkeletonLoader = ({
{withSubSections &&
skeletonItems.map(({ id }, index) => (
<StyledSkeletonSubSection key={id}>
- <StyledSkeletonColumn
+ <SkeletonLine
width={24}
borderRadius={80}
height={
diff --git a/packages/twenty-front/src/modules/ai/components/internal/AiChatSkeletonLoader.tsx b/packages/twenty-front/src/modules/ai/components/internal/AiChatSkeletonLoader.tsx
index fe57a095ed2..2af5986b480 100644
--- a/packages/twenty-front/src/modules/ai/components/internal/AiChatSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/ai/components/internal/AiChatSkeletonLoader.tsx
@@ -14,7 +14,10 @@ const StyledSkeletonContainer = styled(StyledAiChatContentContainer)`
export const AiChatSkeletonLoader = () => {
return (
<StyledSkeletonContainer>
- <SkeletonLine height={20} borderRadius={8} />
+ <SkeletonLine
+ height={20}
+ borderRadius={themeCssVariables.border.radius.mdRound}
+ />
</StyledSkeletonContainer>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
index 535d922de9c..18428ccfc42 100644
--- a/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-board/record-board-column/components/RecordBoardColumnCardContainerSkeletonLoader.tsx
@@ -52,7 +52,6 @@ export const RecordBoardColumnCardContainerSkeletonLoader = () => {
render={<div />}
animated={false}
baseColor={themeCssVariables.background.tertiary}
- borderRadius={themeCssVariables.border.radius.sm}
width={titleSkeletonWidth}
height={12}
/>
@@ -67,7 +66,6 @@ export const RecordBoardColumnCardContainerSkeletonLoader = () => {
render={<div />}
animated={false}
baseColor={themeCssVariables.background.tertiary}
- borderRadius={themeCssVariables.border.radius.sm}
width={16}
height={SKELETON_HEIGHT_SIZES.s}
/>
@@ -75,7 +73,6 @@ export const RecordBoardColumnCardContainerSkeletonLoader = () => {
render={<div />}
animated={false}
baseColor={themeCssVariables.background.tertiary}
- borderRadius={themeCssVariables.border.radius.sm}
width={151}
height={SKELETON_HEIGHT_SIZES.s}
/>
diff --git a/packages/twenty-front/src/modules/settings/usage/components/UsageSectionSkeleton.tsx b/packages/twenty-front/src/modules/settings/usage/components/UsageSectionSkeleton.tsx
index 4557aac45f4..d23d999028f 100644
--- a/packages/twenty-front/src/modules/settings/usage/components/UsageSectionSkeleton.tsx
+++ b/packages/twenty-front/src/modules/settings/usage/components/UsageSectionSkeleton.tsx
@@ -1,6 +1,7 @@
import { SkeletonLine } from '@/ui/feedback/skeleton/components/SkeletonLine';
import { Section } from 'twenty-ui/components/layout';
+import { themeCssVariables } from 'twenty-ui/theme';
export const UsageSectionSkeleton = () => {
return (
@@ -9,7 +10,7 @@ export const UsageSectionSkeleton = () => {
<SkeletonLine
width="100%"
height={200}
- borderRadius={8}
+ borderRadius={themeCssVariables.border.radius.mdRound}
style={{ marginTop: 16 }}
/>
</Section.Root>
diff --git a/packages/twenty-front/src/modules/ui/feedback/skeleton/components/SkeletonLine.tsx b/packages/twenty-front/src/modules/ui/feedback/skeleton/components/SkeletonLine.tsx
index bc16593c460..a6352cd1234 100644
--- a/packages/twenty-front/src/modules/ui/feedback/skeleton/components/SkeletonLine.tsx
+++ b/packages/twenty-front/src/modules/ui/feedback/skeleton/components/SkeletonLine.tsx
@@ -28,7 +28,7 @@ export const SkeletonLine = ({
style,
baseColor = themeCssVariables.background.tertiary,
highlightColor = themeCssVariables.background.transparent.lighter,
- borderRadius = 4,
+ borderRadius,
animated = true,
render,
ref,
diff --git a/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx b/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
index 4b1012f4c27..841965a1178 100644
--- a/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
+++ b/packages/twenty-front/src/modules/ui/input/relation-picker/components/skeletons/DropdownMenuSkeletonItem.tsx
@@ -29,7 +29,6 @@ export const DropdownMenuSkeletonItem = ({
return (
<StyledDropdownMenuSkeletonContainer>
<SkeletonLine
- borderRadius="0.25rem"
height={SKELETON_HEIGHT_SIZES.s}
style={{ lineHeight: 0 }}
width={width}
diff --git a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
index 19ab75885bd..479dff2e8b4 100644
--- a/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/billing/SettingsUsageUserDetail.tsx
@@ -91,7 +91,11 @@ export const SettingsUsageUserDetail = () => {
<SettingsPageLayout title={tLingui`User Usage`} links={breadcrumbLinks}>
<SettingsPageContainer>
<StyledUserHeader>
- <SkeletonLine width={40} height={40} borderRadius={8} />
+ <SkeletonLine
+ width={40}
+ height={40}
+ borderRadius={themeCssVariables.border.radius.mdRound}
+ />
<StyledUserInfo>
<SkeletonLine width={160} height={16} />
<SkeletonLine width={100} height={13} />
diff --git a/packages/twenty-ui/docs/skeletonPropDescriptions.ts b/packages/twenty-ui/docs/skeletonPropDescriptions.ts
index 3ef0a5391df..65fe2e8338b 100644
--- a/packages/twenty-ui/docs/skeletonPropDescriptions.ts
+++ b/packages/twenty-ui/docs/skeletonPropDescriptions.ts
@@ -8,7 +8,7 @@ export const SKELETON_PROP_DESCRIPTIONS = {
height:
'Placeholder height in pixels or a CSS length. Defaults to the inherited font height.',
borderRadius:
- 'Corner radius in pixels or a CSS length. Defaults to 0.25rem and inherits the surrounding corner shape.',
+ 'Round corner radius in pixels or a CSS length. Defaults to the 4px smRound theme token. Use mdRound for 8px corners or a custom radius for circles and capsules.',
baseColor:
'Placeholder background color. Defaults to the theme tertiary background.',
highlightColor:
diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.json
index d48f599fde7..918379b0065 100644
--- a/packages/twenty-ui/generated/components.docs.json
+++ b/packages/twenty-ui/generated/components.docs.json
@@ -1513,7 +1513,7 @@
"type": "BorderRadius<string | number>",
"required": false,
"defaultValue": null,
- "description": "Corner radius in pixels or a CSS length. Defaults to 0.25rem and inherits the surrounding corner shape."
+ "description": "Round corner radius in pixels or a CSS length. Defaults to the 4px smRound theme token. Use mdRound for 8px corners or a custom radius for circles and capsules."
},
{
"name": "className",
diff --git a/packages/twenty-ui/src/primitives/feedback/Skeleton/Skeleton.module.scss b/packages/twenty-ui/src/primitives/feedback/Skeleton/Skeleton.module.scss
index fdd6d760a6c..bea77267641 100644
--- a/packages/twenty-ui/src/primitives/feedback/Skeleton/Skeleton.module.scss
+++ b/packages/twenty-ui/src/primitives/feedback/Skeleton/Skeleton.module.scss
@@ -3,7 +3,8 @@
--skeleton-highlight-color: var(--t-background-transparent-lighter);
background-color: var(--skeleton-base-color);
- border-radius: 0.25rem;
+ border-radius: var(--t-border-radius-sm-round);
+ corner-shape: round;
display: block;
height: 1em;
max-inline-size: 100%;
diff --git a/packages/twenty-ui/src/primitives/feedback/Skeleton/__stories__/Skeleton.stories.tsx b/packages/twenty-ui/src/primitives/feedback/Skeleton/__stories__/Skeleton.stories.tsx
index 7d31240ca16..c3d34723f76 100644
--- a/packages/twenty-ui/src/primitives/feedback/Skeleton/__stories__/Skeleton.stories.tsx
+++ b/packages/twenty-ui/src/primitives/feedback/Skeleton/__stories__/Skeleton.stories.tsx
@@ -4,7 +4,7 @@ import { expect } from 'storybook/test';
import { Skeleton } from '@ui/primitives/feedback';
import { Text } from '@ui/primitives/typography';
import { ComponentDecorator } from '@ui/testing';
-import { ThemeProvider } from '@ui/theme';
+import { ThemeProvider, themeCssVariables } from '@ui/theme';
const meta: Meta<typeof Skeleton> = {
title: 'UI/Feedback/Skeleton',
@@ -13,7 +13,6 @@ const meta: Meta<typeof Skeleton> = {
args: {
width: 240,
height: 16,
- borderRadius: 4,
},
render: (args) => <Skeleton {...args} data-testid="placeholder" />,
};
@@ -102,6 +101,70 @@ export const Layouts: Story = {
},
};
+export const Corners: Story = {
+ render: (args) => (
+ <Text
+ render={<div />}
+ data-testid="surrounding-shape"
+ style={{ display: 'flex', alignItems: 'center', gap: 16 }}
+ >
+ <Skeleton {...args} data-testid="default-corners" />
+ <Skeleton
+ {...args}
+ borderRadius={themeCssVariables.border.radius.mdRound}
+ data-testid="medium-corners"
+ />
+ <Skeleton {...args} borderRadius={12} data-testid="custom-corners" />
+ <Skeleton
+ {...args}
+ width={24}
+ height={84}
+ borderRadius={80}
+ data-testid="capsule-corners"
+ />
+ <Skeleton
+ {...args}
+ width={40}
+ height={40}
+ borderRadius="50%"
+ data-testid="circle-corners"
+ />
+ </Text>
+ ),
+ play: async ({ canvas }) => {
+ const radii = {
+ 'default-corners': '4px',
+ 'medium-corners': '8px',
+ 'custom-corners': '12px',
+ 'capsule-corners': '80px',
+ 'circle-corners': '50%',
+ };
+
+ for (const [name, radius] of Object.entries(radii)) {
+ const placeholder = canvas.getByTestId(name);
+
+ await expect(placeholder).toBeVisible();
+ await expect(getComputedStyle(placeholder).borderRadius).toBe(radius);
+ }
+
+ if (CSS.supports('corner-shape', 'squircle')) {
+ await expect(
+ getComputedStyle(
+ canvas.getByTestId('surrounding-shape'),
+ ).getPropertyValue('corner-shape'),
+ ).toBe('superellipse(2.2)');
+
+ for (const name of Object.keys(radii)) {
+ await expect(
+ getComputedStyle(canvas.getByTestId(name)).getPropertyValue(
+ 'corner-shape',
+ ),
+ ).toBe('round');
+ }
+ }
+ },
+};
+
export const Static: Story = {
args: { animated: false },
};