Skip to content

Commit feb9c8d

Browse files
committed
feat(dialog): position Dialog.ContentTitle sticky
1 parent 07facd7 commit feb9c8d

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
import { Slot, component$ } from '@builder.io/qwik';
1+
import { Slot, component$, useStyles$ } from '@builder.io/qwik';
22

33
export const ContentTitle = component$(() => {
4-
return <Slot />;
4+
useStyles$(`
5+
.dialog-content-title {
6+
position: sticky;
7+
top: 0;
8+
}
9+
`);
10+
11+
return (
12+
<div class="dialog-content-title">
13+
<Slot />
14+
</div>
15+
);
516
});

packages/kit-headless/src/components/dialog/dialog.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ export const ScrollingLongContent: Story = {
5454
<button>Open Dialog</button>
5555
</Dialog.Trigger>
5656
<Dialog.Content>
57+
<Dialog.ContentTitle>
58+
<h2>My Dialog Title</h2>
59+
</Dialog.ContentTitle>
5760
{Array(500)
5861
.fill(null)
5962
.map(() => 'Hello World')

0 commit comments

Comments
 (0)