Zimlet Modern Development
This skill should be used when the user asks about "modern zimlet", "Preact zimlet", "React zimlet", "zimlet GraphQL", "zimlet slots", "zimlet CLI", "Zimbra X zimlet", "zm-x-web", "zimlet-cli", or mentions developing zimlets for Zimbra Modern Web Client. Covers component-based zimlet development.
What this skill does
# Zimlet Modern Development
Guide for developing zimlets for the Zimbra Modern Web Client using Preact, GraphQL, and the zimlet-cli toolchain.
> **๐ก Essential Tip:** Add `?zimletSlots=show` to your Zimbra URL to visualize all available slot locations in the UI!
## Architecture Overview
Modern zimlets are Preact-based web components:
```
my-zimlet/
โโโ package.json
โโโ zimlet.json # Zimlet manifest (v2 schema)
โโโ src/
โ โโโ index.js # Entry point
โ โโโ components/ # Preact components
โ โโโ graphql/ # GraphQL queries
โโโ public/
โ โโโ icon.png
โโโ dist/ # Built zimlet
```
### Key Technologies
- **Preact** - React-compatible lightweight framework
- **GraphQL** - Data fetching from Zimbra
- **zimlet-cli** - Build and development tooling
- **Slot system** - UI injection points
## Project Setup
### Using zimlet-cli
```bash
# Install CLI
npm install -g @zimbra/zimlet-cli
# Create new zimlet
zimlet create my-zimlet
cd my-zimlet
# Development server
zimlet watch
# Build for production
zimlet build
# Package for deployment
zimlet package
```
### zimlet.json Manifest
```json
{
"name": "my-zimlet",
"version": "1.0.0",
"description": "My Modern Zimlet",
"label": "My Zimlet",
"icon": "icon.png",
"host": "https://mail.domain.com",
"slots": {
"menu": true,
"routes": true,
"compose-attachment-buttons": true
}
}
```
### package.json
```json
{
"name": "my-zimlet",
"version": "1.0.0",
"main": "src/index.js",
"scripts": {
"build": "zimlet build",
"watch": "zimlet watch",
"package": "zimlet package"
},
"dependencies": {
"@zimbra-client/components": "^1.0.0",
"@zimbra-client/graphql": "^1.0.0",
"preact": "^10.0.0"
}
}
```
## Entry Point and Slots
### src/index.js
```javascript
import { createElement } from 'preact';
import { useCallback, useState } from 'preact/hooks';
import { MenuItem } from '@zimbra-client/components';
// Register zimlet with all slot handlers
export default function Zimlet(context) {
const { plugins } = context;
const exports = {};
// Menu slot - add item to hamburger menu
exports.menu = {
handler: function MenuHandler(menu, context) {
return [
<MenuItem
icon="fa fa-star"
onClick={() => context.openSidebar('my-zimlet-panel')}
>
My Zimlet
</MenuItem>
];
}
};
// Routes slot - add custom routes
exports.routes = {
handler: function RouteHandler() {
return [
{
path: '/my-zimlet',
component: () => import('./components/MainView')
}
];
}
};
// Sidebar slot
exports.sidebars = {
handler: function SidebarHandler() {
return {
'my-zimlet-panel': () => import('./components/Sidebar')
};
}
};
// Compose attachment buttons
exports['compose-attachment-buttons'] = {
handler: function AttachmentHandler(props) {
return [
<button onClick={() => props.onAttach({ type: 'my-service' })}>
Attach from My Service
</button>
];
}
};
// Register with plugin system
plugins.register('my-zimlet', exports);
}
```
## Available Slots
Modern Web Client provides these injection points:
| Slot | Location | Use Case |
|------|----------|----------|
| `menu` | Hamburger menu | Add navigation items |
| `routes` | App routing | Custom views/pages |
| `sidebars` | Side panels | Contextual panels |
| `compose-attachment-buttons` | Compose toolbar | Custom attachments |
| `mail-action-menu` | Email context menu | Message actions |
| `calendar-action-menu` | Calendar context menu | Event actions |
| `contact-action-menu` | Contact context menu | Contact actions |
| `composer-toolbar` | Rich editor toolbar | Formatting tools |
| `search-bar` | Search area | Search enhancements |
### Slot Handler Patterns
```javascript
// Simple handler returning components
exports['slot-name'] = {
handler: function(props, context) {
return <Component {...props} />;
}
};
// Async component loading
exports['slot-name'] = {
handler: function() {
return import('./components/MyComponent').then(m => m.default);
}
};
// Conditional rendering
exports['slot-name'] = {
handler: function(props, context) {
if (!context.account.features.includes('myFeature')) {
return null;
}
return <Component />;
}
};
```
## Preact Components
### Basic Component
```javascript
// src/components/MainView.js
import { createElement } from 'preact';
import { useState, useEffect } from 'preact/hooks';
import { useGraphQL } from '@zimbra-client/graphql';
export default function MainView({ context }) {
const [data, setData] = useState(null);
useEffect(() => {
// Load data on mount
fetchData();
}, []);
return (
<div class="my-zimlet-main">
<h1>My Zimlet</h1>
{data ? (
<DataList items={data} />
) : (
<Loading />
)}
</div>
);
}
```
### Using Zimbra Components
```javascript
import {
Button,
Card,
Dialog,
Icon,
MenuItem,
Sidebar,
TextInput
} from '@zimbra-client/components';
function MyDialog({ visible, onClose }) {
return (
<Dialog
visible={visible}
title="My Dialog"
onClose={onClose}
buttons={[
{ label: 'Cancel', onClick: onClose },
{ label: 'Save', primary: true, onClick: handleSave }
]}
>
<TextInput
label="Name"
value={name}
onChange={e => setName(e.target.value)}
/>
</Dialog>
);
}
```
## GraphQL Integration
### Basic Query
```javascript
import { useQuery } from '@zimbra-client/graphql';
import gql from 'graphql-tag';
const GET_FOLDERS = gql`
query GetFolders {
getFolder {
folders {
id
name
unread
view
}
}
}
`;
function FolderList() {
const { data, loading, error } = useQuery(GET_FOLDERS);
if (loading) return <Loading />;
if (error) return <Error message={error.message} />;
return (
<ul>
{data.getFolder.folders.map(folder => (
<li key={folder.id}>
{folder.name} ({folder.unread})
</li>
))}
</ul>
);
}
```
### Search Messages
```javascript
const SEARCH_MESSAGES = gql`
query SearchMessages($query: String!, $limit: Int) {
search(query: $query, types: MESSAGE, limit: $limit) {
messages {
id
subject
date
from {
address
name
}
}
}
}
`;
function MessageSearch({ searchTerm }) {
const { data } = useQuery(SEARCH_MESSAGES, {
variables: { query: searchTerm, limit: 50 }
});
return (
<MessageList messages={data?.search?.messages || []} />
);
}
```
### Mutations
```javascript
const SEND_MESSAGE = gql`
mutation SendMessage($message: SendMessageInput!) {
sendMessage(message: $message) {
id
}
}
`;
function ComposeForm() {
const [sendMessage] = useMutation(SEND_MESSAGE);
const handleSend = async () => {
await sendMessage({
variables: {
message: {
to: [{ address: '[email protected]' }],
subject: 'Hello',
text: 'Message body'
}
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context โ no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes โ information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development โ guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.