恒美微站 Logo 恒美微站
  • 首页
  • 关于我们
  • 建站服务
  • 主题模板
  • 案例展示
  • 资讯中心
  • 联系我们

使用 Qwik 与 Tailwind CSS 集成 Flowbite 组件库完整指南

  • 首页
  • 资讯中心
  • /
  • 使用 Qwik 与 Tailwind CSS 集成 Flowbite 组件库完整指南

相关资讯

Ocelot 不支持的三大功能:Chunked 编码、Host 头转发与内建 Swagger 方案详解 2026/9/25 2:39:36
BullMQ Pro 暂停组(Pause Groups)完整指南:pauseGroup 与 resumeGroup 实战解析 2026/9/25 2:39:36
psAPISDK 6.0.1.9_2 工业相机通信SDK实战指南 2026/9/25 2:34:35

最新资讯

电动汽车充放电紧急性指标调度方法实战指南
plannotator PR 描述批注实战:用共享 Prose 批注引擎让评审者一行划选就能评论 PR 正文
GKE 上使用 nginx-ingress-controller 部署 ExternalDNS:从节点 Scopes 到 Workload Identity 的完整实战指南
NG-ZORRO Comment 评论组件实战:nz-comment 结构、API 与嵌套评论实现解析
Video2X开源AI视频放大与插帧:本地超分辨率修复老旧素材实战
F´ 框架软件架构导读:基于 Doxygen 主页的组件库、端口模型与包结构全解析

今日推荐

AI元人文:从工具使用到思维重构的深度探索
Python+CNN车牌识别实战:从数据预处理到模型训练与部署
Vim基础操作全攻略:保存退出、模式切换与高频命令实战

本周热门

BrewUI:给Homebrew套上图形界面,让macOS软件包管理更简单
BrewUI:让Homebrew包管理变得可视化与高效
公式与文本对齐全攻略:从Word到LaTeX的实用技巧

本月精选

自研推理加速器Redwood:两周内实现PyTorch模型高效部署的实战教程
V4L2摄像头采集实战:从camera_client.rar到出图全流程解析
从“谁发明了钢琴键”到知识问答智能体:RAG与记忆工程实践

使用 Qwik 与 Tailwind CSS 集成 Flowbite 组件库完整指南

发布时间:2026/9/25 2:39:36
使用 Qwik 与 Tailwind CSS 集成 Flowbite 组件库完整指南 UI组件前端【免费下载链接】flowbiteOpen-source UI component library and front-end development framework based on Tailwind CSS项目地址https://gitcode.com/gh_mirrors/fl/flowbite点击查看免费下载本指南围绕 Flowbite 官方文档中 Qwik 集成章节完整讲解如何从零创建一个 Qwik 项目、安装配置 Tailwind CSS并在 Qwik 中接入 Flowbite 的开源 UI 组件库。读完本文你将掌握 Qwik 项目中 Flowbite 的完整接入流程CSS 主题、Tailwind 插件、JS 初始化三件套并能在 Qwik 视图文件中直接使用 Navbar、Modal、Hero 等交互组件。为什么在 Qwik 中使用 FlowbiteQwik 是 Builder 团队开发的开源前端框架其核心卖点是基于精确懒加载precision lazy-loading实现即时加载——组件渲染、任务、事件监听器与样式都按需异步加载。Flowbite 则是基于 Tailwind CSS 的 UI 组件库通过工具类utility-first配合自定义交互 JavaScript 提供下拉菜单、导航栏、模态框等开箱即用的组件。两者结合可以在保证首屏即时加载体验的同时快速搭建具备完整交互能力的前端界面。本文对应的完整操作流程与官方组件使用方式可在 content/getting-started/qwik.md 中查看本仓库中 flowbite 当前版本为 4.0.2见 package.json。前置要求开始前请确认你的本机环境满足以下条件安装Node.js v16.8 或更高版本Qwik 的 CLI 与开发服务器依赖 Node 运行时建议安装Qwik VS Code 扩展Qwik Snippets以获得 Qwik 组件的代码片段提示提升开发效率。第一步创建 Qwik 项目在终端中执行以下命令通过 Qwik 官方 CLI 创建新项目npm create qwiklatestQwik 的交互式 CLI 会依次询问项目名称、启动器模板等配置项按提示逐步选择即可完成后会得到一个可运行的项目目录。创建完成后启动本地开发服务器npm run start启动成功后在浏览器中访问http://localhost:5173/即可看到 Qwik 的初始模板页面并开始基于该框架开发。第二步安装并配置 Tailwind CSSTailwind CSS 是流行的 utility-first CSS 框架允许直接在 HTML 模板中通过丰富的工具类编写样式。在 Qwik 项目中接入 Tailwind CSS 最快捷的方式是使用 Qwik 提供的 starter 脚本npm run qwik add tailwind该命令会自动完成两件事安装 Tailwind CSS 及其依赖修改项目的src/global.css引入 Tailwind 模块。执行完成后重启开发服务器即可在模板中直接使用 Tailwind 的工具类。说明Qwik 的qwik add命令本质是官方提供的集成脚本负责把 Tailwind 的构建配置接入 Qwik 的 Vite 构建链因此执行后通常需要重启开发服务器才能生效。第三步在 Qwik 中安装 FlowbiteFlowbite 是基于 Tailwind CSS 构建的开源 UI 组件库通过工具类加交互 JavaScript 提供 Navbar、Dropdown、Modal、Drawer 等组件。在 Qwik 项目中接入 Flowbite 需要完成以下 5 个步骤。1. 通过 NPM 安装依赖npm install flowbite --save安装完成后Flowbite 会被写入项目的package.json依赖清单中。2. 导入默认主题变量在项目主 CSS 文件src/global.css中导入 Flowbite 的默认主题import flowbite/src/themes/default;该指令导入的是 Flowbite 包内 src/themes/default.css 所定义的 CSS 变量主题其中包含字体栈--font-sans、--font-mono、圆角--radius-base等、文字色--color-heading、--color-body、品牌色--color-fg-brand等与背景色变量供后续组件样式与 Tailwind 工具类统一引用。仓库中还提供了enterprise、minimal、mono、playful等其他主题见 src/themes可替换默认主题实现换肤。3. 引入 Flowbite 的 Tailwind 插件plugin flowbite/plugin;plugin是 Tailwind CSS v4 的指令这里加载的是 flowbite 包中的 Tailwind 插件入口本仓库对应实现为 plugin.js类型声明见 plugin.d.ts。该插件基于tailwindcss/plugin的withOptions封装会向 Tailwind 注入工具提示tooltip、表单控件forms、数据表格datatables、图表charts与富文本wysiwyg等组件的基础样式。从 plugin.js 的实现可以看到插件默认开启charts、datatables、forms、tooltips、wysiwyg五个功能开关并支持按需关闭。4. 配置 Flowbite 的源码扫描路径source ../node_modules/flowbite;source同样是 Tailwind CSS v4 的指令它把node_modules/flowbite目录加入内容扫描范围确保 Tailwind 能识别并生成 Flowbite 组件模板中出现的工具类。缺少该指令时Flowbite 组件中的部分样式类可能不会被编译进最终 CSS。5. 在入口文件初始化交互 JavaScriptFlowbite 中依赖 JavaScript 的交互组件Navbar、Dropdown、Drawer、Modal 等通过data-*属性驱动需要在页面初始化时为其绑定事件监听。在 Qwik 项目中这一步放在src/root.tsx的根组件中完成import { component$, useVisibleTask$ } from builder.io/qwik; import { QwikCityProvider, RouterOutlet, ServiceWorkerRegister, } from builder.io/qwik-city; import { RouterHead } from ./components/router-head/router-head; import { isDev } from builder.io/qwik; // 引入 Flowbite 模块 import { initFlowbite } from flowbite; import ./global.css; export default component$(() { /** * QwikCity 站点的根组件总是以 QwikCityProvider 开头 * 紧接着是文档的 head 与 body。 * * 不要移除 head 与 body 元素。 */ // 在可见时初始化 data 属性的事件监听 useVisibleTask$(() { initFlowbite(); }); return ( QwikCityProvider head meta charsetutf-8 / {!isDev ( link relmanifest href{${import.meta.env.BASE_URL}manifest.json} / )} RouterHead / /head body langen RouterOutlet / {!isDev ServiceWorkerRegister /} /body /QwikCityProvider ); });这里的关键点是使用 Qwik 的useVisibleTask$包裹initFlowbite()调用而不是在模块顶层直接执行。这样初始化代码只会在组件在浏览器中可见时运行符合 Qwik 的精确懒加载理念避免阻塞首屏渲染。理解 initFlowbite 的初始化机制initFlowbite是 Flowbite 暴露的统一初始化入口它的实现位于 src/components/index.ts本质上是一次性调用所有组件的初始化函数export function initFlowbite() { initAccordions(); initCollapses(); initCarousels(); initDismisses(); initDropdowns(); initModals(); initDrawers(); initTabs(); initTooltips(); initPopovers(); initDials(); initInputCounters(); initCopyClipboards(); initDatepickers(); }而在 src/index.ts 中非模块化的浏览器场景还会在load事件上自动绑定这些初始化函数同时 src/index.ts 将initFlowbite作为命名导出提供给 ESM 使用Qwik 项目里import { initFlowbite } from flowbite走的正是这一条路径。以 Modal 组件为例src/components/modal/index.ts 中的initModals会扫描页面中带data-modal-target、data-modal-toggle、data-modal-show、data-modal-hide属性的元素将它们与对应 id 的模态框 DOM 关联并绑定点击事件。这意味着只要在 Qwik 模板中按文档约定写好这些data-*属性初始化后组件即可正常工作。在 Qwik 视图文件中使用 UI 组件完成上述配置后就可以把 Flowbite 的组件模板直接复制到 Qwik 的视图文件.tsx中使用。以下给出三个典型示例。导航栏Navbar将 Flowbite 导航栏组件放入src/components/Navbar.jsxexport default header$(() { return ( nav classbg-white border-gray-200 dark:bg-gray-900 div classmax-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4 a hrefhttps://flowbite.com/ classflex items-center space-x-3 rtl:space-x-reverse img srchttps://flowbite.com/docs/images/logo.svg classh-8 altFlowbite Logo / span classself-center text-2xl font-semibold whitespace-nowrap dark:text-whiteFlowbite/span /a button>export default modal$(() { return ( div button>export default hero$(() { return ( section classbg-white dark:bg-gray-900 div classpy-8 px-4 mx-auto max-w-screen-xl text-center lg:py-16 lg:px-12 a href# classinline-flex justify-between items-center py-1 px-1 pr-4 mb-7 text-sm text-gray-600 bg-gray-100 rounded-full dark:bg-gray-800 dark:text-white hover:bg-gray-200 dark:hover:bg-gray-700 rolealert span classtext-xs bg-blue-600 rounded-full text-white px-4 py-1.5 mr-3New/span span classtext-sm font-mediumFlowbite is out! See whats new/span svg classml-2 w-5 h-5 fillcurrentColor viewBox0 0 20 20 xmlnshttp://www.w3.org/2000/svgpath fill-ruleevenodd dM7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z clip-ruleevenodd/path/svg /a h1 classmb-4 text-4xl font-extrabold tracking-tight leading-none text-gray-900 md:text-5xl lg:text-6xl dark:text-whiteWe invest in the worlds potential/h1 p classmb-8 text-lg font-normal text-gray-500 lg:text-xl sm:px-16 xl:px-48 dark:text-gray-400Here at Flowbite we focus on markets where technology, innovation, and capital can unlock long-term value and drive economic growth./p div classflex flex-col mb-8 lg:mb-16 space-y-4 sm:flex-row sm:justify-center sm:space-y-0 sm:space-x-4 a href# classinline-flex justify-center items-center py-3 px-5 text-base font-medium text-center text-white rounded-lg bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-900 Learn more svg classml-2 -mr-1 w-5 h-5 fillcurrentColor viewBox0 0 20 20 xmlnshttp://www.w3.org/2000/svgpath fill-ruleevenodd dM10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z clip-ruleevenodd/path/svg /a a href# classinline-flex justify-center items-center py-3 px-5 text-base font-medium text-center text-gray-900 rounded-lg border border-gray-300 hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 dark:text-white dark:border-gray-700 dark:hover:bg-gray-700 dark:focus:ring-gray-800 svg classmr-2 -ml-1 w-5 h-5 fillcurrentColor viewBox0 0 20 20 xmlnshttp://www.w3.org/2000/svgpath dM2 6a2 2 0 012-2h6a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM14.553 7.106A1 1 0 0014 8v4a1 1 0 00.553.894l2 1A1 1 0 0018 13V7a1 1 0 00-1.447-.894l-2 1z/path/svg Watch video /a /div div classpx-4 mx-auto text-center md:max-w-screen-md lg:max-w-screen-lg lg:px-36 span classfont-semibold text-gray-400 uppercaseFEATURED IN/span div classflex flex-wrap justify-center items-center mt-8 text-gray-500 sm:justify-between a href# classmr-5 mb-5 lg:mb-0 hover:text-gray-800 dark:hover:text-gray-400 svg classh-8 viewBox0 0 132 29 fillnone xmlnshttp://www.w3.org/2000/svg path dM39.4555 5.17846C38.9976 3.47767 37.6566 2.13667 35.9558 1.67876C32.8486 0.828369 20.4198 0.828369 20.4198 0.828369C20.4198 0.828369 7.99099 0.828369 4.88379 1.64606C3.21571 2.10396 1.842 3.47767 1.38409 5.17846C0.566406 8.28567 0.566406 14.729 0.566406 14.729C0.566406 14.729 0.566406 21.2051 1.38409 24.2796C1.842 25.9804 3.183 27.3214 4.88379 27.7793C8.0237 28.6297 20.4198 28.6297 20.4198 28.6297C20.4198 28.6297 32.8486 28.6297 35.9558 27.812C37.6566 27.3541 38.9976 26.0131 39.4555 24.3123C40.2732 21.2051 40.2732 14.7618 40.2732 14.7618C40.3059 8.28567 39.4555 5.17846Z fillcurrentColor/ path dM16.4609 8.77612V20.6816L26.7966 14.7289L16.4609 8.77612Z fillwhite/ path dM64.272 25.0647C63.487 24.5413 62.931 23.7237 62.6039 22.5789C62.2768 21.4669 62.1133 19.9623 62.1133 18.1307V15.6122C62.1133 13.7479 62.3095 12.2434 62.6693 11.0986C63.0618 9.95386 63.6505 9.13618 64.4355 8.61286C65.2532 8.08954 66.2998 7.82788 67.6081 7.82788C68.8837 7.82788 69.9304 8.08954 70.7153 8.61286C71.5003 9.13618 72.0564 9.98657 72.4161 11.0986C72.7759 12.2107 72.9722 13.7152 72.9722 15.6122V18.1307C72.9722 19.995 72.8086 21.4669 72.4488 22.6116C72.0891 23.7237 71.533 24.5741 70.7481 25.0974C69.9631 25.6207 68.8837 25.8824 67.5427 25.8824C66.169 25.8496 65.057 25.588 64.272 25.0647ZM68.6875 22.3172C68.9164 21.7612 69.0146 20.8127 69.0146 19.5371V14.1077C69.0146 12.8648 68.9164 11.949 68.6875 11.3603C68.4585 10.7715 68.0988 10.5099 67.5427 10.5099C67.0194 10.5099 66.6269 10.8043 66.4307 11.3603C66.2017 11.949 66.1036 12.8648 66.1036 14.1077V19.5371C66.1036 20.8127 66.2017 21.7612 66.4307 22.3172C66.6269 22.8733 67.0194 23.1676 67.5754 23.1676C68.0987 23.1676 68.4585 22.906 68.6875 22.3172Z fillcurrentColor/ path dM124.649 18.1634V19.0465C124.649 20.1586 124.682 21.009 124.748 21.565C124.813 22.121 124.944 22.5462 125.173 22.7752C125.369 23.0368 125.696 23.1677 126.154 23.1677C126.743 23.1677 127.135 22.9387 127.364 22.4808C127.593 22.0229 127.691 21.2706 127.724 20.1913L131.093 20.3875C131.125 20.5511 131.125 20.7473 131.125 21.009C131.125 22.6117 130.7 23.8218 129.817 24.6068C128.934 25.3918 127.691 25.7843 126.089 25.7843C124.159 25.7843 122.818 25.1628 122.033 23.9527C121.248 22.7425 120.855 20.8782 120.855 18.327V15.2852C120.855 12.6686 121.248 10.7715 122.066 9.56136C122.883 8.35119 124.257 7.76245 126.187 7.76245C127.528 7.76245 128.574 8.02411 129.294 8.51472C130.013 9.00534 130.504 9.79032 130.798 10.8042C131.093 11.8509 131.223 13.29 131.223 15.1216V18.098H124.649V18.1634ZM125.14 10.837C124.944 11.0986 124.813 11.4911 124.748 12.0471C124.682 12.6032 124.649 13.4536 124.649 14.5983V15.8412H127.528V14.5983C127.528 13.4863 127.495 12.6359 127.43 12.0471C127.364 11.4584 127.201 11.0659 127.004 10.837C126.808 10.608 126.481 10.4772 126.089 10.4772C125.631 10.4445 125.336 10.5753 125.14 10.837Z fillcurrentColor/ path dM54.7216 17.8362L50.2734 1.71143H54.1656L55.7356 9.0052C56.1281 10.8041 56.4224 12.3414 56.6187 13.617H56.7168C56.8476 12.7011 57.142 11.1966 57.5999 9.0379L59.2353 1.71143H63.1274L58.6138 17.8362V25.5552H54.7543V17.8362H54.7216Z fillcurrentColor/ path dM85.6299 8.15479V25.5878H82.5554L82.2283 23.4619H82.1302C81.3125 25.0645 80.0369 25.8822 78.3688 25.8822C77.2241 25.8822 76.3737 25.4897 75.8177 24.7375C75.2617 23.9852 75 22.8077 75 21.1723V8.15479H78.9249V20.9434C78.9249 21.7284 79.023 22.2844 79.1865 22.6115C79.3501 22.9385 79.6444 23.1021 80.0369 23.1021C80.364 23.1021 80.6911 23.004 81.0181 22.775C81.3452 22.5788 81.5742 22.3171 81.705 21.99V8.15479H85.6299Z fillcurrentColor/ path dM105.747 8.15479V25.5878H102.673L102.346 23.4619H102.247C101.43 25.0645 100.154 25.8822 98.4861 25.8822C97.3413 25.8822 96.4909 25.4897 95.9349 24.7375C95.3788 23.9852 95.1172 22.8077 95.1172 21.1723V8.15479H99.0421V20.9434C99.0421 21.7284 99.1402 22.2844 99.3038 22.6115C99.4673 22.9385 99.7617 23.1021 100.154 23.1021C100.481 23.1021 100.808 23.004 101.135 22.775C101.462 22.5788 101.691 22.3171 101.822 21.99V8.15479H105.747Z fillcurrentColor/ path dM96.2907 4.88405H92.3986V25.5552H88.5718V4.88405H84.6797V1.71143H96.2907V4.88405Z fillcurrentColor/ path dM118.731 10.935C118.502 9.82293 118.11 9.03795 117.587 8.54734C117.063 8.05672 116.311 7.79506 115.395 7.79506C114.676 7.79506 113.989 7.99131 113.367 8.41651C112.746 8.809 112.255 9.36502 111.928 10.0192H111.896V0.828369H108.102V25.5552H111.34L111.732 23.9199H111.83C112.125 24.5086 112.582 24.9665 113.204 25.3263C113.825 25.6533 114.479 25.8496 115.232 25.8496C116.573 25.8496 117.521 25.2281 118.143 24.018C118.764 22.8078 119.091 20.8781 119.091 18.2942V15.5467C119.059 13.5516 118.96 12.0143 118.731 10.935ZM115.134 18.0325C115.134 19.3081 115.068 20.2893 114.97 21.0089C114.872 21.7285 114.676 22.2518 114.447 22.5461C114.185 22.8405 113.858 23.004 113.466 23.004C113.138 23.004 112.844 22.9386 112.582 22.7751C112.321 22.6116 112.092 22.3826 111.928 22.0882V12.2106C112.059 11.7527 112.288 11.3602 112.615 11.0331C112.942 10.7387 113.302 10.5752 113.662 10.5752C114.054 10.5752 114.381 10.7387 114.578 11.0331C114.807 11.3602 114.937 11.8835 115.036 12.6031C115.134 13.3553 115.166 14.402 115.166 15.743V18.0325H115.134Z fillcurrentColor/ /svg /a a href# classmr-5 mb-5 lg:mb-0 hover:text-gray-800 dark:hover:text-gray-400 svg classh-11 viewBox0 0 208 42 fillnone xmlnshttp://www.w3.org/2000/svg path dM42.7714 20.729C42.7714 31.9343 33.6867 41.019 22.4814 41.019C11.2747 41.019 2.19141 31.9343 2.19141 20.729C2.19141 9.52228 11.2754 0.438965 22.4814 0.438965C33.6867 0.438965 42.7714 9.52297 42.7714 20.729Z fillcurrentColor/ path dM25.1775 21.3312H20.1389V15.9959H25.1775C25.5278 15.9959 25.8747 16.0649 26.1983 16.1989C26.522 16.333 26.8161 16.5295 27.0638 16.7772C27.3115 17.0249 27.508 17.319 27.6421 17.6427C27.7761 17.9663 27.8451 18.3132 27.8451 18.6635C27.8451 19.0139 27.7761 19.3608 27.6421 19.6844C27.508 20.0081 27.3115 20.3021 27.0638 20.5499C26.8161 20.7976 26.522 20.9941 26.1983 21.1281C25.8747 21.2622 25.5278 21.3312 25.1775 21.3312ZM25.1775 12.439H16.582V30.2234H20.1389V24.8881H25.1775C28.6151 24.8881 31.402 22.1012 31.402 18.6635C31.402 15.2258 28.6151 12.439 25.1775 12.439Z fillwhite/ path dM74.9361 17.4611C74.9361 16.1521 73.9305 15.3588 72.6239 15.3588H69.1216V19.5389H72.6248C73.9313 19.5389 74.9369 18.7457 74.9369 17.4611H74.9361ZM65.8047 28.2977V12.439H73.0901C76.4778 12.439 78.3213 14.7283 78.3213 17.4611C78.3213 20.1702 76.4542 22.4588 73.0901 22.4588H69.1216V28.2977H65.8055H65.8047ZM80.3406 28.2977V16.7362H83.3044V18.2543C84.122 17.2731 85.501 16.4563 86.9027 16.4563V19.3518C86.6912 19.3054 86.4349 19.2826 86.0851 19.2826C85.1039 19.2826 83.7949 19.8424 83.3044 20.5681V28.2977H80.3397H80.3406ZM96.8802 22.3652C96.8802 20.6136 95.8503 19.0955 93.9823 19.0955C92.1364 19.0955 91.1105 20.6136 91.1105 22.366C91.1105 24.1404 92.1364 25.6585 93.9823 25.6585C95.8503 25.6585 96.8794 24.1404 96.8794 22.3652H96.8802ZM88.0263 22.3652C88.0263 19.1663 90.2684 16.4563 93.9823 16.4563C97.7198 16.4563 99.962 19.1655 99.962 22.3652C99.962 25.5649 97.7198 28.2977 93.9823 28.2977C90.2684 28.2977 88.0263 25.5649 88.0263 22.3652ZM109.943 24.3739V20.3801C109.452 19.6316 108.378 19.0955 107.396 19.0955C105.693 19.0955 104.524 20.4265 104.524 22.366C104.524 24.3267 105.693 25.6585 107.396 25.6585C108.378 25.6585 109.452 25.1215 109.943 24.3731V24.3739ZM109.943 28.2977V26.5697C109.054 27.6899 107.841 28.2977 106.462 28.2977C103.637 28.2977 101.465 26.1499 101.465 22.3652C101.465 18.6993 103.59 16.4563 106.462 16.4563C107.793 16.4563 109.054 17.0177 109.943 18.1843V12.439H112.932V28.2977H109.943ZM123.497 28.2977V26.5925C122.727 27.4337 121.372 28.2977 119.526 28.2977C117.052 28.2977 115.884 26.9431 115.884 24.7473V16.7362H118.849V23.5798C118.849 25.1451 119.666 25.6585 120.927 25.6585C122.071 25.6585 122.983 25.028 123.497 24.3731V16.7362H126.463V28.2977H123.497ZM128.69 22.3652C128.69 18.9092 131.212 16.4563 134.67 16.4563C136.982 16.4563 138.383 17.4611 139.131 18.4886L137.191 20.3093C136.655 19.5153 135.838 19.0955 134.81 19.0955C133.011 19.0955 131.751 20.4037 131.751 22.366C131.751 24.3267 133.011 25.6585 134.81 25.6585C135.838 25.6585 136.655 25.1915 137.191 24.4203L139.131 26.2426C138.383 27.2702 136.982 28.2977 134.67 28.2977C131.212 28.2977 128.69 25.8456 128.69 22.3652ZM141.681 25.1915V19.329H139.813V16.7362H141.681V13.6528H144.648V16.7362H146.935V19.329H144.648V24.3975C144.648 25.1215 145.02 25.6585 145.675 25.6585C146.118 25.6585 146.541 25.495 146.702 25.3087L147.334 27.5728C146.891 27.9714 146.096 28.2977 144.857 28.2977C142.779 28.2977 141.681 27.2238 141.681 25.1915ZM165.935 28.2977V21.454H158.577V28.2977H155.263V12.439H158.577V18.5577H165.935V12.4398H169.275V28.2977H165.935ZM179.889 28.2977V26.5925C179.119 27.4337 177.764 28.2977 175.919 28.2977C173.443 28.2977 172.276 26.9431 172.276 24.7473V16.7362H175.241V23.5798C175.241 25.1451 176.058 25.6585 177.32 25.6585C178.464 25.6585 179.376 25.028 179.889 24.3731V16.7362H182.856V28.2977H179.889ZM193.417 28.2977V21.1986C193.417 19.6333 192.602 19.0963 191.339 19.0963C190.172 19.0963 189.285 19.7504 188.77 20.4045V28.2985H185.806V16.7362H188.77V18.1843C189.495 17.3439 190.896 16.4563 192.718 16.4563C195.217 16.4563 196.408 17.8573 196.408 20.0523V28.2977H193.418H193.417ZM199.942 25.1915V19.329H198.076V16.7362H199.943V13.6528H202.91V16.7362H205.198V19.329H202.91V24.3975C202.91 25.1215 203.282 25.6585 203.936 25.6585C204.365 25.6585 204.802 25.495 204.965 25.3087L205.595 27.5728C205.152 27.9714 204.356 28.2977 203.119 28.2977C201.04 28.2977 199.943 27.2238 199.943 25.1915 fillcurrentColor/ /svg /a a href# classmr-5 mb-5 lg:mb-0 hover:text-gray-800 dark:hover:text-gray-400 svg classh-11 viewBox0 0 120 41 fillnone xmlnshttp://www.w3.org/2000/svg path dM20.058 40.5994C31.0322 40.5994 39.9286 31.7031 39.9286 20.7289C39.9286 9.75473 31.0322 0.858398 20.058 0.858398C9.08385 0.858398 0.1875 9.75473 0.1875 20.7289C0.1875 31.7031 9.08385 40.5994 20.058 40.5994Z fillcurrentColor/ path dM33.3139 20.729C33.3139 19.1166 32.0101 17.8362 30.4211 17.8362C29.6388 17.8362 28.9272 18.1442 28.4056 18.6424C26.414 17.2196 23.687 16.2949 20.6518 16.1765L21.9796 9.96387L26.2951 10.8885C26.3429 11.9793 27.2437 12.8567 28.3584 12.8567C29.4965 12.8567 30.4211 11.9321 30.4211 10.7935C30.4211 9.65536 29.4965 8.73071 28.3584 8.73071C27.5522 8.73071 26.8406 9.20497 26.5086 9.89271L21.6954 8.87303C21.553 8.84917 21.4107 8.87303 21.3157 8.94419C21.1972 9.01535 21.1261 9.13381 21.1026 9.27613L19.6321 16.1999C16.5497 16.2949 13.7753 17.2196 11.7599 18.6662C11.2171 18.1478 10.495 17.8589 9.74439 17.86C8.13201 17.86 6.85156 19.1639 6.85156 20.7529C6.85156 21.9383 7.56272 22.9341 8.55897 23.3849C8.51123 23.6691 8.48781 23.9538 8.48781 24.2623C8.48781 28.7197 13.6807 32.348 20.083 32.348C26.4852 32.348 31.6781 28.7436 31.6781 24.2623C31.6781 23.9776 31.6543 23.6691 31.607 23.3849C32.6028 22.9341 33.3139 21.9144 33.3139 20.729ZM13.4434 22.7918C13.4434 21.6536 14.368 20.729 15.5066 20.729C16.6447 20.729 17.5694 21.6536 17.5694 22.7918C17.5694 23.9299 16.6447 24.855 15.5066 24.855C14.368 24.8784 13.4434 23.9299 13.4434 22.7918ZM24.9913 28.2694C23.5685 29.6921 20.8653 29.7872 20.083 29.7872C19.2768 29.7872 16.5736 29.6683 15.1742 28.2694C14.9612 28.0559 14.9612 27.7239 15.1742 27.5105C15.3877 27.2974 15.7196 27.2974 15.9331 27.5105C16.8343 28.4117 18.7314 28.7197 20.083 28.7197C21.4346 28.7197 23.355 28.4117 24.2324 27.5105C24.4459 27.2974 24.7778 27.2974 24.9913 27.5105C25.1809 27.7239 25.1809 28.0559 24.9913 28.2694ZM24.6116 24.8784C23.4735 24.8784 22.5488 23.9538 22.5488 22.8156C22.5488 21.6775 23.4735 20.7529 24.6116 20.7529C25.7502 20.7529 26.6748 21.6775 26.6748 22.8156C26.6748 23.9299 25.7502 24.8784 24.6116 24.8784Z fillwhite/ path dM108.412 16.6268C109.8 16.6268 110.926 15.5014 110.926 14.1132C110.926 12.725 109.8 11.5996 108.412 11.5996C107.024 11.5996 105.898 12.725 105.898 14.1132C105.898 15.5014 107.024 16.6268 108.412 16.6268Z fillcurrentColor/ path dM72.5114 24.8309C73.7446 24.8309 74.4557 23.9063 74.4084 23.0051C74.385 22.5308 74.3373 22.2223 74.29 21.9854C73.5311 18.7133 70.8756 16.2943 67.7216 16.2943C63.9753 16.2943 60.9401 19.6853 60.9401 23.8586C60.9401 28.0318 63.9753 31.4228 67.7216 31.4228C70.0694 31.4228 71.753 30.5693 72.9622 29.2177C73.5549 28.5538 73.4365 27.5341 72.7249 27.036C72.1322 26.6329 71.3972 26.7752 70.8517 27.2256C70.3302 27.6765 69.3344 28.5772 67.7216 28.5772C65.825 28.5772 64.2126 26.941 63.8568 24.7832H72.5114V24.8309ZM67.6981 19.1637C69.4051 19.1637 70.8756 20.4915 71.421 22.3173H63.9752C64.5207 20.468 65.9907 19.1637 67.6981 19.1637ZM61.0824 17.7883C61.0824 17.0771 60.5609 16.5078 59.897 16.3894C57.8338 16.0813 55.8895 16.8397 54.7752 18.2391V18.049C54.7752 17.1717 54.0636 16.6267 53.3525 16.6267C52.5697 16.6267 51.9297 17.2667 51.9297 18.049V29.6681C51.9297 30.427 52.4985 31.0908 53.2574 31.1381C54.0875 31.1854 54.7752 30.5454 54.7752 29.7154V23.7162C54.7752 21.0608 56.7668 18.8791 59.5173 19.1876H59.802C60.5131 19.1399 61.0824 18.5233 61.0824 17.7883ZM109.834 19.306C109.834 18.5233 109.194 17.8833 108.412 17.8833C107.629 17.8833 106.989 18.5233 106.989 19.306V29.7154C106.989 30.4981 107.629 31.1381 108.412 31.1381C109.194 31.1381 109.834 30.4981 109.834 29.7154V19.306ZM88.6829 11.4338C88.6829 10.651 88.0429 10.011 87.2602 10.011C86.4779 10.011 85.8379 10.651 85.8379 11.4338V17.7648C84.8655 16.7924 83.6562 16.3182 82.2096 16.3182C78.4632 16.3182 75.4281 19.7091 75.4281 23.8824C75.4281 28.0557 78.4632 31.4466 82.2096 31.4466C83.6562 31.4466 84.8893 30.9485 85.8613 29.9761C85.9797 30.6405 86.5729 31.1381 87.2602 31.1381C88.0429 31.1381 88.6829 30.4981 88.6829 29.7154V11.4338ZM82.2334 28.6245C80.0518 28.6245 78.2971 26.5145 78.2971 23.8824C78.2971 21.2742 80.0518 19.1399 82.2334 19.1399C84.4151 19.1399 86.1698 21.2504 86.1698 23.8824C86.1698 26.5145 84.3912 28.6245 82.2334 28.6245ZM103.527 11.4338C103.527 10.651 102.887 10.011 102.104 10.011C101.322 10.011 100.681 10.651 100.681 11.4338V17.7648C99.7093 16.7924 98.5 16.3182 97.0534 16.3182C93.307 16.3182 90.2719 19.7091 90.2719 23.8824C90.2719 28.0557 93.307 31.4466 97.0534 31.4466C98.5 31.4466 99.7327 30.9485 100.705 29.9761C100.824 30.6405 101.416 31.1381 102.104 31.1381C102.887 31.1381 103.527 30.4981 103.527 29.7154V11.4338ZM97.0534 28.6245C94.8717 28.6245 93.1174 26.5145 93.1174 23.8824C93.1174 21.2742 94.8717 19.1399 97.0534 19.1399C99.235 19.1399 100.99 21.2504 100.99 23.8824C100.99 26.5145 99.235 28.6245 97.0534 28.6245ZM117.042 29.7392V19.1637H118.299C118.963 19.1637 119.556 18.6656 119.603 17.9779C119.651 17.2428 119.058 16.6267 118.347 16.6267H117.042V14.6347C117.042 13.8758 116.474 13.2119 115.715 13.1646C114.885 13.1173 114.197 13.7573 114.197 14.5874V16.6501H113.011C112.348 16.6501 111.755 17.1483 111.708 17.836C111.66 18.571 112.253 19.1876 112.964 19.1876H114.173V29.7631C114.173 30.5454 114.814 31.1854 115.596 31.1854C116.426 31.1381 117.042 30.5216 117.042 29.7392Z fillcurrentColor/ /svg /a /div /div /div /section ); });提示上述组件示例直接采用了 Flowbite 官方 Qwik 指南中的写法。在实际的 Qwik 项目中组件通常使用component$而非header$/modal$/hero$这类占位名称复制时可根据项目约定替换为component$并调整 SVG 图标为 Qwik 支持的写法功能与视觉效果保持一致。深入理解三个配置指令的作用Qwik 指南中 Flowbite 的 CSS 配置使用了 Tailwind CSS v4 的三条新指令梳理如下指令作用对应仓库文件import flowbite/src/themes/default导入 Flowbite 的主题 CSS 变量字体、圆角、品牌色、背景色等src/themes/default.cssplugin flowbite/plugin注册 Tailwind 插件注入 tooltip、forms、datatables、charts、wysiwyg 组件样式plugin.jssource ../node_modules/flowbite把 flowbite 包加入 Tailwind 的内容扫描目录确保组件类名被编译—安装后位于node_modules/flowbiteFlowbite 插件本身支持按需裁剪plugin.js 中charts、datatables、forms、tooltips、wysiwyg五个选项默认全部为true若项目中用不到图表或富文本可以在自定义 Tailwind 配置中关闭对应选项以减少最终 CSS 体积。仓库自身的 tailwind.config.js 展示了如何在配置文件中传入这些选项。Flowbite 的 Qwik 生态资源除手动配置外社区还提供了两类现成资源Qwik starter 项目Flowbite 社区维护的 Qwik 启动模板其中已经预装好 Tailwind CSS 与 Flowbite并配置展示了部分 UI 组件可以直接作为新项目的起点Flowbite Qwik 组件库社区贡献者维护的基于 Qwik 与 Tailwind CSS 构建的 Flowbite 组件集合与本文的复制模板 初始化思路不同它把组件封装成了可直接导入的 Qwik 组件。常见问题排查组件样式未生效检查src/global.css是否包含全部三条 Tailwind v4 指令主题导入、插件注册、source扫描路径并确认执行npm run qwik add tailwind后已重启开发服务器。交互无响应确认在src/root.tsx中通过useVisibleTask$调用了initFlowbite()且模板中的data-*属性与组件 id 一一对应。以 Modal 为例src/components/modal/index.ts 在初始化时会校验data-modal-target指向的 id 是否存在若不存在会在控制台输出错误提示。暗色模式异常Flowbite 组件大量使用dark:前缀工具类需要在根元素如html上管理classdark的切换配合 src/themes/default.css 中的暗色变量使用。至此Flowbite 已经完整接入你的 Qwik 项目。接下来可以直接从 content/components 目录下的各组件文档如 navbar.md、modal.md、dropdowns.md中复制任意组件模板结合 Tailwind CSS 快速构建网站界面。赞分享UI组件前端【免费下载链接】flowbiteOpen-source UI component library and front-end development framework based on Tailwind CSS项目地址https://gitcode.com/gh_mirrors/fl/flowbite点击查看免费下载相关推荐Flowbite-VueVue.js上的Tailwind CSS组件库Flowbite VueVue.js上的Tailwind CSS组件库 项目介绍 Flowbite Vue 是一个基于Vue.js与Tailwind CSS的在 Meteor 3 项目中集成 Flowbite 与 Tailwind CSS 的完整指南在 Meteor 3 项目中集成 Flowbite 与 Tailwind CSS 的完整指南 Flowbite 是基于 Tailwind CSS 的实用优先 U后端前端开发工具移动开发Plate UI 的 Shadcn Proofing让 registry 组件保持可识别的开源代码形态Plate UI 的 Shadcn Proofing让 registry 组件保持可识别的开源代码形态 Plate 是一个基于 Slate 的富文本编辑器其UI组件前端上一篇Warp 终端从一键安装到 Agent 日常使用三平台部署、首启配置与报错自救指南下一篇开源项目教程骨骼追踪算法创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

关于恒美微站

恒美微站专注于为个体商户、工作室提供极简自助建站服务,让每个人都能轻松拥有专业网站。

快速链接

  • 关于我们
  • 建站服务
  • 主题模板
  • 案例展示
  • 资讯中心

服务项目

  • 可视化建站
  • 拖拽编辑
  • 主题定制
  • SEO 优化
  • 网站托管

联系方式

  • 📍 地址:北京市朝阳区建国路 88 号
  • 📞 电话:400-888-8888
  • ✉️ 邮箱:info@hmyw.cn
  • 🕐 时间:周一至周日 9:00-18:00

© 2024 恒美微站 hmyw.cn 版权所有 | 京 ICP 备 12345678 号