Convert Figma logo to code with AI

tusen-ai logonaive-ui

A Vue 3 Component Library. Fairly Complete. Theme Customizable. Uses TypeScript. Fast.

15,860
1,659
15,860
565

Top Related Projects

39,623

🐉 Vue Component Framework

🎉 A Vue.js 3 UI Library made by Element team

25,724

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

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

54,105

A Vue.js 2.0 UI Toolkit for Web

Quick Overview

Naive UI is a Vue 3 component library with a TypeScript-based design. It offers a comprehensive set of customizable UI components and utilities for building modern web applications. The library focuses on providing a flexible and feature-rich set of tools for developers working with Vue 3.

Pros

  • Extensive collection of well-designed and customizable components
  • Strong TypeScript support for improved type safety and developer experience
  • Comprehensive documentation with examples and API references
  • Active development and community support

Cons

  • Limited compatibility with older Vue versions (Vue 2.x)
  • Steeper learning curve compared to some simpler UI libraries
  • Larger bundle size due to the extensive feature set
  • May require additional configuration for optimal performance in smaller projects

Code Examples

  1. Basic Button Usage:
<template>
  <n-button type="primary" @click="handleClick">
    Click me!
  </n-button>
</template>

<script setup>
import { NButton } from 'naive-ui'

const handleClick = () => {
  console.log('Button clicked!')
}
</script>
  1. Data Table with Pagination:
<template>
  <n-data-table
    :columns="columns"
    :data="data"
    :pagination="pagination"
    @update:page="handlePageChange"
  />
</template>

<script setup>
import { ref } from 'vue'
import { NDataTable } from 'naive-ui'

const columns = [
  { title: 'Name', key: 'name' },
  { title: 'Age', key: 'age' }
]

const data = ref([
  { name: 'John', age: 30 },
  { name: 'Jane', age: 25 }
])

const pagination = ref({
  page: 1,
  pageSize: 10
})

const handlePageChange = (page) => {
  pagination.value.page = page
}
</script>
  1. Form with Validation:
<template>
  <n-form ref="formRef" :model="formModel" :rules="rules">
    <n-form-item label="Username" path="username">
      <n-input v-model:value="formModel.username" />
    </n-form-item>
    <n-form-item label="Password" path="password">
      <n-input v-model:value="formModel.password" type="password" />
    </n-form-item>
    <n-button @click="handleSubmit">Submit</n-button>
  </n-form>
</template>

<script setup>
import { ref } from 'vue'
import { NForm, NFormItem, NInput, NButton } from 'naive-ui'

const formRef = ref(null)
const formModel = ref({
  username: '',
  password: ''
})

const rules = {
  username: { required: true, message: 'Please enter a username' },
  password: { required: true, message: 'Please enter a password' }
}

const handleSubmit = () => {
  formRef.value?.validate((errors) => {
    if (!errors) {
      console.log('Form submitted:', formModel.value)
    }
  })
}
</script>

Getting Started

To use Naive UI in your Vue 3 project:

  1. Install the library:
npm install naive-ui
  1. Import and use components in your Vue file:
<template>
  <n-button>Hello, Naive UI!</n-button>
</template>

<script setup>
import { NButton } from 'naive-ui'
</script>
  1. For global configuration, create a provider in your app's main component:
<template>
  <n-config-provider>
    <app />
  </n-config-provider>
</template>

<script setup>
import { NConfigProvider } from 'naive-ui'
</script>

Competitor Comparisons

39,623

🐉 Vue Component Framework

Pros of Vuetify

  • Larger community and ecosystem, with more resources and third-party integrations
  • Comprehensive Material Design implementation, offering a wide range of pre-built components
  • Extensive documentation and examples, making it easier for beginners to get started

Cons of Vuetify

  • Heavier bundle size, which may impact performance for smaller applications
  • Less flexibility in customization compared to Naive UI's more minimalist approach
  • Steeper learning curve due to its extensive feature set and Material Design guidelines

Code Comparison

Vuetify:

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

Naive UI:

<template>
  <n-button type="primary">Click me</n-button>
</template>

Both libraries offer similar component usage, but Vuetify requires wrapping the entire application in a v-app component, while Naive UI allows for more granular component usage without a specific wrapper.

Vuetify follows Material Design principles more strictly, which is evident in its class naming conventions and component structure. Naive UI, on the other hand, provides a more flexible and customizable approach to styling and component design.

🎉 A Vue.js 3 UI Library made by Element team

Pros of Element Plus

  • Larger community and ecosystem, with more third-party components and resources
  • More comprehensive documentation and examples
  • Better internationalization support with built-in language packs

Cons of Element Plus

  • Heavier bundle size, which may impact initial load times
  • Less flexible theming system compared to Naive UI's CSS variables approach
  • Steeper learning curve for customization and advanced usage

Code Comparison

Element Plus:

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

<script>
import { ElButton } from 'element-plus'
</script>

Naive UI:

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

<script>
import { NButton } from 'naive-ui'
</script>

Both libraries offer similar component APIs, but Naive UI tends to have more concise naming conventions (e.g., n-button vs el-button). Element Plus requires importing styles separately, while Naive UI handles this automatically. Naive UI also provides more customization options through its theming system, allowing for easier adaptation to various design requirements.

25,724

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

Pros of Quasar

  • Cross-platform development: Supports web, mobile, and desktop applications
  • Extensive component library: Offers a wide range of pre-built UI components
  • Active community and ecosystem: Regular updates and extensive documentation

Cons of Quasar

  • Steeper learning curve: More complex framework with additional features
  • Larger bundle size: Due to its comprehensive nature and cross-platform support
  • Opinionated structure: May be less flexible for custom designs

Code Comparison

Quasar (Vue.js):

<template>
  <q-btn color="primary" label="Click me" @click="handleClick" />
</template>

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

Naive UI (Vue.js):

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

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

Both frameworks provide Vue.js components, but Quasar offers a more comprehensive set of features for cross-platform development, while Naive UI focuses on providing a lightweight and customizable UI library for web applications.

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

Pros of ant-design-vue

  • Larger community and more extensive ecosystem
  • Closer alignment with React's Ant Design, making it easier for developers familiar with that library
  • More comprehensive documentation and examples

Cons of ant-design-vue

  • Heavier bundle size compared to naive-ui
  • Less flexibility in customization and theming
  • Slower release cycle and potentially longer time to address issues

Code Comparison

ant-design-vue:

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

<script>
import { Button } from 'ant-design-vue';

export default {
  components: {
    AButton: Button,
  },
  methods: {
    handleClick() {
      console.log('Button clicked');
    },
  },
};
</script>

naive-ui:

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

<script>
import { NButton } from 'naive-ui';

export default {
  components: {
    NButton,
  },
  methods: {
    handleClick() {
      console.log('Button clicked');
    },
  },
};
</script>

Both libraries offer similar component APIs, but naive-ui tends to have a more streamlined approach with less boilerplate code. ant-design-vue follows the Ant Design conventions more closely, which may be familiar to developers coming from the React ecosystem.

54,105

A Vue.js 2.0 UI Toolkit for Web

Pros of Element

  • Larger community and ecosystem with more third-party components and resources
  • More comprehensive documentation and examples
  • Better browser compatibility, including support for older versions

Cons of Element

  • Heavier bundle size, which may impact performance for smaller applications
  • Less frequent updates and slower adoption of new features
  • More opinionated design, which can be limiting for custom styling

Code Comparison

Element:

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

Naive UI:

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

Both libraries offer similar component APIs, making it relatively easy to switch between them. The main differences lie in the component prefixes (el- for Element and n- for Naive UI) and some prop naming conventions.

Element is a more established library with a larger community, while Naive UI is newer and focuses on performance and customization. Element may be better suited for larger projects with complex requirements, while Naive UI could be ideal for smaller, modern applications that prioritize bundle size and flexibility.

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

Naive UI

A Vue 3 Component Library

Fairly Complete, Theme Customizable, Uses TypeScript, Fast

Kinda Interesting

English | 中文

Documentation

www.naiveui.com

Community

  • Discord

  • DingTalk Group 1 (Member limit reached) 33482509

  • DingTalk Group 2 (Member limit reached) 35886835

  • DingTalk Group 3 (Member limit reached) 32377370

  • DingTalk Group 4 (Member limit reached) 8165002788

  • DingTalk Group 5 (Member limit reached) 31205022250

  • DingTalk Group 6 62720001971

  • Awesome Naive UI

Features

Fairly Complete

There are more than 90 components. Hope they can help you write less code.

What's more, they are all treeshakable.

Theme Customizable

We provide an advanced type safe theme system built using TypeScript. All you need is to provide a theme overrides object in JS. Then all the stuff will be done by us.

What's more, no less/sass/css variables, no webpack loaders are required.

Uses TypeScript

All the stuff in Naive UI is written in TypeScript. It can work with your typescript project seamlessly.

What's more, you don't need to import any CSS to use the components.

Fast

I try to make it not rather slow. At least select, tree, transfer, table and cascader work with virtual list.

What's more, ..., no more. Just enjoy it.

Installation

npm

Use npm to install.

npm i -D naive-ui

Fonts

npm i -D vfonts

Icons

Naive UI recommends using xicons as icon library.

Design Resources

Naive UI (Sketch).

Contributing

Please see CONTRIBUTING.md.

License

Naive UI is licensed under the MIT license.

Graphics resources of result component is licensed under the CC-BY 4.0. The graphics resources come from Twemoji.

NPM DownloadsLast 30 Days