select
Select component inside a Dialog
Select component inside a Dialog
Загрузка превью…
src/select/c-select-11.vue
<script setup lang="ts">
import { Button } from "@/components/ui/button"
import { Field } from "@/components/ui/field"
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
const items = [
{ label: "Apple", value: "apple" },
{ label: "Banana", value: "banana" },
{ label: "Blueberry", value: "blueberry" },
{ label: "Grapes", value: "grapes" },
{ label: "Pineapple", value: "pineapple" },
]
</script>
<template>
<Field class="max-w-xs">
<Dialog>
<DialogTrigger as-child>
<Button>Open Dialog</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Select Example</DialogTitle>
<DialogDescription>
Use the select below to choose a fruit.
</DialogDescription>
</DialogHeader>
<Select>
<SelectTrigger class="w-full">
<SelectValue placeholder="Select a fruit" />
</SelectTrigger>
<SelectContent position="popper">
<SelectGroup>
<SelectItem v-for="item in items" :key="item.value" :value="item.value">
{{ item.label }}
</SelectItem>
</SelectGroup>
</SelectContent>
</Select>
</DialogContent>
</Dialog>
</Field>
</template>