Skip to content

Commit 9627e94

Browse files
committed
fix(ui): improve Carousel padding default and SummaryCard.Overlay height calculation
Carousel: Change default viewport padding from var(--ai-spacing-10) to 0, making padding opt-in instead of opt-out. This prevents layout issues in constrained spaces like the 640px ChatGPT iframe where consumers were forced to override the default 20px padding. SummaryCard.Overlay: Add box-sizing: border-box to ensure height prop includes padding in calculation. Previously, setting height={40} with padding={8} resulted in 56px total (40 + 8 + 8) instead of the expected 40px.
1 parent d9a813e commit 9627e94

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

packages/ui/docs/components/composed/carousel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Optional when using loading, error, or empty states. |
3232
| `flushStart` | `boolean \| undefined` | `false` | Remove the leading offset so the first slide is flush with the viewport start. |
3333
| `startInset` | `string \| undefined` | `'0'` | Custom left inset inside the carousel container.
3434
Useful for re-introducing padding when using `flushStart`. |
35-
| `viewportPadding` | `string \| undefined` | `'var(--ai-spacing-10)'` | Custom viewport padding (top and bottom). |
35+
| `viewportPadding` | `string \| undefined` | `'0'` | Custom viewport padding (top and bottom). |
3636
| `onApi` | `((api: import("/Users/jakelin/dev/ai/ai-native-kit/ainativekit-ui/node_modules/.pnpm/embla-carousel@8.6.0/node_modules/embla-carousel/esm/components/EmblaCarousel").EmblaCarouselType \| null) => void) \| undefined` | - | Optional callback that receives the Embla API instance once ready. |
3737
| `loading` | `boolean \| undefined` | `false` | Loading state - renders children with loading prop or skeleton slides |
3838
| `loadingSlides` | `number \| undefined` | `6` | Number of skeleton slides to show when loading and no children provided |

packages/ui/src/components/Card/SummaryCard.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@
423423
z-index: 1; /* Above image, below loading/error states */
424424
border-radius: 16px 16px 0 0; /* Match image top corners */
425425
pointer-events: auto; /* Allow interaction if needed */
426+
box-sizing: border-box; /* Include padding in height calculation */
426427
}
427428

428429
/* Image Section - Make it position relative for absolute overlay positioning */

packages/ui/src/components/Carousel/Carousel.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
.emblaViewport {
4444
position: relative;
4545
overflow: hidden;
46-
padding: var(--carousel-viewport-padding, var(--ai-spacing-10)) 0;
46+
padding: var(--carousel-viewport-padding, 0) 0;
4747
}
4848

4949
/* Embla Container (flex container for slides) */

packages/ui/src/components/Carousel/Carousel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export interface CarouselProps {
7575

7676
/**
7777
* Custom viewport padding (top and bottom).
78-
* @default 'var(--ai-spacing-10)'
78+
* @default '0'
7979
*/
8080
viewportPadding?: string;
8181

0 commit comments

Comments
 (0)