Convert Figma logo to code with AI

didi logocube-ui

:large_orange_diamond: A fantastic mobile ui lib implement by Vue

9,122
1,471
9,122
63

Top Related Projects

16,552

Mobile UI elements for Vue.js

23,249

A lightweight, customizable Vue UI library for mobile web apps.

23,961

A high quality UI Toolkit built on Vue.js 2.0

🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜

39,623

🐉 Vue Component Framework

25,724

Quasar Framework - Build high-performance VueJS user interfaces in record time

Quick Overview

Cube-UI is a mobile UI component library for Vue.js, developed by DiDi Chuxing. It offers a comprehensive set of UI components and tools specifically designed for building mobile web applications with a focus on performance and customization.

Pros

  • Rich set of mobile-optimized UI components
  • High performance with minimal bundle size
  • Extensive customization options through themes and styles
  • Well-documented with detailed API references and examples

Cons

  • Primarily focused on mobile development, may not be suitable for desktop applications
  • Learning curve for developers new to Vue.js or mobile-specific UI patterns
  • Limited community support compared to more popular UI libraries

Code Examples

  1. Creating a basic button:
<template>
  <cube-button :primary="true">Click me</cube-button>
</template>

<script>
import { CubeButton } from 'cube-ui'

export default {
  components: {
    CubeButton
  }
}
</script>
  1. Implementing a scrollable list:
<template>
  <cube-scroll :data="items">
    <ul>
      <li v-for="item in items" :key="item.id">{{ item.text }}</li>
    </ul>
  </cube-scroll>
</template>

<script>
import { CubeScroll } from 'cube-ui'

export default {
  components: {
    CubeScroll
  },
  data() {
    return {
      items: [
        { id: 1, text: 'Item 1' },
        { id: 2, text: 'Item 2' },
        { id: 3, text: 'Item 3' }
      ]
    }
  }
}
</script>
  1. Creating a popup dialog:
<template>
  <cube-button @click="showDialog">Show Dialog</cube-button>
</template>

<script>
import { CubeButton } from 'cube-ui'

export default {
  components: {
    CubeButton
  },
  methods: {
    showDialog() {
      this.$createDialog({
        type: 'alert',
        title: 'Alert',
        content: 'This is an alert dialog',
        confirmBtn: {
          text: 'OK',
          callback: () => {
            console.log('Confirmed')
          }
        }
      }).show()
    }
  }
}
</script>

Getting Started

  1. Install Cube-UI:
npm install cube-ui
  1. Import and use Cube-UI in your Vue.js project:
import Vue from 'vue'
import Cube from 'cube-ui'

Vue.use(Cube)
  1. Use Cube-UI components in your Vue templates:
<template>
  <cube-button>Hello, Cube-UI!</cube-button>
</template>

For more detailed setup instructions and configuration options, refer to the official Cube-UI documentation.

Competitor Comparisons

16,552

Mobile UI elements for Vue.js

Pros of mint-ui

  • Larger community and more widespread adoption, leading to better support and resources
  • More comprehensive documentation with detailed examples and API references
  • Lighter weight and faster initial load times for applications

Cons of mint-ui

  • Less frequent updates and maintenance compared to cube-ui
  • Limited customization options for component styles and themes
  • Fewer advanced components for complex UI requirements

Code Comparison

mint-ui:

<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>

cube-ui:

<template>
  <cube-button :primary="true" @click="handleClick">Primary Button</cube-button>
</template>

<script>
import { Button } from 'cube-ui'
export default {
  components: { CubeButton: Button }
}
</script>

Both libraries offer similar component usage, but cube-ui tends to use more props for configuration, while mint-ui often uses attributes. cube-ui also provides more flexibility in terms of customization and advanced features, which may require slightly more complex implementation in some cases.

23,249

A lightweight, customizable Vue UI library for mobile web apps.

Pros of Vant

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

Cons of Vant

  • Steeper learning curve due to more complex API
  • Larger bundle size, which may impact performance for smaller projects

Code Comparison

Vant:

<template>
  <van-button type="primary" @click="showPopup">Show Popup</van-button>
  <van-popup v-model:show="show">Content</van-popup>
</template>

<script>
import { ref } from 'vue';

export default {
  setup() {
    const show = ref(false);
    const showPopup = () => {
      show.value = true;
    };
    return { show, showPopup };
  },
};
</script>

Cube UI:

<template>
  <cube-button @click="showPopup">Show Popup</cube-button>
  <cube-popup :visible.sync="show">Content</cube-popup>
</template>

<script>
export default {
  data() {
    return { show: false };
  },
  methods: {
    showPopup() {
      this.show = true;
    },
  },
};
</script>

Both libraries offer similar functionality, but Vant uses the Composition API while Cube UI uses the Options API. Vant's syntax is more modern and aligns with Vue 3 best practices.

23,961

A high quality UI Toolkit built on Vue.js 2.0

Pros of iView

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

Cons of iView

  • Steeper learning curve due to more complex API
  • Heavier bundle size compared to Cube UI
  • Less focused on mobile-first design

Code Comparison

iView button component usage:

<template>
  <Button type="primary" @click="handleClick">Click me</Button>
</template>

<script>
export default {
  methods: {
    handleClick() {
      // Handle click event
    }
  }
}
</script>

Cube UI button component usage:

<template>
  <cube-button :primary="true" @click="handleClick">Click me</cube-button>
</template>

<script>
export default {
  methods: {
    handleClick() {
      // Handle click event
    }
  }
}
</script>

Both libraries offer similar component usage, but iView tends to have more customization options and props available for each component. Cube UI focuses on simplicity and mobile-first design, which is reflected in its more straightforward API and lighter weight. iView is better suited for complex desktop applications, while Cube UI excels in mobile web development scenarios.

🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜

Pros of ant-design-vue

  • Larger component library with more comprehensive UI elements
  • Better documentation and examples for each component
  • Stronger community support and more frequent updates

Cons of ant-design-vue

  • Larger bundle size, which may impact performance for smaller projects
  • Steeper learning curve due to the extensive API and component options
  • Less mobile-first approach compared to cube-ui

Code Comparison

ant-design-vue:

<template>
  <a-button type="primary" @click="showModal">Open Modal</a-button>
  <a-modal v-model:visible="visible" title="Basic Modal" @ok="handleOk">
    <p>Some contents...</p>
  </a-modal>
</template>

cube-ui:

<template>
  <cube-button @click="showDialog">Open Dialog</cube-button>
  <cube-dialog
    :visible.sync="visible"
    :showClose="true"
    title="Dialog Title"
    @confirm="handleConfirm"
  >
    <span>Dialog content</span>
  </cube-dialog>
</template>

Both libraries offer similar functionality, but ant-design-vue provides more customization options and follows the Ant Design specification more closely. cube-ui focuses on mobile-first design and has a simpler API, making it easier to use for smaller projects or those primarily targeting mobile devices.

39,623

🐉 Vue Component Framework

Pros of Vuetify

  • Larger community and ecosystem, with more resources and third-party integrations
  • More comprehensive component library, covering a wider range of UI elements
  • Better documentation and examples, making it easier for developers to get started

Cons of Vuetify

  • Larger file size and potentially slower performance due to its extensive feature set
  • Less flexibility in customization compared to Cube UI's more lightweight approach
  • Steeper learning curve for developers new to Material Design principles

Code Comparison

Vuetify component example:

<template>
  <v-app>
    <v-btn color="primary" @click="showAlert">Click me</v-btn>
  </v-app>
</template>

<script>
export default {
  methods: {
    showAlert() {
      alert('Button clicked!')
    }
  }
}
</script>

Cube UI component example:

<template>
  <cube-button :primary="true" @click="showAlert">Click me</cube-button>
</template>

<script>
export default {
  methods: {
    showAlert() {
      this.$createDialog({
        type: 'alert',
        title: 'Alert',
        content: 'Button clicked!'
      }).show()
    }
  }
}
</script>

Both libraries offer Vue.js components, but Vuetify follows Material Design more closely, while Cube UI provides a more customizable approach. Vuetify's syntax is generally more concise, but Cube UI offers more granular control over component behavior.

25,724

Quasar Framework - Build high-performance VueJS user interfaces in record time

Pros of Quasar

  • More comprehensive framework with support for multiple platforms (web, mobile, desktop)
  • Larger community and ecosystem, with more frequent updates and contributions
  • Built-in support for PWAs and Electron apps

Cons of Quasar

  • Steeper learning curve due to its extensive feature set
  • Potentially heavier bundle size for simpler projects
  • Less focused on mobile-first design compared to Cube UI

Code Comparison

Cube UI component usage:

<template>
  <cube-button @click="showDialog">Show Dialog</cube-button>
</template>

<script>
export default {
  methods: {
    showDialog() {
      this.$createDialog({
        type: 'alert',
        title: 'Title',
        content: 'Content'
      }).show()
    }
  }
}
</script>

Quasar component usage:

<template>
  <q-btn @click="showDialog" label="Show Dialog" />
</template>

<script>
import { useQuasar } from 'quasar'

export default {
  setup () {
    const $q = useQuasar()

    return {
      showDialog () {
        $q.dialog({
          title: 'Title',
          message: 'Content'
        }).onOk(() => {
          console.log('OK')
        })
      }
    }
  }
}
</script>

Both frameworks offer similar component-based approaches, but Quasar's API tends to be more extensive and flexible, while Cube UI focuses on simplicity and mobile optimization.

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

cube-ui Build Status codecov.io downloads

A fantastic mobile ui lib implement by Vue.

Links

Communication

QQ Community QR

New cube-ui project ?

Recommend use the CLI tools base on vue-cli to init the config and base code:

$ vue init cube-ui/cube-template projectname

Install

npm install cube-ui --save

Usage

import Vue from 'vue'
import Cube from 'cube-ui'

Vue.use(Cube)

Use modularized cube-ui

import Vue from 'vue'
import {
  /* eslint-disable no-unused-vars */
  Style,
  Button,
  ActionSheet
} from 'cube-ui'

Vue.use(Button)
Vue.use(ActionSheet)

For more information, please refer to Quick Start

Development

git clone git@github.com:didi/cube-ui.git
cd cube-ui
npm install
npm run dev
# or run document development
npm run doc-dev

Changelog

Detailed changes for each release are documented in the release notes.

DiDi Open Sources

  • Mpx: An enhanced miniprogram framework with data reactivity and deep optimizition.
  • Chameleon/kəˈmiːlɪən/: Unify all platforms(Web/Weex/Mini program) with MVVM. Focus on Write Once Run AnyWhere.
  • mand-mobile: A mobile UI toolkit, based on Vue.js 2, designed for financial scenarios.
  • DoraemonKit/'dɔ:ra:'emɔn/: A full-featured App (iOS & Android) development assistant. You deserve it.
  • Booster: An easy-to-use, lightweight, powerful and extensible quality optimization toolkit designed specially for mobile applications.
  • More repos

NPM DownloadsLast 30 Days