button-group
Model selector with tier badges
Model selector with tier badges
Загрузка превью…
src/button-group/c-button-group-41.vue
<script setup lang="ts">
import { ref } from "vue"
import { Badge } from "@/components/reui/badge"
import { Button } from "@/components/ui/button"
import { ButtonGroup } from "@/components/ui/button-group"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
const models = [
{
id: "gpt4o",
label: "GPT-4o",
badge: "Fast",
badgeVariant: "success-light" as const,
tooltip: "128k context, fastest response",
icon: "zap",
},
{
id: "claude",
label: "Claude",
badge: "Pro",
badgeVariant: "info-light" as const,
tooltip: "200k context, best for analysis",
icon: "brain",
},
{
id: "gemini",
label: "Gemini",
badge: "Preview",
badgeVariant: "warning-light" as const,
tooltip: "1M context, experimental",
icon: "flask-conical",
},
]
const active = ref("claude")
</script>
<template>
<ButtonGroup>
<TooltipProvider>
<Tooltip v-for="model in models" :key="model.id">
<TooltipTrigger as-child>
<Button
variant="outline"
:class="active === model.id ? 'bg-muted' : ''"
@click="active = model.id"
>
<svg
v-if="model.icon === 'zap'"
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-zap"
>
<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z" />
</svg>
<svg
v-else-if="model.icon === 'brain'"
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-brain"
>
<path d="M12 18V5" />
<path d="M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4" />
<path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5" />
<path d="M17.997 5.125a4 4 0 0 1 2.526 5.77" />
<path d="M18 18a4 4 0 0 0 2-7.464" />
<path d="M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517" />
<path d="M6 18a4 4 0 0 1-2-7.464" />
<path d="M6.003 5.125a4 4 0 0 0-2.526 5.77" />
</svg>
<svg
v-else
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-flask-conical"
>
<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2" />
<path d="M6.453 15h11.094" />
<path d="M8.5 2h7" />
</svg>
{{ model.label }}
<Badge :variant="model.badgeVariant" size="xs">
{{ model.badge }}
</Badge>
</Button>
</TooltipTrigger>
<TooltipContent>{{ model.tooltip }}</TooltipContent>
</Tooltip>
</TooltipProvider>
</ButtonGroup>
</template>
Установка
npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-button-group-41.jsonЗависимости реестра
Источник: порт из ReUI (Keenthemes, MIT)