-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuxt UI - Responsive Model/Drawer #3772
Labels
Comments
You can already do this similar to the example of shadcn/vue: <script lang="ts" setup>
import { createReusableTemplate, useMediaQuery } from '@vueuse/core'
const [UseTemplate, GridForm] = createReusableTemplate()
const isDesktop = useMediaQuery('(min-width: 768px)')
const open = ref(false)
const state = reactive({
email: undefined,
username: undefined
})
const title = 'Edit profile'
const description = 'Make changes to your profile here. Click save when you\'re done.'
</script>
<template>
<UseTemplate>
<UForm :state="state" class="space-y-4">
<UFormField label="Email" name="email">
<UInput v-model="state.email" placeholder="[email protected]" />
</UFormField>
<UFormField label="Username" name="username">
<UInput v-model="state.username" placeholder="@shadcn" />
</UFormField>
<UButton label="Save changes" type="submit" />
</UForm>
</UseTemplate>
<UModal v-if="isDesktop" v-model:open="open" :title="title" :description="description">
<UButton label="Edit profile" color="neutral" variant="outline" />
<template #body>
<GridForm />
</template>
</UModal>
<UDrawer v-else v-model:open="open" :title="title" :description="description">
<UButton label="Edit profile" color="neutral" variant="outline" />
<template #body>
<GridForm />
</template>
</UDrawer>
</template> |
@benjamincanac can it be managed with the |
Yes of course, you can create two overlays and call the one you want. Something like: <script setup lang="ts">
const isDesktop = useMediaQuery('(min-width: 768px)')
const modal = overlay.create(MyModal)
const drawer = overlay.create(MyDrawer)
function onButtonClick() {
if (isDesktop) {
modal.open()
} else {
drawer.open()
}
}
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Hey guys, can we implement a responsive model with Nuxt UI.
Similar to the: Maybe fix the repeated content of the Dialog and Drawer.
https://www.shadcn-vue.com/docs/components/drawer.html
Additional context
No response
The text was updated successfully, but these errors were encountered: