accordion

Accordion pattern for onboarding or setup steps with icons, badges, and QR codes

Accordion pattern for onboarding or setup steps with icons, badges, and QR codes

Загрузка превью…

src/accordion/c-accordion-11.vue

<!--
  Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
  (lucide-react v0.545.0 "circle-check"/"qr-code") — см. docs/PORTING.md §5.
-->
<script setup lang="ts">
import { Badge } from "@/components/reui/badge"
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"
import { Button } from "@/components/ui/button"
import { ButtonGroup } from "@/components/ui/button-group"
import { Input } from "@/components/ui/input"
import { Spinner } from "@/components/ui/spinner"
</script>

<template>
  <div class="mx-auto mb-auto w-full max-w-lg">
    <Accordion type="single" collapsible default-value="pos-app" class="border-border rounded-lg overflow-hidden border">
      <!-- Step 1: Completed -->
      <AccordionItem value="add-products" class="bg-transparent px-4">
        <AccordionTrigger class="items-center py-4 font-semibold hover:no-underline">
          <div class="flex w-full items-center justify-between pr-4">
            <div class="flex items-center justify-center gap-3">
              <div class="flex size-5 items-center justify-center">
                <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"
                  class="fill-success text-background size-5"
                >
                  <circle cx="12" cy="12" r="10" />
                  <path d="m9 12 2 2 4-4" />
                </svg>
              </div>
              <span class="text-sm font-medium">Add products</span>
            </div>
            <Badge variant="success-light">Ready</Badge>
          </div>
        </AccordionTrigger>
        <AccordionContent class="text-muted-foreground pr-0 pb-4 pl-8 leading-relaxed">
          Your products have been successfully added and are ready for sale.
        </AccordionContent>
      </AccordionItem>

      <!-- Step 2: Expanded/In Progress -->
      <AccordionItem value="pos-app" class="bg-transparent px-4">
        <AccordionTrigger class="items-center py-4 font-semibold hover:no-underline">
          <div class="flex w-full items-center justify-between pr-4">
            <div class="flex items-center gap-3">
              <div class="flex size-5 items-center justify-center rounded-full bg-yellow-100 dark:bg-yellow-950">
                <div class="size-2 rounded-full bg-yellow-500" />
              </div>
              <span class="text-foreground text-sm font-medium">Get the point of sale application</span>
            </div>
          </div>
        </AccordionTrigger>
        <AccordionContent class="pt-2 pl-8">
          <div class="flex flex-col gap-6 md:flex-row md:items-start md:justify-between">
            <div class="flex-1 space-y-6">
              <p class="text-muted-foreground text-sm leading-relaxed">
                Scan the QR code or send yourself the link to get the app. The mobile app is where you'll manage
                orders, track inventory, and view analytics on the go.
              </p>
              <ButtonGroup>
                <Input placeholder="james@alignui.com" />
                <Button variant="outline" aria-label="Send link">Send link</Button>
              </ButtonGroup>
            </div>
            <div class="bg-muted/30 border-border rounded-lg flex shrink-0 items-center justify-center border p-3">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="24"
                height="24"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="1.5"
                stroke-linecap="round"
                stroke-linejoin="round"
                class="size-20"
              >
                <rect width="5" height="5" x="3" y="3" rx="1" />
                <rect width="5" height="5" x="16" y="3" rx="1" />
                <rect width="5" height="5" x="3" y="16" rx="1" />
                <path d="M21 16h-3a2 2 0 0 0-2 2v3" />
                <path d="M21 21v.01" />
                <path d="M12 7v3a2 2 0 0 1-2 2H7" />
                <path d="M3 12h.01" />
                <path d="M12 3h.01" />
                <path d="M12 16v.01" />
                <path d="M16 12h1" />
                <path d="M21 12v.01" />
                <path d="M12 21v-1" />
              </svg>
            </div>
          </div>
        </AccordionContent>
      </AccordionItem>

      <!-- Step 3: Pending -->
      <AccordionItem value="price-stock" class="bg-transparent px-4">
        <AccordionTrigger class="items-center py-4 font-semibold hover:no-underline">
          <div class="flex w-full items-center justify-between pr-4">
            <div class="flex items-center gap-3">
              <div class="flex size-5 items-center justify-center">
                <Spinner class="opacity-60" />
              </div>
              <span class="text-muted-foreground text-sm font-medium">Product price & stock</span>
            </div>
          </div>
        </AccordionTrigger>
        <AccordionContent class="text-muted-foreground pl-8 text-sm leading-relaxed">
          Configure your product pricing and manage stock levels across all locations.
        </AccordionContent>
      </AccordionItem>
    </Accordion>
  </div>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-accordion-11.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)