weui
A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.
Top Related Projects
京东风格的移动端 Vue 组件库,支持多端小程序(A Vue.js UI Toolkit for Mobile Web)
A lightweight, customizable Vue UI library for mobile web apps.
Essential UI blocks for building mobile web apps.
:large_orange_diamond: A fantastic mobile ui lib implement by Vue
Mobile UI elements for Vue.js
:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库
Quick Overview
WeUI is a set of mobile UI components for WeChat Web development, created by Tencent. It provides a consistent user interface design that aligns with WeChat's native look and feel, making it easier for developers to create web applications that seamlessly integrate with the WeChat ecosystem.
Pros
- Seamless integration with WeChat's design language
- Comprehensive set of UI components for mobile web development
- Lightweight and performance-optimized for mobile devices
- Well-documented with examples and guidelines
Cons
- Primarily focused on WeChat ecosystem, limiting its use in other contexts
- May require frequent updates to keep up with WeChat's evolving design
- Limited customization options compared to more general-purpose UI frameworks
- Relatively smaller community compared to mainstream UI libraries
Code Examples
- Creating a button:
<a href="javascript:;" class="weui-btn weui-btn_primary">Primary Button</a>
- Implementing a form input:
<div class="weui-cell">
<div class="weui-cell__hd"><label class="weui-label">Username</label></div>
<div class="weui-cell__bd">
<input class="weui-input" type="text" placeholder="Enter your username">
</div>
</div>
- Displaying a toast notification:
weui.toast('Operation Successful', {
duration: 3000,
className: 'custom-classname'
});
Getting Started
To use WeUI in your project, follow these steps:
- Include the WeUI CSS file in your HTML:
<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/2.4.4/weui.min.css">
- (Optional) Include the WeUI JS file for additional functionality:
<script type="text/javascript" src="https://res.wx.qq.com/open/libs/weuijs/1.2.1/weui.min.js"></script>
- Start using WeUI components in your HTML:
<div class="weui-btn-area">
<a class="weui-btn weui-btn_primary" href="javascript:" id="showToast">Show Toast</a>
</div>
- (Optional) Use WeUI JavaScript functions:
document.getElementById('showToast').addEventListener('click', function(){
weui.toast('Toast Content');
});
Competitor Comparisons
京东风格的移动端 Vue 组件库,支持多端小程序(A Vue.js UI Toolkit for Mobile Web)
Pros of NutUI
- Built with Vue 3, offering better performance and composition API support
- Wider range of components (70+) compared to WeUI
- Supports TypeScript out of the box
Cons of NutUI
- Less widespread adoption compared to WeUI
- May have a steeper learning curve for developers new to Vue 3
- Documentation might not be as comprehensive as WeUI's
Code Comparison
NutUI (Vue 3):
<template>
<nut-button type="primary" @click="handleClick">
Click me
</nut-button>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const handleClick = () => {
console.log('Button clicked')
}
return { handleClick }
}
}
</script>
WeUI (HTML/CSS):
<a href="javascript:;" class="weui-btn weui-btn_primary">
Click me
</a>
<script>
document.querySelector('.weui-btn').addEventListener('click', function() {
console.log('Button clicked')
})
</script>
The code comparison shows that NutUI leverages Vue 3's composition API and component-based structure, while WeUI relies on traditional HTML and JavaScript. NutUI's approach offers more flexibility and reusability, but WeUI's simplicity might be preferred for smaller projects or developers more comfortable with vanilla JavaScript.
A lightweight, customizable Vue UI library for mobile web apps.
Pros of Vant
- More comprehensive component library with 70+ UI components
- Better support for Vue 3 and TypeScript
- Extensive documentation and examples
Cons of Vant
- Larger bundle size due to more components
- Steeper learning curve for beginners
- Less focus on WeChat-specific design patterns
Code Comparison
WeUI (HTML-based):
<div class="weui-cell">
<div class="weui-cell__bd">
<p>Standard Cell</p>
</div>
<div class="weui-cell__ft">Content</div>
</div>
Vant (Vue-based):
<template>
<van-cell title="Standard Cell" value="Content" />
</template>
WeUI provides a more traditional HTML and CSS approach, while Vant offers a more component-based structure using Vue. Vant's approach results in cleaner, more concise code but requires familiarity with Vue.js.
Both libraries serve different purposes: WeUI focuses on WeChat-like UI components, while Vant offers a more general-purpose UI toolkit for mobile web applications. WeUI may be preferable for WeChat-specific projects, whereas Vant is more suitable for broader mobile web development, especially when using Vue.js.
Essential UI blocks for building mobile web apps.
Pros of ant-design-mobile
- More comprehensive component library with a wider range of UI elements
- Better documentation and examples, making it easier for developers to implement
- Regular updates and active community support
Cons of ant-design-mobile
- Larger file size and potentially slower performance due to its extensive feature set
- Steeper learning curve for developers new to the framework
- Less native-like appearance on iOS devices compared to WeUI
Code Comparison
WeUI (HTML structure):
<div class="weui-cell">
<div class="weui-cell__hd"><img src="icon.png" alt="" style="width:20px;margin-right:5px;display:block"></div>
<div class="weui-cell__bd">
<p>Standard List Item</p>
</div>
<div class="weui-cell__ft">Description</div>
</div>
ant-design-mobile (React component):
import { List } from 'antd-mobile';
const Item = List.Item;
<List>
<Item extra="Description" thumb="icon.png">Standard List Item</Item>
</List>
The code comparison shows that ant-design-mobile offers a more concise and React-friendly approach, while WeUI provides a more traditional HTML structure. This reflects the different design philosophies and target audiences of the two libraries.
:large_orange_diamond: A fantastic mobile ui lib implement by Vue
Pros of cube-ui
- More comprehensive component library with 40+ UI components
- Built-in support for Vue.js, making it easier to integrate into Vue projects
- Offers a CLI tool for quick project setup and customization
Cons of cube-ui
- Larger bundle size due to more components and features
- Steeper learning curve for developers new to Vue.js
- Less suitable for non-Vue projects or simple mobile web apps
Code Comparison
weui (HTML-based):
<a href="javascript:;" class="weui-btn weui-btn_primary">Primary Button</a>
cube-ui (Vue.js-based):
<template>
<cube-button :primary="true">Primary Button</cube-button>
</template>
Key Differences
- weui is a lightweight CSS framework, while cube-ui is a full-featured Vue.js component library
- weui focuses on providing a consistent WeChat-like UI, whereas cube-ui offers more customization options
- cube-ui includes advanced features like form validation and complex interactions, which are not present in weui
- weui is more suitable for simple mobile web apps, while cube-ui is better for complex Vue.js-based applications
Both libraries have their strengths, and the choice between them depends on the project requirements, development stack, and desired level of customization.
Mobile UI elements for Vue.js
Pros of mint-ui
- More comprehensive component library with a wider range of UI elements
- Built specifically for Vue.js, offering better integration and performance
- Provides both iOS and Material Design themes for cross-platform consistency
Cons of mint-ui
- Less frequently updated compared to weui
- Larger bundle size due to more components and features
- Steeper learning curve for developers new to Vue.js
Code Comparison
mint-ui (Vue.js component):
<template>
<mt-button type="primary" @click="handleClick">Primary Button</mt-button>
</template>
<script>
import { Button } from 'mint-ui'
export default {
components: { 'mt-button': Button }
}
</script>
weui (HTML/CSS):
<a href="javascript:;" class="weui-btn weui-btn_primary">Primary Button</a>
mint-ui offers a more component-based approach with Vue.js integration, while weui provides simpler HTML/CSS classes for styling. mint-ui requires additional setup but offers more flexibility and interactivity, whereas weui is easier to implement but less dynamic.
:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库
Pros of wux-weapp
- More comprehensive component library with a wider range of UI elements
- Better documentation and examples for each component
- Regular updates and active community support
Cons of wux-weapp
- Larger file size and potentially higher performance overhead
- Steeper learning curve due to more complex API and customization options
- Less official backing compared to WeUI (developed by Tencent)
Code Comparison
WeUI (basic button):
<button class="weui-btn weui-btn_primary">Primary Button</button>
wux-weapp (basic button):
<wux-button block type="positive">Positive Button</wux-button>
Both libraries provide similar basic functionality, but wux-weapp offers more customization options and a wider range of components. WeUI focuses on simplicity and adhering to WeChat's design guidelines, while wux-weapp provides a more feature-rich experience at the cost of increased complexity.
WeUI is ideal for developers looking for a straightforward, officially supported UI library that closely follows WeChat's design principles. wux-weapp is better suited for projects requiring more advanced components and customization options, albeit with a steeper learning curve.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
WeUI - tailor-made for WeChat web service
Introduction
WeUI is an WeChat-like UI framework officially designed by the WeChat Design Team, tailor-made for WeChat Web development, in order to improve and standardize the experience for WeChat users. Including components such as button
ãcell
ãdialog
ã progress
ã toast
ãarticle
ãactionsheet
ãicon
.
Documentations
- WeUI documentation Wiki
- WeUI design reference weui-design
Mobile demo
Legacy version 1.x: https://weui.io/1.x
Legacy version 0.4.x: https://weui.io/0.4.x
Development
License
The MIT License(http://opensource.org/licenses/MIT)
Please feel free to use and contribute to the development.
Contribution
If you have any ideas or suggestions to improve Wechat WeUI, welcome to submit an issue/pull request.
Top Related Projects
京东风格的移动端 Vue 组件库,支持多端小程序(A Vue.js UI Toolkit for Mobile Web)
A lightweight, customizable Vue UI library for mobile web apps.
Essential UI blocks for building mobile web apps.
:large_orange_diamond: A fantastic mobile ui lib implement by Vue
Mobile UI elements for Vue.js
:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot