feat(Drawer): handle direction + handle props

This commit is contained in:
Benjamin Canac
2024-09-27 11:44:52 +02:00
parent 5b62a8c8ca
commit 5f77aac368
10 changed files with 312 additions and 50 deletions

View File

@@ -12,7 +12,12 @@ const users = [
<template>
<UModal v-model:open="open">
<UButton label="Search users..." color="gray" variant="subtle" icon="i-heroicons-magnifying-glass" />
<UButton
label="Search users..."
color="gray"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>
<template #content>
<UCommandPalette

View File

@@ -19,7 +19,12 @@ const groups = computed(() => [{
<template>
<UDrawer>
<UButton label="Search users..." color="gray" variant="subtle" icon="i-heroicons-magnifying-glass" />
<UButton
label="Search users..."
color="gray"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>
<template #content>
<UCommandPalette

View File

@@ -3,7 +3,7 @@ const open = ref(false)
</script>
<template>
<UDrawer v-model:open="open" title="Drawer with footer" description="This is useful when you want a form in a Drawer.">
<UDrawer v-model:open="open" title="Drawer with footer" description="This is useful when you want a form in a Drawer." :ui="{ container: 'max-w-xl mx-auto' }">
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
<template #body>

View File

@@ -19,7 +19,12 @@ const groups = computed(() => [{
<template>
<UModal>
<UButton label="Search users..." color="gray" variant="subtle" icon="i-heroicons-magnifying-glass" />
<UButton
label="Search users..."
color="gray"
variant="subtle"
icon="i-heroicons-magnifying-glass"
/>
<template #content>
<UCommandPalette

View File

@@ -89,6 +89,85 @@ slots:
:placeholder{class="h-48"}
::
### Direction
Use the `direction` prop to control the direction of the Drawer. Defaults to `bottom`.
::component-code
---
prettier: true
items:
direction:
- top
- bottom
props:
direction: 'top'
slots:
default: |
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
content: |
<Placeholder class="h-96 m-4" />
---
:u-button{label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid"}
#content
:placeholder{class="h-96 m-4"}
::
::component-code
---
prettier: true
items:
direction:
- right
- left
props:
direction: 'right'
slots:
default: |
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
content: |
<Placeholder class="w-96 m-4" />
---
:u-button{label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid"}
#content
:placeholder{class="w-96 m-4"}
::
### Handle
Use the `handle` prop to control whether the Drawer has a handle or not. Defaults to `true`.
::component-code
---
prettier: true
props:
handle: false
slots:
default: |
<UButton label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid" />
content: |
<Placeholder class="h-48 m-4" />
---
:u-button{label="Open" color="gray" variant="subtle" trailing-icon="i-heroicons-chevron-up-20-solid"}
#content
:placeholder{class="h-48 m-4"}
::
### Overlay
Use the `overlay` prop to control whether the Drawer has an overlay or not. Defaults to `true`.
@@ -174,6 +253,7 @@ You can control the open state by using the `default-open` prop or the `v-model:
::component-example
---
prettier: true
name: 'drawer-open-example'
---
::
@@ -192,6 +272,8 @@ Use the `#footer` slot to add content after the Drawer's body.
::component-example
---
prettier: true
collapse: true
name: 'drawer-footer-slot-example'
---
::