# HandyUI
> A Vue 3 component library: 122 components, themeable, dark mode built in, written in TypeScript.
---
# Quick Start
HandyUI is a Vue 3 component library made up of 4 packages:
| Package | Contents |
| ------------------ | --------------------------------------------------------------------------------- |
| `@nscode/handy-ui` | All components (86), the `v-loading` directive, and functional APIs like Message |
| `@nscode/theme` | Theme: CSS variables, dark theme, 5 color palettes, reset styles, utility classes |
| `@nscode/icons` | SVG icons |
| `@nscode/utils` | Utilities (type checks, debounce and throttle, DOM helpers) |
Most projects only need to install `@nscode/handy-ui`. The other three packages are its dependencies and are installed along with it.
## Requirements
- Vue 3.5 or later (Modal, Drawer and Popover use `useId`, added in Vue 3.5)
- Node.js 18 or later
- Browsers: Chrome / Edge 111, Firefox 113, Safari 16.2 or later (the theme's light color scale uses CSS `color-mix`; older browsers fall back to fixed colors)
## Installation
The packages are published to the public npm registry. Install with:
```bash
pnpm add @nscode/handy-ui
# or
npm install @nscode/handy-ui
```
## Full Import
Register the library once in your entry file. After that every component can be used in templates directly, without importing them one by one.
```ts
// main.ts
import { createApp } from 'vue'
import HandyUI from '@nscode/handy-ui'
import '@nscode/handy-ui/style.css'
import App from './App.vue'
const app = createApp(App)
app.use(HandyUI)
app.mount('#app')
```
`app.use(HandyUI)` does two things:
- Registers every component. Tag names are PascalCase with an `Hui` prefix, such as ` {{ logs.length ? logs.join(' → ') : 'No clicks yet' }} {{ duration }}ms {{ status }} First paragraph Second paragraph
Edit
Click menu:{{ open ? 'Open' : 'Closed' }}; hover menu:{{ hoverOpen ? 'Open' : 'Closed' }}
Row {{ i }} content
A second line makes the height
change easier to see.
Input length: {{ html.length }}; failure mode: {{ fail }}
{{ status }}; native click: {{ nativeClicks }}
This is the target paragraph for this example.
{{ status }}; {{ updateStatus }}
{{ converted }}
{{ paragraph }}
Line {{ index }}: expand to read the full instructions.
Paragraph {{ index }}: compare the bottom edge when collapsed.
Paragraph {{ index }}: change state with the external switch or the component's button.
This short paragraph needs no collapse.
Line {{ index }} exceeds the available preview height.
Line {{ index }} of content.
Paragraph {{ index }}: dynamic content is checked again for overflow.
Omitted prop
Paragraph {{ index }}
Update listener only
Paragraph {{ index }}
Explicit undefined
Paragraph {{ index }}
Parent rejects updates
Paragraph {{ index }}
Two-way binding
Paragraph {{ index }}
Bound value: {{ model }}; latest request: {{ last }}
Article content…
finish emitted {{ finishCount }} times
``` Call `startAnimation()` through a ref to replay from `from`, or `stopAnimation()` to stop at the currently displayed value. The first metric below starts at the default 0; the second uses `from` of 90000 and two decimal places: ```vueDefault
stripe
border
{{ size }}
{{ layout }}
Automatically accept updates
Record requests without applying them: Sam stays selected.
Requested keys: {{ request }}; proposed rows: {{ event }}
v-model:sort-state applies requested updates
This table keeps ascending order because updates are only recorded, not applied.
Latest request: {{ requested }}
Locale loading text
loading-text="": icon only
Details for {{ row.name }}
Saved snapshot: {{ JSON.stringify(saved) }}
Current size: {{ variableSize }};Border: {{ variableBorder ? 'On' : 'Off' }}
Expanding the filter area moves the table. Window or page size notifications update the available height; use the method for position-only changes.
{{ result }}. Turning fill off restores 240px; the 480px maximum remains active.
Scrollable content, line {{ line }}
With a definite parent height, the table can use height="100%".
Selected: {{ selected.length ? selected.join('、') : 'None' }}
``` When listening to both `click` and `close`, the close button emits only `close`: ```vue{{ log || 'No event yet' }}
``` ## CSS variables on ancestors Public CSS variables are read-only inputs. Without overrides, default colors follow type and effect. Set overrides on the component or any ancestor to share them across tags. `hit` changes only the private default border and cannot override public configuration. Nested tags inherit the outer public configuration while calculating their own private defaults for type and effect. | Variable | Default | Description | | ------------------------ | --------------------------------- | --------------------------- | | `--hui-tag-color` | Type color; white for dark effect | Text and close button color | | `--hui-tag-bg` | Depends on type/effect | Background color | | `--hui-tag-border-color` | Depends on type/effect/hit | Border color | The border variable was renamed from `--hui-tag-border` to `--hui-tag-border-color`; no fallback for the old name is retained. ```vue