Skip to content

Draws an icon from an Iconify collection or from one of your own SVG files. For previews and autocomplete with BbIcon, use the Iconify extension.

import { BbIcon } from 'bitboss-ui';

On this page

Use it for

Reach for BbIcon when the icon is part of the design: a status in a table cell, empty-state art, a list marker.

Use something else when

Also see: Icons.

Passthrough

Hover or tap a part to outline it. The toggles turn on loading, errors and warnings where the component has them; only parts get a row.

Draw an icon

Pass the icon name to icon. It is the only required prop.

  • Same-day dispatchOrders placed before 2 pm leave the warehouse today.
  • Stock alertsGet an email when a product drops below its reorder level.
  • Verified suppliersEvery supplier is audited once a year.
Coming from v2type → icon

The prop was called type in v2. A BbIcon still on type has no icon, so it throws at mount: [BbIcon] `icon` is required, with the rename in the message.

Pick a name that resolves

icon takes provider:icon, for example lucide:check. For your own SVGs use local:my-icon (the local: prefix is optional but recommended).

Install the collections you want and the bitboss-ui plugin finds them (without the plugin, a named icon throws Failed to load icons):

bash
npm install -D @iconify-json/lucide
lucide:heart
local:heart
local:whatsapp
whatsapp

A name that does not resolve draws a question mark in a circle and logs one console error with the fix. The cause is a typo, a missing npm install, or a name the build did not bundle. The rest of the page keeps working.

You can also import your own SVGs as strings and pass them straight to icon. Use only markup you control: an SVG carrying event handlers or a <script> is dropped with a warning, never cleaned.

vue
<script setup lang="ts">
import mark from '~/assets/marks/partner.svg?raw';
</script>

<template>
    <BbIcon :icon="mark" size="2xl" />
</template>

Pick a size

Sizes run from xs to 2xl, and md (24px) is the default. A number is pixels, and a CSS length such as 3rem works too.

xs
sm
md
lg
xl
2xl
20
3rem
Coming from v2xxl → 2xl

The largest key is now 2xl.

Set the colour on the parent

Icons inherit the text colour wherever they sit.

  • Payment declined
  • Shipped this morning
  • Not processed yet
Coming from v2color removed

color="#6b7280" becomes a class or a token on the parent. A leftover color raises no error, only a development warning and a bitboss-ui check finding. Inside BbButton, BbBadge or BbAlert there is nothing to do: the icon already takes the right colour.

Accessible name

Add label when the icon is the only thing saying something: it gets role="img" and that text as its name. Leave it off when the text is already beside it, or screen readers read it twice.

Two-factor authentication
Billing
Card ending 4242

label does not produce a tooltip, and a tooltip on a bare icon is pointer-only: keyboard and touch never open it. An info icon with a tip is an icon-only ghost button: <BbButton variant="ghost" icon="lucide:info" v-bb-tooltip="'Prices include VAT'">About prices</BbButton>.

When you do not need it

Most components take the icon name on a prop and place it themselves. Hand-placing a BbIcon inside them is the most common mistake with this component.

ORD-2026-0417 Paid

The exceptions are components with no icon field, where you pass a BbIcon in a slot: BbTabs, BbBreadcrumbs, BbRating, BbSwitch and BbAvatar.

  • ORD-2026-0496Pending
  • ORD-2026-0474Processing
  • ORD-2026-0447Shipped
  • ORD-2026-0417Delivered
  • ORD-2026-0435Cancelled
  • ORD-2026-0421Refunded