Convert Figma logo to code with AI

NervJS logotaro-ui

一款基于 Taro 框架开发的多端 UI 组件库

4,517
756
4,517
543

Top Related Projects

Essential UI blocks for building mobile web apps.

轻量、可靠的小程序 UI 组件库

27,134

A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.

:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库

一套高质量的微信小程序 UI 组件库

💰 A mobile UI toolkit, based on Vue.js 2, designed for financial scenarios.

Quick Overview

Taro UI is a comprehensive UI component library for Taro, a cross-platform framework for building applications that can run on multiple platforms including WeChat Mini Program, H5, and React Native. It provides a set of high-quality components that are consistent across different platforms, helping developers create beautiful and responsive user interfaces efficiently.

Pros

  • Cross-platform compatibility, ensuring consistent UI across different platforms
  • Rich set of pre-built components, reducing development time and effort
  • Customizable themes and styles to match brand requirements
  • Active community and regular updates

Cons

  • Learning curve for developers new to Taro ecosystem
  • Limited customization options for some complex components
  • Potential performance overhead due to cross-platform nature
  • Dependency on Taro framework, which may limit flexibility in some cases

Code Examples

  1. Using a basic Button component:
import { Button } from 'taro-ui'

const MyComponent = () => {
  return <Button type='primary'>Primary Button</Button>
}
  1. Implementing a Form with input and submit:
import { AtForm, AtInput, AtButton } from 'taro-ui'

const FormExample = () => {
  const [value, setValue] = useState('')

  const handleSubmit = () => {
    console.log('Submitted value:', value)
  }

  return (
    <AtForm onSubmit={handleSubmit}>
      <AtInput
        name='value'
        title='Name'
        type='text'
        placeholder='Please input your name'
        value={value}
        onChange={setValue}
      />
      <AtButton type='primary' formType='submit'>Submit</AtButton>
    </AtForm>
  )
}
  1. Creating a custom TabBar:
import { AtTabBar } from 'taro-ui'

const TabBarExample = () => {
  const [current, setCurrent] = useState(0)

  return (
    <AtTabBar
      tabList={[
        { title: 'Home', iconType: 'home' },
        { title: 'Profile', iconType: 'user' },
        { title: 'Settings', iconType: 'settings' }
      ]}
      onClick={setCurrent}
      current={current}
    />
  )
}

Getting Started

To start using Taro UI in your Taro project:

  1. Install Taro UI:
npm install taro-ui
  1. Import the components in your Taro page or component:
import { AtButton } from 'taro-ui'
  1. Use the component in your JSX:
const MyPage = () => {
  return (
    <View>
      <AtButton type='primary'>Hello, Taro UI!</AtButton>
    </View>
  )
}
  1. Import the Taro UI styles in your app's entry file (usually app.js or app.tsx):
import 'taro-ui/dist/style/index.scss'

Now you're ready to use Taro UI components in your Taro project!

Competitor Comparisons

Essential UI blocks for building mobile web apps.

Pros of Ant Design Mobile

  • Larger community and more frequent updates
  • Comprehensive documentation with live examples
  • Wider range of components and customization options

Cons of Ant Design Mobile

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance
  • Less focus on cross-platform development

Code Comparison

Ant Design Mobile:

import { Button } from 'antd-mobile';

const MyComponent = () => (
  <Button color='primary' size='large'>
    Click me
  </Button>
);

Taro UI:

import { AtButton } from 'taro-ui';

const MyComponent = () => (
  <AtButton type='primary' size='normal'>
    Click me
  </AtButton>
);

Both libraries offer similar component structures, but Ant Design Mobile generally provides more props and customization options. Taro UI's syntax is often simpler and more straightforward, which can be beneficial for developers new to the framework.

While Ant Design Mobile is primarily focused on React Native development, Taro UI is designed to work seamlessly with the Taro framework, allowing for cross-platform development across various mini-program platforms and React Native.

Ultimately, the choice between these libraries depends on the specific project requirements, target platforms, and developer preferences.

轻量、可靠的小程序 UI 组件库

Pros of vant-weapp

  • Larger community and more frequent updates
  • More comprehensive component library with 70+ components
  • Better documentation and examples

Cons of vant-weapp

  • Limited to WeChat Mini Program development
  • Less flexibility for customization compared to Taro UI

Code Comparison

vant-weapp:

<van-button type="primary">Button</van-button>
<van-cell-group>
  <van-field label="Username" placeholder="Please enter username" />
</van-cell-group>

Taro UI:

<AtButton type='primary'>Button</AtButton>
<AtForm>
  <AtInput name='value' title='Username' placeholder='Please enter username' />
</AtForm>

Summary

vant-weapp is a popular UI component library specifically designed for WeChat Mini Program development. It offers a wide range of components and frequent updates, making it a solid choice for WeChat-specific projects. However, it lacks the cross-platform capabilities of Taro UI.

Taro UI, built on the Taro framework, provides more flexibility for developing across multiple platforms, including WeChat Mini Programs, H5, and React Native. While it may have fewer components, it offers greater customization options and the ability to create consistent UIs across different platforms.

Choose vant-weapp for WeChat-focused projects with extensive component needs, or Taro UI for cross-platform development and greater customization flexibility.

27,134

A UI library by WeChat official design team, includes the most useful widgets/modules in mobile web applications.

Pros of WeUI

  • Officially supported by Tencent, ensuring long-term maintenance and updates
  • Extensive documentation and examples for easy implementation
  • Larger community and wider adoption, leading to more resources and support

Cons of WeUI

  • Limited to WeChat Mini Program development, less versatile than Taro UI
  • Less customizable and flexible compared to Taro UI's component system
  • Slower release cycle and feature updates

Code Comparison

WeUI (button component):

<button class="weui-btn weui-btn_primary">Primary Button</button>

Taro UI (button component):

import { AtButton } from 'taro-ui'

<AtButton type='primary'>Primary Button</AtButton>

Key Differences

  • WeUI uses traditional CSS classes for styling, while Taro UI leverages React-like components
  • Taro UI offers more advanced features and customization options
  • WeUI is specifically designed for WeChat Mini Programs, whereas Taro UI supports multiple platforms

Use Cases

  • Choose WeUI for native WeChat Mini Program development with a focus on simplicity
  • Opt for Taro UI when building cross-platform applications or requiring more advanced UI components

:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库

Pros of wux-weapp

  • Native WeChat Mini Program component library, ensuring better performance and compatibility
  • Extensive collection of components specifically designed for WeChat Mini Programs
  • Simpler setup and integration for WeChat-specific projects

Cons of wux-weapp

  • Limited to WeChat Mini Program development, lacking cross-platform capabilities
  • Smaller community and potentially slower updates compared to Taro UI
  • Less flexibility for customization across different frameworks

Code Comparison

wux-weapp:

<wux-button size="small" type="light">Light</wux-button>
<wux-button size="default" type="stable">Stable</wux-button>
<wux-button size="large" type="positive">Positive</wux-button>

Taro UI:

import { AtButton } from 'taro-ui'

<AtButton size='small' type='secondary'>Secondary</AtButton>
<AtButton type='primary'>Primary</AtButton>
<AtButton size='small' type='primary'>Primary</AtButton>

wux-weapp is tailored specifically for WeChat Mini Programs, offering native components and simpler integration for WeChat-centric projects. However, it lacks cross-platform capabilities and may have a smaller community compared to Taro UI. Taro UI, being part of the Taro ecosystem, provides cross-platform support and potentially more frequent updates, but may have slightly more complex setup for WeChat-only projects. The code comparison shows similar button implementations, with wux-weapp using custom element tags and Taro UI using imported React-like components.

一套高质量的微信小程序 UI 组件库

Pros of iview-weapp

  • Specifically designed for WeChat Mini Program development
  • Extensive set of UI components tailored for mobile interfaces
  • Lightweight and optimized for mini program performance

Cons of iview-weapp

  • Limited to WeChat Mini Program ecosystem
  • Less frequent updates compared to Taro UI
  • Smaller community and fewer third-party extensions

Code Comparison

iview-weapp:

<i-button type="primary" bind:click="handleClick">Click me</i-button>
<i-input value="{{ value }}" bind:change="handleChange"></i-input>

Taro UI:

import { AtButton, AtInput } from 'taro-ui'

<AtButton type='primary' onClick={this.handleClick}>Click me</AtButton>
<AtInput value={this.state.value} onChange={this.handleChange} />

Summary

iview-weapp is a UI component library specifically designed for WeChat Mini Programs, offering a wide range of mobile-optimized components. It excels in its focus on the WeChat ecosystem but is limited to that platform. Taro UI, on the other hand, provides a more versatile solution for cross-platform development, supporting multiple frameworks and platforms beyond WeChat Mini Programs. The code comparison shows the slight differences in syntax and usage between the two libraries, with iview-weapp using a more HTML-like approach and Taro UI following a React-like component structure.

💰 A mobile UI toolkit, based on Vue.js 2, designed for financial scenarios.

Pros of mand-mobile

  • More comprehensive component library with 30+ UI components
  • Better support for Vue.js applications
  • More active development and frequent updates

Cons of mand-mobile

  • Limited cross-platform support compared to Taro UI
  • Steeper learning curve for developers new to Vue.js
  • Less flexibility for customization in non-Vue environments

Code Comparison

mand-mobile (Vue.js):

<template>
  <md-button type="primary" @click="handleClick">Click me</md-button>
</template>

<script>
import { Button } from 'mand-mobile'
export default {
  components: { 'md-button': Button },
  methods: {
    handleClick() {
      console.log('Button clicked')
    }
  }
}
</script>

Taro UI (React):

import { AtButton } from 'taro-ui'

const MyComponent = () => {
  const handleClick = () => {
    console.log('Button clicked')
  }

  return <AtButton type='primary' onClick={handleClick}>Click me</AtButton>
}

Both libraries offer similar functionality, but mand-mobile is tailored for Vue.js applications, while Taro UI is designed for cross-platform development using React. mand-mobile provides a more extensive set of components, but Taro UI offers greater flexibility across different platforms and frameworks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Taro UI

NPM NPM Downloads david-dm License

一款基于 Taro 框架开发的多端 UI 组件库

特性

  • 基于 Taro 开发 UI 组件
  • 一套组件可以在 微信小程序,支付宝小程序,百度小程序,H5,ReactNative 多端适配运行
  • 提供友好的 API,可灵活的使用组件

关于 Taro

Taro 是由 凹凸实验室 倾力打造的多端开发解决方案。现如今市面上端的形态多种多样,Web、ReactNative、微信小程序等各种端大行其道,当业务要求同时在不同的端都要求有所表现的时候,针对不同的端去编写多套代码的成本显然非常高,这时候只编写一套代码就能够适配到多端的能力就显得极为需要。

使用 Taro,我们可以只书写一套代码,再通过 Taro 的编译工具,将源代码分别编译出可以在不同端(微信小程序、H5、RN等)运行的代码。

体验

请使用微信扫一扫以下体验码

QRCode

相关链接

安装

2.x

当 Taro 版本 < 3 时,使用 2.x 版本

$ npm install taro-ui@2.3.4

3.x

当 Taro 版本 ≥ 3 时,使用 3.x 版本

$ npm install taro-ui@latest

使用

在代码中 import 需要的组件并按照文档说明使用

import { AtButton } from 'taro-ui'

开发交流

官方微信交流群

开发计划

开发计划

路线图

Roadmap

贡献

如果你在使用 Taro UI 时遇到问题,或者有好的建议,欢迎给我们提 Issue 或 Pull Request。在开始之前,请阅读 贡献指南

License

MIT

NPM DownloadsLast 30 Days