On this page

Icon button

Install, props and the parts Icon button is built from.

Install

Run these in the app, after shadcn-vue init and the Beehexa theme (Button › Code):

npx shadcn-vue@latest add https://beehexa.design/r/button.json
npx shadcn-vue@latest add https://beehexa.design/r/tooltip.json
npx shadcn-vue@latest add https://beehexa.design/r/copy-button.json

Use

<script setup lang="ts">
import { Ellipsis, ListFilter, RefreshCw, Trash2 } from '@lucide/vue'
import { Button } from '@/components/ui/button'
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'

const tools = [
  { label: 'Sync now', icon: RefreshCw },
  { label: 'Filter', icon: ListFilter },
  { label: 'More actions', icon: Ellipsis },
]
</script>

<template>
  <TooltipProvider>
    <div class="flex items-center gap-(--bh-space-150)">
      <Tooltip v-for="tool in tools" :key="tool.label" relationship="label">
        <TooltipTrigger as-child>
          <Button variant="ghost" size="icon">
            <component :is="tool.icon" />
          </Button>
        </TooltipTrigger>
        <TooltipContent>{{ tool.label }}</TooltipContent>
      </Tooltip>
      <Tooltip relationship="label">
        <TooltipTrigger as-child>
          <Button variant="ghost-destructive" size="icon">
            <Trash2 />
          </Button>
        </TooltipTrigger>
        <TooltipContent>Delete mapping</TooltipContent>
      </Tooltip>
    </div>
  </TooltipProvider>
</template>

Props

Prop Values Notes
Button size icon-sm, icon, icon-lg Squares of 24, 32 and 40 px
Tooltip relationship "label" Required with a tooltip: the tooltip text becomes the button’s name. Without a tooltip, set aria-label on the button instead
CopyButton value string Text that goes to the clipboard
CopyButton label string, default Copy Name and tooltip, such as “Copy API key”
CopyButton copiedLabel string, default Copied Said by the live region after copying

Built on

Icon button is the Button with an icon size, so it has no component of its own. Copy button is a small preset built from Button and Tooltip.