Skip to content

Latest commit

 

History

History
129 lines (91 loc) · 4.28 KB

README.en-US.md

File metadata and controls

129 lines (91 loc) · 4.28 KB

NPM Version NPM Download License


X Naive UI

An extension to the Naive-UI component library.

Enables slots and template style for DataTable / Dropdown / Menu / Select / Tree.

English | 中文


Introduction

Naive-UI is a popular Vue 3 component library.

Due to the maintainability, the official team does not provide slots or template style APIs for DataTable, Dropdown, Menu, Select, Cascader, Tree, TreeSelect etc..

Here are some related issues on GitHub:

This project is aimed to provide a solution for these issues above.


Features

  • Almost the same API to Naive-UI. You just need to add x- before the original component name (example: <n-data-table><x-n-data-table>).
  • DataTable: Slots for colums, cells, expandable rows.
  • Dropdown: Template style API for options.
  • Menu: Template style API for options.
  • Select: Template style API for options, option groups. Slots for options, tags.
  • Cascader: Slots for options.

Getting Started

1. Installation

Use pnpm or other package manager to install:

> pnpm install naive-ui
> pnpm install @skit/x.naive-ui

2. Components Registration

If you use Vue's default template syntax, you need to register components before you can use them. There are three ways to register components:

2.1. Global Registration All Components

import { createApp } from 'vue';
import XNaiveUI from '@skit/naive-ui';

const app = createApp(App);
app.use(XNaiveUI);

2.2. Global Registration Some Components

import { createApp } from 'vue';
import { XNDataTable } from '@skit/naive-ui';

const app = createApp(App);
app.use(XNDataTable);

2.3. Local Registration

<template>
    <x-n-data-table :columns="columns" :data="data" />
</template>

<script>
    import { XNDataTable } from '@skit/naive-ui';

    export default {
        components: {
            XNDataTable
        }
    };
</script>

3. Usage

Please view the Documentation.

4. Demo

You can run the demo to view more details.

> pnpm install    # install dependencies
> pnpm run build  # build
> pnpm run demo   # run demo, then visit http://localhost:8888/

Road Map

  • DataTable: Slots
  • DataTable: Template style API
  • Dropdown: Slots
  • Menu
  • Select
  • Cascader
  • Tree
  • TreeSelect