Products use Lucide directly. Install the Lucide package for your framework, pin the version and import each icon by name.
Packages
| Framework | Package | Version |
|---|---|---|
| Vue, for Beehexa products | @lucide/vue |
1.62.0 |
| React | lucide-react |
1.62.0 |
Every product uses the same Lucide version as this site, so the icons match the Library. The icons are bundled into the app at build time. There is no request to a CDN.
Install
npm install @lucide/[email protected] --save-exact
Pin the exact version, with no ^ or ~. A new Lucide version can change a shape or rename an icon, so raise the version on purpose. See Updating Lucide.
Import
Import each icon by name. Names are the Library names in PascalCase: refresh-cw becomes RefreshCw. Only the icons you import end up in the bundle.
<script setup lang="ts">
import { RefreshCw } from '@lucide/vue';
</script>
<template>
<button type="button" class="bh-button">
<RefreshCw :size="16" />
Sync now
</button>
</template>
Don’t import the whole set with import * as. It puts every icon in the bundle.
Default size
Lucide draws icons at 24 px. Beehexa products use 16 px by default. Set it once in the root component:
<!-- App.vue -->
<script setup lang="ts">
import { setLucideProps } from '@lucide/vue';
setLucideProps({ size: 16 });
</script>
Then set size only for a 20, 24 or 32 px icon.
Props
| Prop | Lucide default | Beehexa rule |
|---|---|---|
size |
24 | 16 by default. 20, 24 or 32 only where Usage says so. Nothing else. |
color |
currentColor |
Leave it. Set the colour on the parent with an icon colour token. |
stroke-width |
2 | Don’t change it. |
non-scaling-stroke |
false |
Don’t turn it on. Don’t use its older name, absolute-stroke-width, either. |
aria-label |
none | Only for a meaningful icon on its own, together with the img role. |
Size
Use the size prop, or set the size in CSS on the svg. Both keep the stroke in scale.
<RefreshCw :size="20" />
Colour
.sync-status {
color: var(--bh-color-icon-success);
}
<span class="sync-status"><CircleCheck /> Synced</span>
Spacing
Set the gap on the control, from its size: 4 px (space.050) with a 16 px icon in small and default controls, 8 px (space.100) with a 20 or 24 px icon. See spacing in icon usage.
.bh-button {
display: inline-flex;
align-items: center;
gap: var(--bh-space-050);
}
.bh-button.is-large {
gap: var(--bh-space-100);
}
Accessibility
Lucide hides an icon from screen readers with aria-hidden="true", unless you give it an aria-*, role or title prop. Name icon-only buttons on the button, and add a tooltip with the same text.
<!-- Wrap the button in your Tooltip component, with the same text: "Settings" -->
<button type="button" class="icon-button" aria-label="Settings">
<Settings />
</button>
A meaningful icon on its own gets a role and a label, which also removes aria-hidden:
<CircleX role="img" aria-label="Failed" />
React
lucide-react has the same icons and props, in camelCase. Set the default size once with LucideProvider.
import { LucideProvider, RefreshCw } from 'lucide-react';
<LucideProvider size={16}>
<button type="button">
<RefreshCw />
Sync now
</button>
</LucideProvider>
Astro
beehexa.design uses @lucide/astro. Import each icon from its own file, so the build stays fast:
---
import Search from '@lucide/astro/icons/search';
---
<button class="icon-button" type="button" aria-label="Search">
<Search size={20} />
</button>
Custom icons
If Lucide has no icon for something Beehexa needs, draw it on Lucide’s 24 px grid with the same stroke and caps, name it in kebab-case with a bh- prefix, and add it to the library.
Updating Lucide
- Read the Lucide release notes for renamed or changed icons.
- Check that every icon in Common actions still exists.
- Raise the pinned version in the product, and ask the design system team to update the Library, so it shows the same icons.