Skip to content

Commit d76de10

Browse files
feat: add 'fit' width variant to Popover component (#1864)
* feat: add 'fit' width variant to Popover component Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * chore: add changeset for popover fit width variant Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 1037a62 commit d76de10

4 files changed

Lines changed: 24 additions & 0 deletions

File tree

.changeset/popover-fit-width.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@launchpad-ui/components': minor
3+
---
4+
5+
Add `fit` width variant to Popover component that sets `width: fit-content` with no min-width constraint

packages/components/src/Popover.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const popoverStyles = cva(styles.popover, {
3030
variants: {
3131
width: {
3232
default: styles.default,
33+
fit: styles.fit,
3334
trigger: styles.trigger,
3435
},
3536
},

packages/components/src/styles/Popover.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@
132132
}
133133
}
134134

135+
.fit {
136+
width: fit-content;
137+
}
138+
135139
.trigger {
136140
&[data-trigger] {
137141
width: var(--trigger-width);

packages/components/stories/Popover.stories.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ export const WithHeading: Story = {
9191
play,
9292
};
9393

94+
export const FitWidth: Story = {
95+
render: (args) => {
96+
return (
97+
<DialogTrigger>
98+
<Button>Trigger</Button>
99+
<Popover width="fit" {...args}>
100+
<Dialog>Message</Dialog>
101+
</Popover>
102+
</DialogTrigger>
103+
);
104+
},
105+
play,
106+
};
107+
94108
export const CustomTrigger: Story = {
95109
render: (args) => {
96110
return (

0 commit comments

Comments
 (0)