|
2 | 2 | import { NuButton } from '@nolebase/ui' |
3 | 3 | </script> |
4 | 4 |
|
5 | | -# UI Components |
| 5 | +# UI Components <Badge type="danger" text="Alpha" /> |
| 6 | + |
| 7 | +::: danger 🛑 This package is in Alpha stage. |
| 8 | +This package is still in the Alpha stage, and it is not recommended to use it in production. The API may change in the future, and there may be bugs in the current version. Please use it with caution. |
| 9 | +::: |
6 | 10 |
|
7 | 11 | ::: warning 🚧 Constructing |
8 | 12 | Nice to meet you! But sorry, this page is still under construction. If you don’t find the information you are interested in, you can first find the content you are interested in in the navigation in the sidebar to start reading. |
9 | 13 | ::: |
10 | 14 |
|
| 15 | +## How to use |
| 16 | + |
| 17 | +::: tip 🙋 Before install |
| 18 | + |
| 19 | +Currently `@nolebase/ui` is still under development, and will be used by other [Nolebase Integrations](https://nolebase-integrations.ayaka.io) components now (such as [`vitepress-plugin-git-changelog`](/pages/en/integrations/vitepress-plugin-git-changelog/)). And those components and integrations of [Nolebase Integrations](https://nolebase-integrations.ayaka.io) will configure the needed options and settings to bundle and transform the underlying dependencies. |
| 20 | + |
| 21 | +Therefore, if you would ever want to install `@nolebase/ui` as one of your dependencies, you would need to configure a few configurations before proceeding: |
| 22 | + |
| 23 | +#### 1. Additional configurations for Vite |
| 24 | + |
| 25 | +##### 1.1 For users who imported `<NuLazyTeleportRiveCanvas />` component |
| 26 | + |
| 27 | +Since `<NuLazyTeleportRiveCanvas />` depends on `@rive-app/canvas`. If you also use Vite as your bundler, you will need to add the following configurations to your `vite.config.ts` file like this: |
| 28 | + |
| 29 | +```typescript |
| 30 | +export default defineConfig(() => { |
| 31 | + return { |
| 32 | + optimizeDeps: { // [!code ++] |
| 33 | + include: [ // [!code ++] |
| 34 | + // Add this line to your vite.config.ts's optimizeDeps.include array // [!code ++] |
| 35 | + '@nolebase/ui @rive-app/canvas', // [!code ++] |
| 36 | + ], // [!code ++] |
| 37 | + }, // [!code ++] |
| 38 | + } |
| 39 | +}) |
| 40 | +``` |
| 41 | + |
| 42 | +For more information about why configure this, please refer to the [Dep Optimization Options | Vite](https://vitejs.dev/config/dep-optimization-options.html#optimizedeps-exclude) documentation. |
| 43 | + |
| 44 | +##### 1.2 For users who imported VitePress related components |
| 45 | + |
| 46 | +If you are using VitePress, and imported components relies on VitePress, you will need to add the following configurations to your `vite.config.ts` file like this: |
| 47 | + |
| 48 | +```typescript |
| 49 | +export default defineConfig(() => { |
| 50 | + return { |
| 51 | + ssr: { // [!code ++] |
| 52 | + noExternal: [ // [!code ++] |
| 53 | + // Add this line to your vite.config.ts's ssr.noExternal array // [!code ++] |
| 54 | + '@nolebase/ui', // [!code ++] |
| 55 | + ], // [!code ++] |
| 56 | + }, // [!code ++] |
| 57 | + } |
| 58 | +}) |
| 59 | +``` |
| 60 | + |
| 61 | +For more information about why configure this, please refer to the [Server-Side Rendering | Vite](https://vitejs.dev/guide/ssr.html#ssr-externals) documentation. |
| 62 | + |
| 63 | +::: |
| 64 | + |
| 65 | +### Installation |
| 66 | + |
| 67 | +You can install `@nolebase/ui` as one of your Vue or VitePress project dependencies with the following command: |
| 68 | + |
| 69 | +::: code-group |
| 70 | + |
| 71 | +```shell [pnpm] |
| 72 | +pnpm add @nolebase/ui -D |
| 73 | +``` |
| 74 | + |
| 75 | +```shell [npm] |
| 76 | +npm install @nolebase/ui -D |
| 77 | +``` |
| 78 | + |
| 79 | +```shell [yarn] |
| 80 | +yarn add @nolebase/ui -D |
| 81 | +``` |
| 82 | + |
| 83 | +::: |
| 84 | + |
11 | 85 | ## Buttons |
12 | 86 |
|
13 | 87 | <div> |
|
0 commit comments