使用 React 19 + Vite 8 + Tailwind CSS 4 + lucide-react,根据 UI 描述或图片生成完整的前端页面代码,输出项目结构和组件。
Web UI 构建器. 自动从视觉描述或图像引用中生成完整的前端页面代码.是一项面向实际任务的技能,主要用于Fixed tech stack: React 19 + Vite 8 + Tailwind CSS 4 + 清晰反应.;Tech Stack.。
实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;
涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。
根据视觉描述或图像参考,自动生成完整的前端页面代码。固定技术栈:React 19 + Vite 8 + Tailwind CSS 4 + lucide-react。
| 技术 | 版本 | 用途 |
|---|---|---|
| React | 19+ | UI 框架 |
| Vite | 8+ | 构建工具 |
| Tailwind CSS | 4+ | 样式(CSS 驱动,无需 tailwind.config.js) |
| lucide-react | 1.17+ | 图标库 |
| @vitejs/plugin-react | latest | Vite React 插件 |
Tailwind CSS 4 采用 CSS 驱动的配置方式,无需 tailwind.config.js 或 postcss.config.js:
/* src/index.css — 替代 tailwind.config.js + postcss */
@import "tailwindcss";
/* 自定义主题色 */
@theme {
--color-brand-50: #eef2ff;
--color-brand-100: #e0e7ff;
--color-brand-500: #6366f1;
--color-brand-600: #4f46e5;
--color-brand-700: #4338ca;
}
/* 自定义组件类 */
@layer components {
.card { @apply rounded-xl bg-white p-6 shadow-sm border border-gray-100; }
.btn-primary { @apply rounded-lg bg-brand-600 px-4 py-2.5 text-sm font-medium text-white hover:bg-brand-700 transition-colors; }
}
主要变更点:
@tailwind base/components/utilities → @import "tailwindcss"@theme 指令,替代 tailwind.config.js 中的 theme.extend@layer componentspostcss.config.js(由 Vite 内置处理)tailwind.config.js 中配置 content{
"dependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"lucide-react": "^1.17.0"
},
"devDependencies": {
"@vitejs/plugin-react": "^latest",
"tailwindcss": "^4.0.0",
"vite": "^8.0.0"
}
}
project/
├── package.json
├── vite.config.js
├── index.html
└── src/
├── main.jsx # React 入口文件
├── index.css # @import "tailwindcss" + @theme 自定义主题
├── App.jsx # 根组件
├── LoginPage.jsx # (按需生成)登录页
├── DashboardPage.jsx # (按需生成)仪表盘页
├── Sidebar.jsx # (按需生成)侧边栏
├── Header.jsx # (按需生成)页眉
└── ... # (按需生成)其他组件
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
})
用户输入(描述/图像)→ 提取功能模块 → 组装骨架 + 内容模块 → 生成文件 → 返回目录结构 + 启动命令
不预设页面类型,而是从用户描述中识别 功能模块,并按需动态组合:
| 组件 | 使用场景 |
|---|---|
TopNav |
页面顶部导航(链接 / 品牌 / 搜索 / 用户菜单) |
Sidebar |
侧边菜单(图标+标签 / 层级结构 / 用户信息) |
Header |
内容区域顶部栏(标题 / 面包屑 / 操作按钮 / 通知) |
Footer |
页面页脚(链接 / 版权声明 / 社交媒体) |
| 模块 | 触发关键词 |
|---|---|
HeroBanner |
"banner/hero/welcome/featured" |
FormSection |
"form/input/register/login/feedback" |
StatsCards |
"statistics/metrics/KPI/overview" |
DataTable |
"table/list/data rows/records" |
CardGrid |
"cards/grid/gallery/showcase" |
ChartSection |
"chart/trend/distribution/visualization" |
Timeline |
"timeline/progress/flow/steps" |
Modal |
"modal/dialog/confirmation" |
Tabs |
"tabs/switch/categories" |
SearchBar |
"search/filter/filtering" |
示例:
Sidebar + StatsCards + DataTableFormSection(login) + background decorationTopNav + CardGrid + Footerindex.css 中的 @theme 自定义调色板rounded-xl,按钮与输入框使用 rounded-lgshadow-smhttps://images.unsplash.com/photo-{id} 或 picsum.photosmax-w-7xl 并居中grid-cols-1 md:grid-cols-2 lg:grid-cols-3node_modules/ 目录npm install && npm run devtailwind.config.js 或 postcss.config.js相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 133.9万人学习
共49课时 | 82.5万人学习