React Awesome
tip
- 专门功能选择专业组件 - Headless 配合 UI 组件达到更为理想的结果
- react-table
- react-hook-form
- react-popper
- 选择样式与组件独立的 UI 库
- bluprintjs
- 避免选择绑定了功能的组件
- antd
- 选择组件库的考虑维度
- 前端/后端 - C 端/B 端
- 信息密度
- 支持平台 - Web/移动端
- 使用支持 ESM 的库
常用依赖
# 状态管理 - jotai
npm add zustand immer use-immer
# UI
npm add classnames
npm add react-icons
npx tailwindcss init -p # tailwindcss
# API
npm add react-query # generic
npm add urql # gql
# 组件
# blueprintjs - v4 发布后不需要 x2 包
npm add @blueprintjs/core @blueprintjs/select @blueprintjs/datetime @blueprintjs/popover2
# 如果需要展示大量数据
npm add @blueprintjs/table
# 移动端样式组件
npm add tailwind-mobile
# 交互
npm add react-virtual # 虚拟滚动
npm add @headlessui/react # 纯功能组件
# 路由
npm add react-router-dom
# 数据
npm add react-hook-form
npm add react-table
# 工具
npm add date-fns lodash-es react-fast-compare
通用 UI 组件
- tailwindcss+daisyui
- 如果开发人员能力足够
- 如果想要完全控制样式
- 如果想要做自己的产品
- rewindui/rewindui
- Tailwind
- palantir/blueprint
- CSS 样式定义 + React 封装组件
- 很多组件都可以直接 HTML + CSS 类定义达到效果 - 非常清晰明了
- npm 包含源码 - IDE 能直接看到组件源码
@blueprintjs/select
- 多功能 select 组件
- 不控制样式,以逻辑为主
- radix-ui/primitives
- by WorkOS
- Slot 组件 - asChild 时使用 child 组件进行渲染,传递所有 props
- nextui-org/nextui
- 与 vercel 无关
- rsuite/rsuite
- 各方面神似 AntD - 但比 AntD 轻的多
- ant-design/ant-design
- 1.3MB
- @ant-design/icons
- dayjs
- rx-
- @antdesign/cssinjs
- mui-org/material-ui - Material Design 风格
- 如果选择 MD 风格则非常匹配
- 完成程度和成熟度远远高于 antd
- 组件非常多,支持高度样式自定义
- geist-org/geist-ui
- 类似 vercel 的设计风格
- arco-design/arco-design
- 字节跳动
- DouyinFE/semi-design
- 抖音前端
- 较多的 AntD 内容
- 公司相关设计风格组件库
- carbon-design-system/carbon
- IBM
- SAP/openui5
- microsoft/fluentui - 微软风格
- pinterest/gestalt - pinterest
- JetBrains/ring-ui - Jetbrains 产品系列
- 例如 Youtrack
- 查询用的组件功能非常强大 - Query Assist
- Youtrack 的 Issuse 搜索过滤
- segmentio/evergreen - Segment
- elastic/eui
- 组件丰富
- 集成了 ACE 编辑器、Markdown 编辑器、DND
- Search、Suggest、Expression 等查询组件功能强大
- carbon-design-system/carbon
- 其他风格
- cloudscape-design/components
- design system for the cloud
- mantinedev/mantine
- emotion
- CSS in JS
npm install @mantine/core @mantine/hooks @mantine/form @mantine/dates dayjs @mantine/notifications @mantine/prism @mantine/tiptap @tabler/icons-react @tiptap/react @tiptap/extension-link @tiptap/starter-kit @mantine/dropzone @mantine/carousel embla-carousel-react @mantine/spotlight @mantine/modals @mantine/nprogress @emotion/react
- core
- @floating-ui
- @radix-ui
- 524.6kB
- grommet/grommet
- primefaces/primereact
- DevExpress/devextreme-reactive
- 功能强大的 Scheduler
- uiwjs/uiw
- 国产
- 包含一些特殊组件 - PIN 码、评分、日历
- markdown 编辑器、高德地图、百度地图
- uiwjs/province-city-china - 省市区数据
- cloudscape-design/components
- 不再维护/不活跃
- ebs-integrator/ebs-design
- supabase/ui
- rebassjs/rebass
- 基于 theme-ui 和 styled-system 的基础组件
- 很多样式都通过 props 控制
- 如果喜欢这样的还不如选择 tailwindcss 更加规范实用
移动端 UI 组件
特殊 UI 组件
- tamagui/tamagui
- tremorlabs/tremor
- Apache-2.0
- build dashboards
- thebuilder/react-intersection-observer
- gabrielbull/react-desktop
- 模仿 macOS High Sierra 和 Windows 10 的组件
- reakit/reakit - 专注于 accessible 的组件
- ARIA
- 在国内一般不关心 accessible
- table-library/react-table-library
- 带 UI
- react-icons/react-icons
- react-icons.github.io 包含了大量可用 Icon
- 来自 tailwincss 的 heroicons 崇尚直接 copy svg 使用
- 简单方便
- @tabler/icons
- https://github.com/tabler/tabler-icons
- 4500, MIT
- https://github.com/tabler/tabler-icons
- popperjs/react-popper
- 显示弹出气泡
- signavio/react-mentions
- 支持
@username
- 支持
- jedwatson/react-select
- 功能完善的 select 组件
- 通过 emotion 控制样式 - 如果没有使用 emotion 建议避免使用
- twobin/react-lazyload
- 懒加载 UI 组件
- asabaylus/react-command-palette
- gilbarbara/react-joyride
- kanban
- notion
- https://github.com/bvaughn/planner
- ReactTooltip/react-tooltip
- floatingui
- reaviz
- https://github.com/wojtekmaj
- react-calendar, react-clock, react-pdf
- calendar
- fullcalendar/fullcalendar
- 功能最为强大的日历组件 - 支持 React 绑定
- wojtekmaj/react-calendar
- fullcalendar/fullcalendar
- flow/diagram
- dnd
- react-dnd/react-dnd
- atlassian/react-beautiful-dnd - 拖放
- bokuweb/react-rnd - Resize & Drag
- 实现类似窗口的效果
- react-draggable+bokuweb/re-resizable
- react-grid-layout/react-draggable
- 非常简单的拖动组件
- 传递 style, className, onMouseDown, onMouseUp, onTouchStart, onTouchEnd 给 child 实现功能
- style: transform: translate(538.5px, 22px);
- className: react-draggable react-draggable-dragging react-draggable-dragged
- child 需要能 ref
- 组件
- Draggable - 包含基础状态,可受控的拖拽组件
- DraggableCore - 无状态功能组件
- Query Builder
- react-grid-layout/react-resizable
- 简单的 resize 组件
- 组件
- ResizableBox - 维护 div 状态实现简单 resize -
<div {...props} />
- Resizable - 无状态基础功能组件
- ResizableBox - 维护 div 状态实现简单 resize -
- SortableJS/Sortable
- react-dropzone/react-dropzone
- layout
- react-grid-layout/react-grid-layout
- 动态网格布局组件
- react-draggable+react-grid-layout/react-resizable
- nomcopter/react-mosaic
- tiling window manager
- zzarcon/react-cristal
- simple window manager
- https://dev.to/jbdemonte/create-a-window-manager-with-react-3mak
- Create a window manager with React
- react-div-100vh
- 移动端屏高问题
- react-grid-layout/react-grid-layout
- carousel/image zoom/view
- malaman/react-image-zoom
- 放大一块区域
- rpearce/react-medium-image-zoom
- 类似 medium 的点击图片放大
- xiaolin/react-image-gallery
- 图片浏览
- guonanci/react-images-viewer
- 55kB
- nolimits4web/swiper
- express-labs/pure-react-carousel
- leandrowd/react-responsive-carousel
- ~30kB
- react-easy-swipe +5kB
- akiran/react-slick
- https://alvarotrigo.com/blog/react-carousels/
- malaman/react-image-zoom
- image editor/crop/rotate/scale/processing
- DominicTobias/react-image-crop
- ISC, TS
- 图片裁剪
- ValentinH/react-easy-crop
- MIT, TS
- 图片裁剪
- scaleflex/filerobot-image-editor
- MIT, JS
- 基于 react-konva
- 功能非常高级
- swimmingkiim/react-image-editor
- React + Konva / image editor / like Figma or Canva
- nhn/tui.image-editor
- ⚠️ 不维护
- 注意会收集统计 usageStatistics
- advanced-cropper/react-advanced-cropper
- evanw/glfx.js
- ⚠️ 不维护
- Demo https://evanw.github.io/glfx.js/demo/
- davidsonfellipe/lena.js
- filter
- DominicTobias/react-image-crop
- timeline
- gannt
- Block Editor/Page Builder
- 动画
- modal
- eBay/nice-modal-react
- react-responsive-modal
- link preview
- autocomplete
- input
- react-textarea-autosize
- table/Spreadsheet/Excel/Data Grid
- react-data-grid
- MIT, TS
- 41kB, 14kB
- react-spreadsheet
- MIT, TS
- 支持 formula
- @handsontable/formulajs, jstat, @reduxjs/toolkit, @reduxjs/toolkit, es-abstract, hot-formula-parser
- react-spreadsheet-grid
- MIT, JS
- 66kB, 17kB
- @silevis/reactgrid
- MIT, TS
- 250kB, 68kB
- react-datasheet
- ⚠️ 不再维护
- react-data-grid
- i18n - Unicode Language and Locale Identifiers
- react-i18next
- react-intl
- lingui
- rosetta
- next-intl
- formatjs
- hooks/utils
- for fun
- GEO/Map
- visgl/react-map-gl
- react for mapbox-gl, maplibre-gl
- maplibre/maplibre-gl-js
- BSD-3, Typescript
- mapbox-gl-js v1 fork
- mapbox/mapbox-gl-js
- 2020-12 修改为非开源协议
- v2 需要 token
- math
- Turfjs/turf
- MIT, TS
- geospatial engine
- Turfjs/turf
- tiles
- visgl/react-map-gl
编辑器
- Markdown
- margox/braft-editor
- margox/braft-extensions - 扩展包
路由
- ReactTraining/react-router
- React 16.8 hook 之前已经存在
- v6 基于 hook 重写,替代 reach-router
- v5 添加 hook 支持,Swith 和 Route 组件可选
- 支持 MemoryRouter,支持 React Native
- 核心组件
- Router - 提供 history 管理和上下文 - history 实现在 history 包
- BrowserRouter 基于当前 URL
- HashRouter 基于 URL 但使用
#/url
模式 - StaticRouter - 静态地址,用于 SSR
- NativeRouter - 支持 react-native
- 核心状态 location - 从 history 监听变化
- 提供 history 上下文 - useHistory
- 提供 Route 上下文 - useLocation、useParams
- Route - 匹配后渲染
- Switch - 只会渲染一个匹配的 Route
- Link, NavLink, Redirect - 导航,修改 url
- Prompt - 用于阻塞 history 发生变化
- Router - 提供 history 管理和上下文 - history 实现在 history 包
- useRoutes/react-router-config
- 提供了统一配置 route 的逻辑 - 很简单,可以作为参考
- matchRoutes - 匹配嵌套路由 - 返回匹配的 tree 路由数组
- renderRoutes - 渲染嵌套路由 - 递归 Switch, 遍历 Route
- @tanstack/react-router
- 参考/基于 React Router v6
- 内置 async import - 异步加载 element
- 内置 async load - 异步加载 data/状态 - useMatch 返回
- query 参数匹配、状态管理
- declarative API
- molefrog/wouter
- 轻量实现 - 很实用 - 可以直接拷贝到项目修改使用
- 可以不需要 context
- 外部提供 location
- minimalist-friendly ~2.1KB routing for React and Preact
reach/router- React Router v6 后 reach router 不再需要
- React Router 作者在 hook 出现后进行的尝试
- 目前 hook 能力已经合并回 react router v5
- 不使用 Swith 和 Route 组件,而是直接在组件上添加 path 进行匹配
- 参考
- The Future of React Router and @reach/router - 2019
- @reach/router 是在 hook 出现后的新尝试
- 现在所有 hook 功能也合并到了 react-router v5
- The Future of React Router and @reach/router - 2019
功能组件
大多为 Headless
- TanStack
- react-table
- 实现各种 table 功能
- react-query
- 异步查询缓存更新
- ranger
- range and multi-range sliders
- location
- virtual
- react-charts
- react-table
- vercel/swr
- 类似于 react-query 但更适合 于前端定时刷新场景
- 支持 SSR
- gregberge/loadable-components
- 异步加载组件
- tailwindlabs/headlessui
- 功能性 headless 组件
- popover
- listbox/select
- combobox/autocomplete
- menu/dropdown
- switch/toggle
- disclosure
- dialog/modal
- radio group
- tabs
- transition
- nandorojo/dripsy
- its-danny/use-lilius
- date-fns
- DateInput
- downshift-js/downshift
- autocomplete, combobox, select dropdown
- useCombobox
- useMultipleSelection
- useSelect
- Toast
- react-hot-toast
- 12kB/4.7kB
- goober 2.5kB/1.3kB
- css-in-js alternative
- goober 2.5kB/1.3kB
- 12kB/4.7kB
- iamhosseindhv/notistack
- for Material UI
- react-toastify
- 需要 import css
- react-hot-toast
- devbookhq/splitter
- 切分面板