Cetera Vue Utilities
raw JSON →cetera-vue-utils is a collection of essential Vue 3 components, composables, and utility functions designed to streamline development of Vue applications. Currently at version 0.3.0, it appears to be under active development, though a specific release cadence isn't published. Key components include rich form elements (InputDate, MultiSelect), layout helpers (Dialog, DataTable, Accordion), and interaction patterns (Notifications, Spinner). The library emphasizes compatibility with Nuxt 3, offering a dedicated module for global component registration and auto-import of composables. A notable differentiator is its reliance on Tailwind CSS for styling, requiring specific configuration within the consuming project to ensure proper visual integration and theme customization. It ships with TypeScript types, promoting a type-safe development experience.
Common errors
error Failed to resolve import "cetera-vue-utils/nuxt" from "nuxt.config.ts". Does the file exist? ↓
cetera-vue-utils is installed via npm install cetera-vue-utils and verify modules: ['cetera-vue-utils/nuxt'] in nuxt.config.ts. error ReferenceError: useNotify is not defined ↓
import { useNotify } from 'cetera-vue-utils' is present. If using Nuxt, confirm cetera-vue-utils/nuxt is correctly listed in nuxt.config.ts modules and restart your development server. error SyntaxError: Named export 'Notifications' not found. The requested module 'cetera-vue-utils' does not provide an export named 'Notifications' ↓
import { Notifications } from 'cetera-vue-utils'. error Styles are missing or incorrect for components like Button, Dialog, etc. ↓
@source "../../../node_modules/cetera-vue-utils/dist/"; to your main CSS file and ensure @import "cetera-vue-utils/style.css"; is present. Warnings
gotcha The library relies heavily on Tailwind CSS for its styling. If Tailwind is not configured in your project, components will render unstyled or incorrectly. ↓
gotcha When using with Nuxt 3, it's crucial to explicitly import `cetera-vue-utils/nuxt` in your `nuxt.config.ts` file, not just `cetera-vue-utils`. ↓
gotcha The `Notifications` component is not automatically placed by the Nuxt module. It must be manually added to your root layout (e.g., `app.vue` or `layouts/default.vue`). ↓
gotcha The datepicker styles for `InputDate` and `InputTime` components, as well as general component base styles, require importing `cetera-vue-utils/style.css`. ↓
Install
npm install cetera-vue-utils yarn add cetera-vue-utils pnpm add cetera-vue-utils Imports
- Notifications wrong
const { Notifications } = require('cetera-vue-utils')correctimport { Notifications } from 'cetera-vue-utils' - useNotify wrong
const { useNotify } = require('cetera-vue-utils')correctimport { useNotify } from 'cetera-vue-utils' - Spinner wrong
import Spinner from 'cetera-vue-utils'correctimport { Spinner } from 'cetera-vue-utils' - module registration (Nuxt) wrong
export default defineNuxtConfig({ modules: ['cetera-vue-utils'], })correctexport default defineNuxtConfig({ modules: ['cetera-vue-utils/nuxt'], })
Quickstart
<template>
<Notifications />
<div class="p-4 flex flex-col gap-4 items-start">
<button class="px-4 py-2 bg-blue-500 text-white rounded" @click="notify.success('Action completed successfully!')">Show Success</button>
<button class="px-4 py-2 bg-red-500 text-white rounded" @click="notify.error('Oops, something went wrong!')">Show Error</button>
<div class="relative p-8 border rounded-md w-64 h-32 flex items-center justify-center">
<Spinner :isLoading="showSpinner" size="lg" />
<p v-if="!showSpinner">Content loaded</p>
</div>
<InlineLoading :isLoading="showInlineLoading" loadingText="Processing data..." />
<button class="px-4 py-2 bg-gray-200 rounded" @click="toggleLoading">Toggle Loading</button>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Notifications, useNotify, Spinner, InlineLoading } from 'cetera-vue-utils';
const notify = useNotify();
const showSpinner = ref(true);
const showInlineLoading = ref(true);
const toggleLoading = () => {
showSpinner.value = !showSpinner.value;
showInlineLoading.value = !showInlineLoading.value;
if (showSpinner.value) {
notify.info('Loading indicators activated.');
} else {
notify.info('Loading indicators deactivated.');
}
};
// Simulate initial loading
setTimeout(() => {
showSpinner.value = false;
showInlineLoading.value = false;
notify.success('Initial content loaded!');
}, 3000);
</script>
<style>
/* Basic Tailwind setup for demonstration */
@tailwind base;
@tailwind components;
@tailwind utilities;
/* Required for InputDate/InputTime and general component styling */
@import "cetera-vue-utils/style.css";
/* Ensure Tailwind scans library's dist for classes */
@source "../../../node_modules/cetera-vue-utils/dist/";
html, body, #app {
height: 100%;
margin: 0;
font-family: sans-serif;
}
</style>