button-group
Zoom controls button group
Zoom controls button group
Загрузка превью…
src/button-group/c-button-group-37.vue
<script setup lang="ts">
import { ref } from "vue"
import { Button } from "@/components/ui/button"
import { ButtonGroup, ButtonGroupText } from "@/components/ui/button-group"
const zoom = ref(100)
function handleZoomIn() {
zoom.value = Math.min(zoom.value + 10, 200)
}
function handleZoomOut() {
zoom.value = Math.max(zoom.value - 10, 10)
}
</script>
<template>
<ButtonGroup>
<Button
variant="outline"
size="icon"
aria-label="Zoom out"
@click="handleZoomOut"
>
<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-minus"
>
<path d="M5 12h14" />
</svg>
</Button>
<ButtonGroupText class="w-16 justify-center">{{ zoom }}%</ButtonGroupText>
<Button
variant="outline"
size="icon"
aria-label="Zoom in"
@click="handleZoomIn"
>
<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-plus"
>
<path d="M5 12h14" />
<path d="M12 5v14" />
</svg>
</Button>
</ButtonGroup>
</template>
Установка
npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-button-group-37.jsonЗависимости реестра
Источник: порт из ReUI (Keenthemes, MIT)