# Callaloo
> A modern Vue 3 UI library focused on developer experience, accessibility, and comprehensive theming.
## AI Guidelines
- **Component Prefix**: All components start with `CL` (e.g., ``).
- **Enums for Props**: Always use Enums for colors, sizes, and variants. Import them from `@codeandfunction/callaloo`.
- **Root Provider**: All application code MUST be wrapped in ``.
- **Form Bindings**: Prefer `v-model` for all form-related components (`CLInput`, `CLSelect`, `CLCheckbox`, etc.).
- **Slots**: Most components use slots for content. Check documentation for named slots like `#header`, `#footer`, or `#content`.
## No-Build / CDN Usage
- Access Callaloo via `window.Callaloo`.
- Register components globally: `app.use(window.Callaloo.default)`.
- Destructure constants from the global object: `const { CLColors, CLSizes } = window.Callaloo;`.
- Reference: [CDN Best Practices](https://callaloo.dev/docs/getting-started/cdn/best-practices)
# Full Documentation
## Getting Started
### Introduction
URL: https://callaloo.dev/docs/getting-started/introduction
# Introduction
Callaloo is a Vue UI library. It is easy to integrate into any Vue3+ project, has a small footprint, can be easily themed, and provides commonly used components.
Callaloo supports both standard installs (package manager + bundler) and no-build usage (CDN / script tag). See [Installation](./installation.md) or [CDN / No-build](./cdn/quickstart.md).
Callaloo is not concerned with providing a huge library of components for every use case. It is instead focused on providing components that can be used as building blocks for composing various patterns commonly used in UI.
## Features
- Dark mode support
- Bundled Icons
- Fully Typed
- Custom themes
- Small footprint
- WCAG 2.1 AA compliant
## Credits
- [floating-ui/floating-ui](https://github.com/floating-ui/floating-ui)
- [iconify/iconify](https://github.com/iconify/iconify)
- [perezd/node-murmurhash](https://github.com/perezd/node-murmurhash)
- [tabler/tabler-icons](https://github.com/tabler/tabler-icons)
---
### Installation
URL: https://callaloo.dev/docs/getting-started/installation
# Installation
## Setup
Add `@codeandfunction/callaloo` to your project
::: tip No-build / CDN
Want to try Callaloo without a build step? See [CDN / No-build](./cdn/quickstart.md) (or jump straight to the live demo at [`https://cdn-playground.callaloo.dev/`](https://cdn-playground.callaloo.dev/)).
:::
::: code-group
```sh [npm]
$ npm add @codeandfunction/callaloo
```
```sh [pnpm]
$ pnpm add @codeandfunction/callaloo
```
```sh [yarn]
$ yarn add @codeandfunction/callaloo
```
:::
## Usage
### Basic Setup
After installing Callaloo, wrap your application with the `CLThemeProvider` component:
```vue
```
### Using Components
Import and use Callaloo components in your Vue components:
```vue
Welcome to Callaloo
Say Hello
```
### Component Colors and Variants
Callaloo components support semantic colors and visual variants:
```vue
Primary ButtonSuccess ButtonDanger ButtonSolid ButtonOutline ButtonGhost Button
```
### Tree Shaking
Callaloo is built with tree shaking in mind. You can import only the components you need:
```typescript
// Import specific components to reduce bundle size
import CLButton from '@codeandfunction/callaloo/CLButton';
import CLInput from '@codeandfunction/callaloo/CLInput';
```
### TypeScript Support
Callaloo is written in TypeScript and provides full type definitions:
```vue
Typed Button
```
### Next Steps
- Learn about [theming](./theming.md) to customize the appearance
- Explore individual [components](../components/a11ybutton.md) for detailed API documentation
- Check out the component examples and stories
## Requirements
- **Vue**: 3.0 or higher
- **Node.js**: 16 or higher
- **TypeScript**: 4.5 or higher (optional but recommended)
---
### Quickstart
URL: https://callaloo.dev/docs/getting-started/cdn/quickstart
# CDN / No-build Quickstart
Use Callaloo **without a build step** by loading it directly from a CDN. This is ideal for prototypes, demos, and static sites.
::: tip Try it live
See the no-build demo at [`https://cdn-playground.callaloo.dev/`](https://cdn-playground.callaloo.dev/).
:::
## HTML Template
Copy this into an `index.html` and open it in a browser. This setup uses **Vue 3**, **TailwindCSS**, and **Callaloo** all via CDN.
```html
Callaloo CDN Quickstart
Hello Callaloo!Click Me
```
## Tradeoffs
- **No tree-shaking**: you’re loading the global bundle.
- **Larger payload**: great for demos, less ideal for production apps.
- **Versioning**: this example uses the latest version for convenience; pin to a specific version (e.g., `https://unpkg.com/@codeandfunction/callaloo@1.0.0/dist/styles.css`) for stability in production.
## Prefer installing with a bundler?
If you’re using Vite/Nuxt/etc, follow the standard install guide: [Installation](../installation.md).
---
### Best practices
URL: https://callaloo.dev/docs/getting-started/cdn/best-practices
# CDN Development Guide
Building with Callaloo via CDN offers a rapid, no-build development experience. This guide outlines best practices and architectural patterns to keep your "no-build" applications clean, maintainable, and robust.
## Architectural Patterns
### Template Decoupling
Keep your HTML clean by separating Vue templates into their own `` tags. This allows your JavaScript to focus on logic and state management while your HTML handles the structure.
```html
Hello from the template!
```
### The Provider Wrapper
Even in a CDN setup, you should wrap your core application in a `Root` component that provides global services like theming and toast notifications. This ensures these services are available throughout your app via Vue's Provide/Inject mechanism.
```javascript
const Root = {
template: `
`,
components: { app: App }
};
const app = Vue.createApp(Root);
```
## Working with Global Globals
### Accessing Callaloo Exports
In a CDN environment, everything is available on the `window.Callaloo` object. This includes components, composables, and constants.
```javascript
const { CLButton, CLColors, CLIconNames, useToast } = window.Callaloo;
```
### Global vs. Local Registration
Callaloo provides a `default` export that registers all components globally. This is convenient for CDN usage:
```javascript
const app = Vue.createApp(Root);
app.use(window.Callaloo.default);
app.mount('#app');
```
## Styling Strategies
### Hybrid Layouts
While Callaloo handles UI primitives (buttons, inputs, etc.), you can combine it with **TailwindCSS** for macro-layout (grid, flexbox, spacing) and responsive design.
```html
DashboardProfile
```
### Prefer Parent Wrappers for Layout
Avoid applying structural or layout-related utility classes (like `w-full`, `mt-4`, `flex-1`) directly to Callaloo components. Instead, wrap the component in a parent element (e.g., a `div`) and apply the layout classes to that wrapper. This keeps the component's internal styles clean and prevents layout logic from interfering with the component's intended visual structure.
```html
Submit
Submit
```
### Using Callaloo Constants
Always use the provided constants (`CLColors`, `CLSizes`, `CLIconNames`, etc.) to ensure consistency with the Callaloo design system. These are accessible from the `window.Callaloo` object.
## Interaction Best Practices
### State-Driven UI
Control complex components like Drawers, Modals, and Accordions using simple Vue `ref` or `reactive` state.
```javascript
const isDrawerOpen = Vue.ref(false);
const openDrawer = () => (isDrawerOpen.value = true);
const closeDrawer = () => (isDrawerOpen.value = false);
```
### Composable Usage
Callaloo composables like `useToast` work seamlessly in CDN environments as long as they are called within a `cl-toast-provider`.
```javascript
setup() {
const { showToast } = useToast();
// ...
}
```
## Third-Party Integration
When integrating third-party libraries (e.g., ApexCharts, Leaflet), initialize them inside the `onMounted` lifecycle hook to ensure the DOM is ready.
```javascript
onMounted(() => {
const chartElement = document.getElementById('my-chart');
if (chartElement && window.ApexCharts) {
new ApexCharts(chartElement, options).render();
}
});
```
## Accessibility
Building with a CDN doesn't excuse a lack of accessibility. Callaloo components are built with accessibility in mind, but you should still follow general web accessibility standards:
- Use semantic HTML (``, `