vdash-ui
v1.0.1
Published
A Lit-based UI component library with a global configuration singleton for API integration.
Maintainers
Readme
vdash-ui
A UI component library built with Lit. This library provides Web Components that can be dropped into any project, along with a global configuration singleton allowing you to set a single API token and configuration used by all the components.
Installation
npm install vdash-uiGlobal Configuration
Before using any of the components that require API calls, you need to set up the global configuration by setting the API URL and Authentication Token.
src/main.js (or your entry point):
import { vdashConfig } from "vdash-ui";
// Set up the singleton before using components that depend on it
vdashConfig.setApiUrl("https://api.yourdomain.com/v1");
vdashConfig.setToken("YOUR_SECRET_JWT_TOKEN");Usage
You can import components directly from the library's main entry point, or target the specific component files if you prefer.
Importing Component:
import { VdashGreeting } from "vdash-ui";
// OR import directly to ensure it registers and avoids bundle bloat:
// import 'vdash-ui/components/vdash-greeting.js';Using the Component in HTML:
<!-- The component will automatically use the global token set earlier -->
<vdash-greeting user-id="845"></vdash-greeting>Features
- Built with Lit ensuring small, fast, and native Web Components!
- Supports ESM (ECMAScript Modules)
- Singleton configuration pattern for uniform API credential injection across components.
License
MIT
