@todovue/tv-ui
v1.0.1
Published
UI component library for TODOvue application
Downloads
81
Maintainers
Readme
TODOvue UI (TvUi)
An umbrella package for Vue 3 that installs and re-exports the official @todovue/* components.
Important: this is NOT a monorepo.
@todovue/tv-uiis a library that declares dependencies on each@todovue/tv-*component (by the version published on npm), and re-exports them for unified consumption.
Demo / docs: https://ui.todovue.blog
Table of contents
- Features
- Installation
- Quick Start (SPA)
- Using styles
- Nuxt (SSR) / Nuxt Module
- Exported components
- Registration options
- SSR notes
- Development
- Contributing
- License
Features
- One-time install to get TODOvue components available.
- Vue plugin:
app.use(TvUi)registers components globally. - Re-exports: you can import specific components from
@todovue/tv-ui. - Compatible with SPA (Vite/Vue CLI) and SSR (Nuxt) as long as your app imports the styles.
- Does not bundle Vue nor the
@todovue/*packages into the build: they remain external dependencies (great for ecosystems and tree-shaking).
Installation
With npm:
npm install @todovue/tv-uiWith yarn:
yarn add @todovue/tv-uiWith pnpm:
pnpm add @todovue/tv-uiNode requirement for this repo:
>= 20.19.0.
Quick Start (SPA)
Global registration (main.js / main.ts):
import { createApp } from 'vue'
import App from './App.vue'
// Styles (see “Using styles” section)
import '@todovue/tv-ui/style.css'
import TvUi from '@todovue/tv-ui'
createApp(App)
.use(TvUi) // enables <TvButton />, <TvCard />, etc. globally
.mount('#app')Usage in a component:
<template>
<TvButton variant="success" icon="check">Save</TvButton>
</template>Local import (named export) if you prefer granular control:
<script setup>
import '@todovue/tv-ui/style.css'
import { TvButton, TvCard } from '@todovue/tv-ui'
</script>
<template>
<TvCard>
<TvButton>Action</TvButton>
</TvCard>
</template>Using styles
@todovue/tv-ui exposes a styles entry:
- Recommended import:
import '@todovue/tv-ui/style.css'This points to ./dist/tv-ui.css (via exports["./style.css"]).
What about per-component styles?
You can also import styles from each package:
import '@todovue/tv-button/style.css'
import '@todovue/tv-card/style.css'This is useful if you:
- only use 1–2 components,
- want to control exactly what CSS gets into your bundle,
- or are migrating gradually.
Nuxt (SSR) / Nuxt Module
This package publishes a Nuxt module at @todovue/tv-ui/nuxt that injects the CSS of @todovue/* packages into nuxt.options.css.
Setup
// nuxt.config.ts
export default defineNuxtConfig({
modules: [
'@todovue/tv-ui/nuxt'
]
})Plugin registration (optional)
You can register all components globally:
// plugins/tv-ui.ts
import { defineNuxtPlugin } from '#app'
import TvUi from '@todovue/tv-ui'
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(TvUi)
})Or import them locally:
<script setup>
import { TvButton } from '@todovue/tv-ui'
</script>
<template>
<TvButton>Hello</TvButton>
</template>Exported components
Currently @todovue/tv-ui re-exports:
TvAlert- GitHub | DemoTvArticle- GitHub | DemoTvBreadcrumbs- GitHub | DemoTvButton- GitHub | DemoTvCard- GitHub | DemoTvDemo- GitHub | DemoTvFooter- GitHub | DemoTvHero- GitHub | DemoTvLabel- GitHub | DemoTvMenu- GitHub | DemoTvModal- GitHub | DemoTvPagination- GitHub | DemoTvProgressBar- GitHub | DemoTvRelativeTime- GitHub | DemoTvScrollTop- GitHub | DemoTvSearch- GitHub | DemoTvSettings- GitHub | DemoTvSidebar- GitHub | DemoTvThemeButton- GitHub | DemoTvToc- GitHub | Demo
Registration options
| Approach | Example | When to use |
|---------------------|---------------------------------------------|------------------------------------------------------|
| Global via plugin | app.use(TvUi) | You use many components across the whole app |
| Local import | import { TvButton } from '@todovue/tv-ui' | Isolated views, code-splitting, fine-grained control |
| Individual packages | import TvButton from '@todovue/tv-button' | If you want to install/update components separately |
SSR notes
- This package does not assume a DOM during plugin installation.
- Still, SSR compatibility depends on each
@todovue/*component not accessingwindow/documentat render time. - In Nuxt, the
@todovue/tv-ui/nuxtmodule takes care of registering global CSS for you.
Development
Available scripts:
dev: copiesREADME.md/CHANGELOG.mdfromnode_modules/@todovue/*intopublic/demos/*and starts Vite.build: library build (ESM + CJS) + types.build:demo: builds the demo (targetdemo) and copiesREADME.md/CHANGELOG.mdtopublic/.
Commands:
npm run dev
npm run build
npm run build:demoContributing
PRs and issues are welcome. See:
CONTRIBUTING.mdCODE_OF_CONDUCT.md
License
MIT © TODOvue
