popover
Popover with controls
Popover with controls
Загрузка превью…
src/popover/c-popover-10.vue
<!--
Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
(lucide-react v0.545.0 "settings") — см. docs/PORTING.md §5.
-->
<script setup lang="ts">
import { ref } from "vue"
import { Button } from "@/components/ui/button"
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"
import { Slider } from "@/components/ui/slider"
import { Switch } from "@/components/ui/switch"
const volume = ref([75])
</script>
<template>
<div class="flex min-h-[100px] items-center justify-center">
<Popover>
<PopoverTrigger as-child>
<Button variant="outline" size="icon">
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
class="lucide lucide-settings"
>
<path
d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"
/>
<circle cx="12" cy="12" r="3" />
</svg>
</Button>
</PopoverTrigger>
<PopoverContent class="w-72 gap-0 p-0" align="end">
<div class="border-b p-3">
<h4 class="m-0 font-medium">Quick Settings</h4>
<p class="text-muted-foreground">Adjust your preferences.</p>
</div>
<div class="space-y-3 p-3 pb-4">
<div class="flex items-center justify-between">
<label for="qs-dark">Dark Mode</label>
<Switch id="qs-dark" />
</div>
<div class="flex items-center justify-between">
<label for="qs-notif">Notifications</label>
<Switch id="qs-notif" :default-value="true" />
</div>
<div class="space-y-2">
<div class="flex items-center justify-between">
<label>Volume</label>
<span class="text-muted-foreground">{{ `${volume[0]}%` }}</span>
</div>
<Slider v-model="volume" :max="100" :step="1" />
</div>
</div>
</PopoverContent>
</Popover>
</div>
</template>