Dropdown menu

Row actions behind the more button, with named items.

Row actions

Row actions sit behind a ghost more button, each with a name; the destructive one last.

<script setup>
import { CopyIcon, EllipsisIcon, PencilIcon, Trash2Icon } from '@lucide/vue';
import { Button } from '@aisgroup/design/ui/button';
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '@aisgroup/design/ui/dropdown-menu';
</script>

<template>
  <DropdownMenu>
    <DropdownMenuTrigger as-child><Button variant="ghost" size="icon-sm" aria-label="Actions for PCB inspection"><EllipsisIcon /></Button></DropdownMenuTrigger>
    <DropdownMenuContent align="end">
      <DropdownMenuItem><PencilIcon />Rename</DropdownMenuItem>
      <DropdownMenuItem><CopyIcon />Duplicate</DropdownMenuItem>
      <DropdownMenuSeparator />
      <DropdownMenuItem variant="destructive"><Trash2Icon />Delete</DropdownMenuItem>
    </DropdownMenuContent>
  </DropdownMenu>
</template>

Tag picker

Changing the tag of a row: a ghost button with the swatch, name and chevron opens a radio list.

<script setup>
import { ref } from 'vue';
import { ChevronDownIcon } from '@lucide/vue';
import { Button } from '@aisgroup/design/ui/button';
import { DropdownMenu, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuTrigger } from '@aisgroup/design/ui/dropdown-menu';
const tags = [{ id: 'component', name: 'Component', color: 'var(--chart-1)' }, { id: 'defect', name: 'Defect', color: 'var(--chart-2)' }, { id: 'connector', name: 'Connector', color: 'var(--chart-3)' }];
const tag = ref('defect');
</script>

<template>
  <DropdownMenu>
    <DropdownMenuTrigger as-child>
      <Button variant="ghost">
        <span class="size-3 shrink-0 rounded-sm" :style="{ background: tags.find(t => t.id === tag).color }" />
        {{ tags.find(t => t.id === tag).name }}<ChevronDownIcon data-icon="inline-end" />
      </Button>
    </DropdownMenuTrigger>
    <DropdownMenuContent>
      <DropdownMenuRadioGroup v-model="tag">
        <DropdownMenuRadioItem v-for="t in tags" :key="t.id" :value="t.id"><span class="size-3 shrink-0 rounded-sm" :style="{ background: t.color }" />{{ t.name }}</DropdownMenuRadioItem>
      </DropdownMenuRadioGroup>
    </DropdownMenuContent>
  </DropdownMenu>
</template>

Type to search the guide.