Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(docsite): keep component preview leading edge visible on overflow (#4668)

freddymeta462790cbed59
diff --git a/apps/docsite/src/components/component-detail/ShowcasePreview.tsx b/apps/docsite/src/components/component-detail/ShowcasePreview.tsx
index 2b08e18bee..b674149b8d 100644
--- a/apps/docsite/src/components/component-detail/ShowcasePreview.tsx
+++ b/apps/docsite/src/components/component-detail/ShowcasePreview.tsx
@@ -64,7 +64,11 @@ export function ShowcasePreview({name}: ShowcasePreviewProps) {
minHeight: 160,
display: 'flex',
alignItems: 'center',
- justifyContent: 'center',
+ // `safe center` centers the preview when it fits but falls back to
+ // start alignment when it overflows the frame, so a showcase wider
+ // than the viewport isn't pushed into the unscrollable negative
+ // gutter and clipped at its leading edge.
+ justifyContent: 'safe center',
}}
{...previewNavigationProps}>
<div style={{minWidth: 'fit-content'}}>
@@ -82,7 +86,9 @@ export function ShowcasePreview({name}: ShowcasePreviewProps) {
overflow: 'auto',
display: 'flex',
alignItems: 'center',
- justifyContent: 'center',
+ // See the small-viewport branch above: `safe center` keeps the leading
+ // edge reachable when a preview overflows instead of clipping it.
+ justifyContent: 'safe center',
}}
{...previewNavigationProps}>
<Component />