Widget System
Modular, extensible widget framework for customizable group dashboards
Overview
The OMOBL Widget System provides a powerful, flexible framework for creating rich, interactive group dashboards. Widgets are reusable components that can be configured, positioned, and customized per group.
Architecture
Core Components
Central registry mapping widget keys to React components. Ensures type safety and prevents arbitrary code execution.
Metadata about widgets including name, category, config schema, default size, and permissions.
Per-group widget instances with position, settings, enabled/required status, and display order.
Renders widgets in a responsive grid layout, handles loading states, and manages widget lifecycle.
System Widgets
OMOBL SSO includes 6 built-in system widgets available to all groups:
Overview metrics showing member growth, engagement, app adoption, and builder activity.
Grid view of all projects (subgroups) with member counts, apps, and energy levels.
Real-time feed of community activity including member joins, app usage, and milestones.
List of active onboarding workflows for new members and admins with progress tracking.
Integrated calendar with Google Calendar and Outlook sync, event management, and scheduling.
Group messaging, bulletin boards, and direct messages with real-time delivery.
Creating a Widget
1. Create Widget Component
// components/widgets/MyWidget.tsx
import { WidgetComponentProps } from "@/types/widgets";
export function MyWidget({
widgetId,
widgetKey,
groupId,
userId,
config,
data,
loading,
error,
onRefresh,
}: WidgetComponentProps) {
return (
<Card>
<CardHeader>
<CardTitle>My Widget</CardTitle>
</CardHeader>
<CardContent>
{/* Widget content */}
</CardContent>
</Card>
);
}2. Register in Widget Registry
// lib/widgets/registry.tsx
import { MyWidget } from "@/components/widgets/MyWidget";
export const WIDGET_REGISTRY = {
// ... existing widgets
"my-widget": {
component: MyWidget,
displayName: "My Widget",
category: "PRODUCTIVITY",
isSystemWidget: true,
},
};3. Create Widget Definition
// prisma/seed-my-widget.ts
await prisma.widgetDefinition.create({
data: {
widgetKey: "my-widget",
name: "My Widget",
description: "Description of my widget",
category: "PRODUCTIVITY",
icon: "Wrench",
componentType: "react",
dataEndpoint: "/api/groups/[id]/my-widget",
configSchema: {
type: "object",
properties: {
setting1: { type: "string", default: "value" }
}
},
defaultSize: { w: 6, h: 4 },
scopes: ["group"],
isSystemWidget: true,
isActive: true,
},
});Widget Configuration
Widgets support flexible configuration via JSON schemas:
Calendar Widget Config
{
"view": "month", // month | week | agenda | list
"showUpcoming": true, // Show upcoming events
"maxUpcomingEvents": 5, // Max events to show
"connectionId": "conn_123" // Calendar connection ID
}Messenger Widget Config
{
"defaultTab": "channels", // channels | dms | bulletin
"showBulletin": true, // Show bulletin board
"showDMs": true // Show direct messages
}API Reference
GET /api/groups/[id]/widgets
Get all widgets configured for a group
POST /api/groups/[id]/widgets
Add a widget to a group
PATCH /api/groups/[id]/widgets/[widgetId]
Update widget configuration or position
DELETE /api/groups/[id]/widgets/[widgetId]
Remove a widget from a group
See Also
- Community Builder - Learn about community building features
- Group Management - Manage groups and permissions
- Messenger Widget Documentation