Golden Path β Widgets β
Widgets are how your plugin appears in the workbench composition editor and in the running app. Raclette enforces a folder contract; everything inside the Vue component is up to you (see Vue structure).
For usePluginApi, i18n, and generated-config, see How to use β not repeated here.
Folder contract (required) β
| Piece | Rule |
|---|---|
| Path | frontend/widgets/<WidgetFolder>/ |
| Component | <WidgetFolder>Widget.vue (name must end with Widget.vue) |
| Catalog | setup.ts with details + config |
Full plugin tree (atoms diagram):
exampleCreator__examplePlugin/
βββ raclette.plugin.ts # Main plugin configuration
βββ frontend/ # Frontend-side code (if frontendDir specified)
β βββ [...] # See plugin metadata for more
β βββ widgets/ # Plugin widgets
β βββ Example/ # Your custom Widget folder name
β β βββ ExampleWidget.vue # The widget File. Needs to follow this structure "[CustomName]Widget.vue"
β β βββ setup.ts # Contains details and config for the widget
β β βββ [...]
β βββ [...]
βββ backend/ # Server-side code (if backendDir specified)
βββ index.ts # Server entry point
βββ example.model.ts # The model for your dataType. Currently mongoose
βββ example.schema.ts # The schema for your dataType. Fastify schema, validations etc
βββ example.service.ts # The services for your dataType ie the actuall backend business logic
βββ routes/ # API routes
βββ helpers/ # Business logic helpers and utilsDetails of raclette.plugin.ts
setup.ts (required shape) β
import type { WidgetDeclaration } from "@raclettejs/core"
export const details = {
title: "My Example Widget",
color: "#6CB5D1",
icon: new URL("./icon.svg", import.meta.url).href,
images: [new URL("./screenshot.png", import.meta.url).href],
description: "An example widget",
} satisfies WidgetDeclaration
const config = {}
export default {
config,
details,
}Add config entries with Vue PropType and an editor block so workbench admins can tune props without redeploying.
*Widget.vue β entry file only β
The widget file should wire the feature: usePluginApi(), props, i18n, and child components. Move presentation to components/ and logic to composables/ when the widget grows.
Fuller template: Widget Vue entry β cooking step.
Props from the orchestrator β
| Source | Role |
|---|---|
| Workbench config / public | From setup.ts editors |
slotParams | From URL for this slot β declare matching prop names |
| Context | compositionName, slotType, uuid |
You do not parse the URL manually for standard params; see Reading URL state.
Test in workbench β
yarn devwith workbench (local URLs).- Compositions β add your widget to a layout.
- Interaction links β deep links with query params.
- Open the portal frontend on the resulting URL.
If the widget is missing from the picker: check folder name, *Widget.vue suffix, and plugin load (npm or local plugins/).