lucide-laravel

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Lucide Laravel

Lucide Laravel 集成

Laravel Blade integration for the Lucide icon library - 1,666+ beautiful, consistent SVG icons.
Lucide 图标库提供 Laravel Blade 集成——包含1666+款美观、风格统一的SVG图标。

Installation

安装

bash
composer require mallardduck/blade-lucide-icons
Clear view cache if icons don't appear:
bash
php artisan view:clear
bash
composer require mallardduck/blade-lucide-icons
如果图标未显示,请清除视图缓存:
bash
php artisan view:clear

Quick Start

快速开始

Basic Usage

基础用法

Icons use the
x-lucide-
prefix with kebab-case naming:
blade
<x-lucide-activity />
<x-lucide-heart />
<x-lucide-shopping-cart />
<x-lucide-circle-check />
图标使用
x-lucide-
前缀,名称采用短横线分隔式(kebab-case):
blade
<x-lucide-activity />
<x-lucide-heart />
<x-lucide-shopping-cart />
<x-lucide-circle-check />

Naming Convention

命名规范

Convert PascalCase icon names to kebab-case:
Icon NameBlade Component
Activity
<x-lucide-activity />
ShoppingCart
<x-lucide-shopping-cart />
CircleCheck
<x-lucide-circle-check />
ArrowRight
<x-lucide-arrow-right />
将帕斯卡命名法(PascalCase)的图标名称转换为短横线分隔式:
图标名称Blade组件
Activity
<x-lucide-activity />
ShoppingCart
<x-lucide-shopping-cart />
CircleCheck
<x-lucide-circle-check />
ArrowRight
<x-lucide-arrow-right />

Styling

样式设置

Tailwind CSS

Tailwind CSS

blade
<!-- Size and color -->
<x-lucide-album class="w-6 h-6 text-gray-500"/>

<!-- Responsive sizing -->
<x-lucide-heart class="w-4 h-4 md:w-6 md:h-6 text-red-500"/>

<!-- Hover effects -->
<x-lucide-star class="w-5 h-5 text-yellow-400 hover:text-yellow-500 cursor-pointer"/>

<!-- Transitions -->
<x-lucide-bell class="w-6 h-6 text-gray-700 hover:text-gray-900 transition-colors duration-200"/>
blade
<!-- 尺寸与颜色 -->
<x-lucide-album class="w-6 h-6 text-gray-500"/>

<!-- 响应式尺寸 -->
<x-lucide-heart class="w-4 h-4 md:w-6 md:h-6 text-red-500"/>

<!-- 悬停效果 -->
<x-lucide-star class="w-5 h-5 text-yellow-400 hover:text-yellow-500 cursor-pointer"/>

<!-- 过渡效果 -->
<x-lucide-bell class="w-6 h-6 text-gray-700 hover:text-gray-900 transition-colors duration-200"/>

Inline Styles

内联样式

blade
<x-lucide-anchor style="color: #555"/>
<x-lucide-heart style="color: #ff0000; width: 48px; height: 48px;"/>
<x-lucide-activity style="color: var(--primary-color); stroke-width: 1.5;"/>
blade
<x-lucide-anchor style="color: #555"/>
<x-lucide-heart style="color: #ff0000; width: 48px; height: 48px;"/>
<x-lucide-activity style="color: var(--primary-color); stroke-width: 1.5;"/>

Common Patterns

常见使用场景

Navigation Menus

导航菜单

blade
<nav>
    <div class="flex items-center gap-6">
        <a href="/dashboard" class="flex items-center gap-2">
            <x-lucide-layout-dashboard class="w-5 h-5"/>
            <span>Dashboard</span>
        </a>
        <a href="/products" class="flex items-center gap-2">
            <x-lucide-package class="w-5 h-5"/>
            <span>Products</span>
        </a>
        <a href="/settings" class="flex items-center gap-2">
            <x-lucide-settings class="w-5 h-5"/>
            <span>Settings</span>
        </a>
    </div>
</nav>
blade
<nav>
    <div class="flex items-center gap-6">
        <a href="/dashboard" class="flex items-center gap-2">
            <x-lucide-layout-dashboard class="w-5 h-5"/>
            <span>仪表盘</span>
        </a>
        <a href="/products" class="flex items-center gap-2">
            <x-lucide-package class="w-5 h-5"/>
            <span>产品</span>
        </a>
        <a href="/settings" class="flex items-center gap-2">
            <x-lucide-settings class="w-5 h-5"/>
            <span>设置</span>
        </a>
    </div>
</nav>

Form Inputs

表单输入框

blade
<div class="relative">
    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
        <x-lucide-search class="w-5 h-5 text-gray-400"/>
    </div>
    <input type="text" class="pl-10 w-full border rounded-lg" placeholder="Search..."/>
</div>
blade
<div class="relative">
    <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
        <x-lucide-search class="w-5 h-5 text-gray-400"/>
    </div>
    <input type="text" class="pl-10 w-full border rounded-lg" placeholder="搜索..."/>
</div>

Alerts

提示框

blade
<!-- Success -->
<div class="flex items-start gap-3 p-4 bg-green-50 border-l-4 border-green-500 rounded">
    <x-lucide-check-circle class="w-6 h-6 text-green-600 flex-shrink-0"/>
    <div>
        <h4 class="font-semibold text-green-800">Success!</h4>
        <p class="text-green-700">Your changes have been saved.</p>
    </div>
</div>

<!-- Error -->
<div class="flex items-start gap-3 p-4 bg-red-50 border-l-4 border-red-500 rounded">
    <x-lucide-alert-circle class="w-6 h-6 text-red-600 flex-shrink-0"/>
    <div>
        <h4 class="font-semibold text-red-800">Error</h4>
        <p class="text-red-700">Something went wrong.</p>
    </div>
</div>

<!-- Info -->
<div class="flex items-start gap-3 p-4 bg-blue-50 border-l-4 border-blue-500 rounded">
    <x-lucide-info class="w-6 h-6 text-blue-600 flex-shrink-0"/>
    <p class="text-blue-700">Please review your changes before submitting.</p>
</div>
blade
<!-- 成功提示 -->
<div class="flex items-start gap-3 p-4 bg-green-50 border-l-4 border-green-500 rounded">
    <x-lucide-check-circle class="w-6 h-6 text-green-600 flex-shrink-0"/>
    <div>
        <h4 class="font-semibold text-green-800">成功!</h4>
        <p class="text-green-700">您的修改已保存。</p>
    </div>
</div>

<!-- 错误提示 -->
<div class="flex items-start gap-3 p-4 bg-red-50 border-l-4 border-red-500 rounded">
    <x-lucide-alert-circle class="w-6 h-6 text-red-600 flex-shrink-0"/>
    <div>
        <h4 class="font-semibold text-red-800">错误</h4>
        <p class="text-red-700">出现了一些问题。</p>
    </div>
</div>

<!-- 信息提示 -->
<div class="flex items-start gap-3 p-4 bg-blue-50 border-l-4 border-blue-500 rounded">
    <x-lucide-info class="w-6 h-6 text-blue-600 flex-shrink-0"/>
    <p class="text-blue-700">提交前请检查您的修改。</p>
</div>

Action Buttons

操作按钮

blade
<!-- Icon-only button with aria-label -->
<button class="p-2 hover:bg-gray-100 rounded" aria-label="Delete">
    <x-lucide-trash class="w-5 h-5 text-red-600"/>
</button>

<!-- Button with icon and text -->
<button class="flex items-center gap-2 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700">
    <x-lucide-save class="w-5 h-5"/>
    <span>Save</span>
</button>

<!-- Primary action -->
<button class="flex items-center gap-2 bg-green-600 text-white px-4 py-2 rounded-lg">
    <x-lucide-plus class="w-5 h-5"/>
    <span>Add New</span>
</button>
blade
<!-- 仅图标按钮 - 务必添加aria-label -->
<button class="p-2 hover:bg-gray-100 rounded" aria-label="删除">
    <x-lucide-trash class="w-5 h-5 text-red-600"/>
</button>

<!-- 带图标和文字的按钮 -->
<button class="flex items-center gap-2 bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700">
    <x-lucide-save class="w-5 h-5"/>
    <span>保存</span>
</button>

<!-- 主要操作按钮 -->
<button class="flex items-center gap-2 bg-green-600 text-white px-4 py-2 rounded-lg">
    <x-lucide-plus class="w-5 h-5"/>
    <span>新增</span>
</button>

With Livewire

与Livewire配合使用

blade
<!-- Loading states -->
<button wire:click="refresh" class="flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg">
    <x-lucide-refresh-cw class="w-5 h-5" wire:loading.class="animate-spin"/>
    <span wire:loading.remove>Refresh Data</span>
    <span wire:loading>Loading...</span>
</button>

<!-- Toggle icon based on state -->
<div class="flex items-center gap-2">
    @if($isFavorited)
        <x-lucide-heart class="w-5 h-5 text-red-500 fill-current" wire:click="unfavorite"/>
    @else
        <x-lucide-heart class="w-5 h-5 text-gray-400" wire:click="favorite"/>
    @endif
</div>
blade
<!-- 加载状态 -->
<button wire:click="refresh" class="flex items-center gap-2 px-4 py-2 bg-blue-600 text-white rounded-lg">
    <x-lucide-refresh-cw class="w-5 h-5" wire:loading.class="animate-spin"/>
    <span wire:loading.remove>刷新数据</span>
    <span wire:loading>加载中...</span>
</button>

<!-- 根据状态切换图标 -->
<div class="flex items-center gap-2">
    @if($isFavorited)
        <x-lucide-heart class="w-5 h-5 text-red-500 fill-current" wire:click="unfavorite"/>
    @else
        <x-lucide-heart class="w-5 h-5 text-gray-400" wire:click="favorite"/>
    @endif
</div>

Dynamic Icons

动态图标

Use
<x-dynamic-component>
for dynamic icon names:
blade
@php
    $iconName = 'heart';
    $iconComponent = 'lucide-' . $iconName;
@endphp

<x-dynamic-component :component="$iconComponent" class="w-6 h-6" />
Common use case - icon from database:
blade
<x-dynamic-component
    :component="'lucide-' . $menu->icon"
    class="w-5 h-5"
/>
使用
<x-dynamic-component>
实现动态图标名称:
blade
@php
    $iconName = 'heart';
    $iconComponent = 'lucide-' . $iconName;
@endphp

<x-dynamic-component :component="$iconComponent" class="w-6 h-6" />
常见场景 - 从数据库获取图标名称:
blade
<x-dynamic-component
    :component="'lucide-' . $menu->icon"
    class="w-5 h-5"
/>

Best Practices

最佳实践

Consistent Sizing

统一尺寸

ContextSize
Navigation
w-5 h-5
Button (small)
w-4 h-4
Button (medium)
w-5 h-5
Feature icons
w-12 h-12
Hero icons
w-16 h-16
使用场景尺寸
导航菜单
w-5 h-5
小型按钮
w-4 h-4
中型按钮
w-5 h-5
功能图标
w-12 h-12
首页主图标
w-16 h-16

Semantic Icon Usage

语义化图标使用

Choose icons that clearly represent their action:
blade
<x-lucide-trash />        <!-- Delete -->
<x-lucide-edit />         <!-- Edit -->
<x-lucide-download />     <!-- Download -->
<x-lucide-upload />       <!-- Upload -->
<x-lucide-copy />         <!-- Copy -->
<x-lucide-share />        <!-- Share -->
<x-lucide-settings />     <!-- Settings -->
<x-lucide-user />         <!-- User/Profile -->
<x-lucide-home />         <!-- Home -->
选择能清晰代表操作含义的图标:
blade
<x-lucide-trash />        <!-- 删除 -->
<x-lucide-edit />         <!-- 编辑 -->
<x-lucide-download />     <!-- 下载 -->
<x-lucide-upload />       <!-- 上传 -->
<x-lucide-copy />         <!-- 复制 -->
<x-lucide-share />        <!-- 分享 -->
<x-lucide-settings />     <!-- 设置 -->
<x-lucide-user />         <!-- 用户/个人资料 -->
<x-lucide-home />         <!-- 首页 -->

Color Semantics

颜色语义化

blade
<!-- Primary actions -->
<x-lucide-save class="w-5 h-5 text-blue-600"/>

<!-- Success states -->
<x-lucide-check class="w-5 h-5 text-green-600"/>
<x-lucide-check-circle class="w-5 h-5 text-green-600"/>

<!-- Danger/warning -->
<x-lucide-trash class="w-5 h-5 text-red-600"/>
<x-lucide-alert-triangle class="w-5 h-5 text-yellow-600"/>

<!-- Neutral/secondary -->
<x-lucide-info class="w-5 h-5 text-gray-600"/>
blade
<!-- 主要操作 -->
<x-lucide-save class="w-5 h-5 text-blue-600"/>

<!-- 成功状态 -->
<x-lucide-check class="w-5 h-5 text-green-600"/>
<x-lucide-check-circle class="w-5 h-5 text-green-600"/>

<!-- 危险/警告 -->
<x-lucide-trash class="w-5 h-5 text-red-600"/>
<x-lucide-alert-triangle class="w-5 h-5 text-yellow-600"/>

<!-- 中性/次要操作 -->
<x-lucide-info class="w-5 h-5 text-gray-600"/>

Accessibility

可访问性

blade
<!-- Icon-only button - always include aria-label -->
<button aria-label="Close dialog">
    <x-lucide-x class="w-6 h-6"/>
</button>

<!-- Decorative icon - hide from screen readers -->
<x-lucide-star class="w-5 h-5" aria-hidden="true"/>

<!-- Icon with visible text - accessible by default -->
<button class="flex items-center gap-2">
    <x-lucide-download class="w-5 h-5"/>
    <span>Download</span>
</button>
blade
<!-- 仅图标按钮 - 务必添加aria-label -->
<button aria-label="关闭对话框">
    <x-lucide-x class="w-6 h-6"/>
</button>

<!-- 装饰性图标 - 对屏幕阅读器隐藏 -->
<x-lucide-star class="w-5 h-5" aria-hidden="true"/>

<!-- 带可见文字的图标 - 默认具备可访问性 -->
<button class="flex items-center gap-2">
    <x-lucide-download class="w-5 h-5"/>
    <span>下载</span>
</button>

Icon Reference

图标参考

Total Icons: 1,666 across 43 categories
总图标数: 覆盖43个分类,共1666款图标

Quick Reference

快速参考

CategoryCountFileCommon Icons
Accessibility30accessibility.md
accessibility
,
eye
,
ear
,
glasses
,
sun
,
moon
Accounts & access133accounts-access.md
user
,
users
,
shield
,
key
,
lock
,
log-in
,
log-out
Animals23animals.md
dog
,
cat
,
bird
,
bug
,
fish
,
paw-print
Arrows209arrows.md
arrow-up
,
arrow-down
,
chevron-left
,
chevron-right
Brands21brands.md
github
,
twitter
,
facebook
,
instagram
,
youtube
Buildings25buildings.md
building
,
building-2
,
home
,
warehouse
,
store
Charts31charts.md
bar-chart
,
line-chart
,
pie-chart
,
trending-up
,
trending-down
Coding & development243coding-development.md
code
,
terminal
,
git-branch
,
git-commit
,
bug
,
cpu
Communication54communication.md
mail
,
message-circle
,
phone
,
send
,
bell
,
rss
Connectivity90connectivity.md
wifi
,
bluetooth
,
usb
,
cast
,
radio
,
signal
Cursors33cursors.md
mouse-pointer
,
hand
,
move
,
crosshair
,
pointer
Design145design.md
palette
,
paintbrush
,
eraser
,
pen-tool
,
selection
Devices164devices.md
laptop
,
monitor
,
smartphone
,
tablet
,
keyboard
,
hard-drive
Emoji28emoji.md
smile
,
frown
,
meh
,
heart
,
thumbs-up
,
thumbs-down
File icons162file-icons.md
file
,
file-text
,
folder
,
upload
,
download
,
copy
Finance56finance.md
dollar-sign
,
credit-card
,
wallet
,
banknote
,
coins
,
piggy-bank
Food & beverage69food-beverage.md
coffee
,
utensils
,
pizza
,
burger
,
beer
,
cake
Gaming148gaming.md
gamepad
,
gamepad-2
,
trophy
,
dice
,
puzzle
,
sword
Home57home.md
couch
,
chair
,
bed
,
lamp
,
tv
,
bathtub
Layout139layout.md
layout
,
panel-left
,
panel-right
,
columns
,
sidebar
,
grid
Mail26mail.md
mail
,
inbox
,
send
,
at-sign
,
mail-open
,
mail-check
Mathematics74mathematics.md
equal
,
plus
,
minus
,
divide
,
percent
,
infinity
Medical42medical.md
heart-pulse
,
activity
,
pill
,
syringe
,
stethoscope
,
bone
Multimedia138multimedia.md
play
,
pause
,
volume
,
music
,
image
,
video
Nature23nature.md
tree
,
flower
,
leaf
,
sun
,
cloud
,
mountain
Navigation, Maps, POIs84navigation-maps-pois.md
map
,
map-pin
,
compass
,
navigation
,
route
,
flag
Notification39notification.md
bell
,
bell-ring
,
alert-circle
,
alert-triangle
,
info
People3people.md
user
,
users
,
user-plus
Photography75photography.md
camera
,
image
,
aperture
,
shutter
,
lens
,
film
Science32science.md
flask
,
microscope
,
atom
,
beaker
,
magnet
,
dna
Seasons5seasons.md
sun
,
cloud-rain
,
snowflake
,
thermometer
Security55security.md
shield
,
lock
,
unlock
,
key
,
fingerprint
,
eye-off
Shapes48shapes.md
circle
,
square
,
triangle
,
star
,
hexagon
,
diamond
Shopping27shopping.md
shopping-cart
,
shopping-bag
,
credit-card
,
tag
,
package
Social119social.md
heart
,
thumbs-up
,
share
,
bookmark
,
user-plus
,
link
Sports13sports.md
football
,
basketball
,
tennis
,
golf
,
trophy
,
medal
Sustainability24sustainability.md
recycle
,
leaf
,
tree
,
sun
,
wind
,
droplet
Text formatting246text-formatting.md
bold
,
italic
,
underline
,
align-left
,
list
,
quote
Time & calendar58time-calendar.md
calendar
,
clock
,
timer
,
hourglass
,
watch
,
alarm
Tools66tools.md
hammer
,
wrench
,
screwdriver
,
saw
,
drill
,
measure
Transportation64transportation.md
car
,
bus
,
train
,
plane
,
bike
,
ship
Travel67travel.md
suitcase
,
plane
,
hotel
,
map
,
compass
,
passport
Weather45weather.md
sun
,
cloud
,
cloud-rain
,
snowflake
,
lightning
,
wind
分类数量文件常见图标
无障碍30accessibility.md
accessibility
,
eye
,
ear
,
glasses
,
sun
,
moon
账号与权限133accounts-access.md
user
,
users
,
shield
,
key
,
lock
,
log-in
,
log-out
动物23animals.md
dog
,
cat
,
bird
,
bug
,
fish
,
paw-print
箭头209arrows.md
arrow-up
,
arrow-down
,
chevron-left
,
chevron-right
品牌21brands.md
github
,
twitter
,
facebook
,
instagram
,
youtube
建筑25buildings.md
building
,
building-2
,
home
,
warehouse
,
store
图表31charts.md
bar-chart
,
line-chart
,
pie-chart
,
trending-up
,
trending-down
编码与开发243coding-development.md
code
,
terminal
,
git-branch
,
git-commit
,
bug
,
cpu
通讯54communication.md
mail
,
message-circle
,
phone
,
send
,
bell
,
rss
连接性90connectivity.md
wifi
,
bluetooth
,
usb
,
cast
,
radio
,
signal
光标33cursors.md
mouse-pointer
,
hand
,
move
,
crosshair
,
pointer
设计145design.md
palette
,
paintbrush
,
eraser
,
pen-tool
,
selection
设备164devices.md
laptop
,
monitor
,
smartphone
,
tablet
,
keyboard
,
hard-drive
表情符号28emoji.md
smile
,
frown
,
meh
,
heart
,
thumbs-up
,
thumbs-down
文件图标162file-icons.md
file
,
file-text
,
folder
,
upload
,
download
,
copy
金融56finance.md
dollar-sign
,
credit-card
,
wallet
,
banknote
,
coins
,
piggy-bank
餐饮69food-beverage.md
coffee
,
utensils
,
pizza
,
burger
,
beer
,
cake
游戏148gaming.md
gamepad
,
gamepad-2
,
trophy
,
dice
,
puzzle
,
sword
家居57home.md
couch
,
chair
,
bed
,
lamp
,
tv
,
bathtub
布局139layout.md
layout
,
panel-left
,
panel-right
,
columns
,
sidebar
,
grid
邮件26mail.md
mail
,
inbox
,
send
,
at-sign
,
mail-open
,
mail-check
数学74mathematics.md
equal
,
plus
,
minus
,
divide
,
percent
,
infinity
医疗42medical.md
heart-pulse
,
activity
,
pill
,
syringe
,
stethoscope
,
bone
多媒体138multimedia.md
play
,
pause
,
volume
,
music
,
image
,
video
自然23nature.md
tree
,
flower
,
leaf
,
sun
,
cloud
,
mountain
导航、地图、兴趣点84navigation-maps-pois.md
map
,
map-pin
,
compass
,
navigation
,
route
,
flag
通知39notification.md
bell
,
bell-ring
,
alert-circle
,
alert-triangle
,
info
人物3people.md
user
,
users
,
user-plus
摄影75photography.md
camera
,
image
,
aperture
,
shutter
,
lens
,
film
科学32science.md
flask
,
microscope
,
atom
,
beaker
,
magnet
,
dna
季节5seasons.md
sun
,
cloud-rain
,
snowflake
,
thermometer
安全55security.md
shield
,
lock
,
unlock
,
key
,
fingerprint
,
eye-off
形状48shapes.md
circle
,
square
,
triangle
,
star
,
hexagon
,
diamond
购物27shopping.md
shopping-cart
,
shopping-bag
,
credit-card
,
tag
,
package
社交119social.md
heart
,
thumbs-up
,
share
,
bookmark
,
user-plus
,
link
运动13sports.md
football
,
basketball
,
tennis
,
golf
,
trophy
,
medal
可持续发展24sustainability.md
recycle
,
leaf
,
tree
,
sun
,
wind
,
droplet
文本格式246text-formatting.md
bold
,
italic
,
underline
,
align-left
,
list
,
quote
时间与日历58time-calendar.md
calendar
,
clock
,
timer
,
hourglass
,
watch
,
alarm
工具66tools.md
hammer
,
wrench
,
screwdriver
,
saw
,
drill
,
measure
交通64transportation.md
car
,
bus
,
train
,
plane
,
bike
,
ship
旅行67travel.md
suitcase
,
plane
,
hotel
,
map
,
compass
,
passport
天气45weather.md
sun
,
cloud
,
cloud-rain
,
snowflake
,
lightning
,
wind

Finding Icons

查找图标

  1. Browse by category: Read the category reference files for complete icon lists
  2. Search visually: Visit lucide.dev/icons
  3. Use autocomplete: IDEs with Blade autocomplete can suggest available icons
  1. 按分类浏览: 查看分类参考文件获取完整图标列表
  2. 可视化搜索: 访问lucide.dev/icons
  3. 使用自动补全: 支持Blade自动补全的IDE会提示可用图标

Category File Format

分类文件格式

Each category file contains:
  • Icon count and description
  • Complete table of icons with Blade component syntax
  • Related categories for each icon
  • Usage examples specific to that category
每个分类文件包含:
  • 图标数量与描述
  • 包含Blade组件语法的完整图标表格
  • 每个图标相关的分类
  • 该分类特有的使用示例

Troubleshooting

故障排查

Icons not displaying:
bash
php artisan view:clear
Styling not applied:
  • Ensure Tailwind processes Blade files
  • Check icon names use kebab-case
Publish raw SVGs (optional):
bash
php artisan vendor:publish --tag=blade-lucide-icons --force
图标未显示:
bash
php artisan view:clear
样式未生效:
  • 确保Tailwind处理Blade文件
  • 检查图标名称是否使用短横线分隔式
发布原始SVG(可选):
bash
php artisan vendor:publish --tag=blade-lucide-icons --force