feat(dialog-with-scroll-body): add demos with body scroll for Dialog component
This commit is contained in:
parent
8e7bbe3a8d
commit
dac89648d1
|
|
@ -380,6 +380,13 @@ export const Index = {
|
|||
component: () => import('../src/lib/registry/default/example/DialogDemo.vue').then(m => m.default),
|
||||
files: ['../src/lib/registry/default/example/DialogDemo.vue'],
|
||||
},
|
||||
DialogScrollContentDemo: {
|
||||
name: 'DialogScrollContentDemo',
|
||||
type: 'components:example',
|
||||
registryDependencies: ['button', 'dialog', 'input', 'label'],
|
||||
component: () => import('../src/lib/registry/default/example/DialogScrollContentDemo.vue').then(m => m.default),
|
||||
files: ['../src/lib/registry/default/example/DialogScrollContentDemo.vue'],
|
||||
},
|
||||
DropdownMenuDemo: {
|
||||
name: 'DropdownMenuDemo',
|
||||
type: 'components:example',
|
||||
|
|
@ -1264,6 +1271,13 @@ export const Index = {
|
|||
component: () => import('../src/lib/registry/new-york/example/DialogDemo.vue').then(m => m.default),
|
||||
files: ['../src/lib/registry/new-york/example/DialogDemo.vue'],
|
||||
},
|
||||
DialogScrollContentDemo: {
|
||||
name: 'DialogScrollContentDemo',
|
||||
type: 'components:example',
|
||||
registryDependencies: ['button', 'dialog', 'input', 'label'],
|
||||
component: () => import('../src/lib/registry/new-york/example/DialogScrollContentDemo.vue').then(m => m.default),
|
||||
files: ['../src/lib/registry/new-york/example/DialogScrollContentDemo.vue'],
|
||||
},
|
||||
DropdownMenuDemo: {
|
||||
name: 'DropdownMenuDemo',
|
||||
type: 'components:example',
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ import {
|
|||
|
||||
<ComponentPreview name="DialogCustomCloseButton" />
|
||||
|
||||
### Dialog with Scroll Content
|
||||
|
||||
<ComponentPreview name="DialogScrollContentDemo" />
|
||||
|
||||
## Notes
|
||||
|
||||
To activate the `Dialog` component from within a `Context Menu` or `Dropdown Menu`, you must encase the `Context Menu` or `Dropdown Menu` component in the `Dialog` component. For more information, refer to the linked issue [here](https://github.com/radix-ui/primitives/issues/1836).
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<script setup lang="ts">
|
||||
import { Button } from '@/lib/registry/default/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from '@/lib/registry/default/ui/dialog'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog>
|
||||
<DialogTrigger as-child>
|
||||
<Button variant="outline">
|
||||
Edit Profile
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent class="sm:max-w-[425px] grid-rows-[auto_minmax(0,1fr)_auto] p-0 max-h-[90dvh]">
|
||||
<DialogHeader class="p-6 pb-0">
|
||||
<DialogTitle>Edit profile</DialogTitle>
|
||||
<DialogDescription>
|
||||
Make changes to your profile here. Click save when you're done.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div class="grid gap-4 py-4 overflow-y-auto px-6">
|
||||
<div class="flex flex-col justify-between h-[300dvh]">
|
||||
<p>
|
||||
This is some placeholder content to show the scrolling behavior for modals. We use repeated line breaks to demonstrate how content can exceed minimum inner height, thereby showing inner scrolling. When content becomes longer than the predefined max-height of modal, content will be cropped and scrollable within the modal.
|
||||
</p>
|
||||
|
||||
<p>This content should appear at the bottom after you scroll.</p>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter class="p-6 pt-0">
|
||||
<Button type="submit">
|
||||
Save changes
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<script setup lang="ts">
|
||||
import { Button } from '@/lib/registry/new-york/ui/button'
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from '@/lib/registry/new-york/ui/dialog'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog>
|
||||
<DialogTrigger as-child>
|
||||
<Button variant="outline">
|
||||
Edit Profile
|
||||
</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent class="sm:max-w-[425px] grid-rows-[auto_minmax(0,1fr)_auto] p-0 max-h-[90dvh]">
|
||||
<DialogHeader class="p-6 pb-0">
|
||||
<DialogTitle>Edit profile</DialogTitle>
|
||||
<DialogDescription>
|
||||
Make changes to your profile here. Click save when you're done.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div class="grid gap-4 py-4 overflow-y-auto px-6">
|
||||
<div class="flex flex-col justify-between h-[300dvh]">
|
||||
<p>
|
||||
This is some placeholder content to show the scrolling behavior for modals. We use repeated line breaks to demonstrate how content can exceed minimum inner height, thereby showing inner scrolling. When content becomes longer than the predefined max-height of modal, content will be cropped and scrollable within the modal.
|
||||
</p>
|
||||
|
||||
<p>This content should appear at the bottom after you scroll.</p>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter class="p-6 pt-0">
|
||||
<Button type="submit">
|
||||
Save changes
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
Loading…
Reference in New Issue
Block a user