User Manual

Widgets

10/2/26
Widgets

Widgets allow you to create custom and reusable UI elements for Kuika Designer. This guide covers everything you need to know to create, develop, and publish your own widget packages.

Widgets can only be used in web applications.

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js v24 LTS is recommended
  • npm, yarn, pnpm, or bun package manager
  • A code editor

Creating Your First Widget Pack

The fastest way to create your first widget pack is to use the create-kuika-widget CLI tool:

npx create-kuika-widget

This interactive wizard will guide you through the following steps:

  1. Widget Pack Name - A human-readable name for your pack (e.g., “My Dashboard Widgets”)
  2. Company - Your company name - or your first and last name if you don't have one (e.g., “acme”)
  3. Framework - Choose from React, Vue, Svelte, Angular, or AngularJS
  4. Stylesheet - CSS, SCSS, or Tailwind CSS
  5. Package Manager - npm, yarn, pnpm, or bun
  6. Git Initialization - Optional git repository setup

Quick Start Example

npx create-kuika-widget
# Widget Pack Name => My Custom Buttons
# Company => Acme
# Framework => React
# Stylesheet => Tailwind
# Package Manager => Yarn
# Git Initialization => No
# Go to the project folder
cd my-custom-buttons
# Start the development server
yarn dev
This guide uses yarn as the default package manager. If you selected a different package manager (npm, pnpm, or bun) when creating the project, you should use the equivalent in your package manager. For example: npm run dev, pnpm dev, or bun dev.

Project Structure

After the project is created, your project will have the following structure:

my-dashboard-widgets/
├── src/
│ ├── Components/ # Your widget components
│ │ ├── MyWidget/
│ │ │ ├── MyWidget.tsx # Component implementation
│ │ │ └── MyWidget.css # Component styles
│ │ └── ...
│ ├── App.tsx # Local playground (not exported)
│ └── index.tsx # Entry point (not exported)
├── kuika.manifest.ts # Widget pack configuration (REQUIRED)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── dist/ # Build output (generated)

Important Notes

  • kuika.manifest.ts is the main configuration file.
  • src/App.tsx is your local playground for testing - it is not included in the published widget pack.
  • src/Components/ is the recommended location for your widgets.

Manifest File

kuika.manifest.ts is the heart of your widget pack. It defines which components are exported and how they appear in Kuika Designer.

Basic Structure

import { defineWidgetComponent, defineWidgetManifest } from “@kuika/sdk/react”;
import { MyWidget } from “./src/Components/MyWidget/MyWidget”;
import { AnotherWidget } from “./src/Components/AnotherWidget/AnotherWidget”;
export default defineWidgetManifest({
projectId: "com.mycompany. my-dashboard-widgets“,
name: ”My Dashboard Widgets“,
version: ”1.0.0“,
components: [
defineWidgetComponent(MyWidget, { title: ”My Widget“ }),
defineWidgetComponent(AnotherWidget, { title: ”Another Widget" })
]
});

Configuration Options

  • projectId (Required): A unique identifier in reverse domain notation (e.g., com.acme.widgets).
  • name (Required): The human-readable name displayed in Designer.
  • version (Required): Specifies semantic version information (e.g., 1.0.0, 2.1.3).
  • components (Required): An array of components to be exported.

Component Registration

Each component is registered using defineWidgetComponent():

defineWidgetComponent(ComponentReference, {
title: “Display Title” // This appears in the Designer's component palette
})

Creating Components

You must use TypeScript when defining your component props for React, Vue, Angular, and AngularJS frameworks. Kuika extracts prop names and types directly from your TypeScript type definitions and displays them in Designer. Without proper TypeScript types, your props may not appear in Designer or may appear incorrectly.

React Components

Create standard React functional components with TypeScript props:

// src/Components/Counter/Counter.tsx
import { useState } from “react”;
import “./Counter.css”;
// TypeScript type definition - REQUIRED for Kuika to detect props
type CounterProps = {
initialValue?: number; // Optional prop with default value
step?: number; // Optional prop with default value
label?: string; // Visible label
};
export const Counter = ({
initialValue = 0,
step = 1,
label = “Count”
}: CounterProps) => {
const [count, setCount] = useState(initialValue);
return (
<div className="counter">
<span className="counter__label">{label}</span>
<button onClick={() => setCount(count - step)}>-</button>
<span>{count}</span>
<button onClick={() => setCount(count + step)}>+</button>
</div>
);
};

Vue Components

<!-- src/Components/Counter/Counter.vue -->
<script setup lang="ts">
import { ref } from ‘vue’;
// TypeScript type definition - REQUIRED for Kuika to detect props
const props = withDefaults(defineProps<{
initialValue?: number;
step?: number;
label?: string;
}>(), {
initialValue: 0,
step: 1,
label: “Count”
});
const count = ref(props.initialValue);
</script>
<template>
<div class="counter">
<span class="counter__label">{{ label }}</span>
<button @click=“count -= props.step”>-</button>
<span>{{ count }}</span>
<button @click=“count += props.step”>+</button>
</div>
</template>

TypeScript Requirements

Kuika uses your TypeScript type definitions for the following:

  1. Extracting prop names - Every property in your type becomes a configurable prop in the Designer.
  2. Determining prop types - The Designer displays input controls appropriate for the type.
  3. Defining optional props - Props marked with ? are displayed as optional.

Supported Prop Types

Kuika automatically detects the following prop types from your TypeScript definitions:

  • Primitives: string, number, boolean
  • Arrays: string[], number[], YourType[]
  • Objects: Interface or type definitions
  • Union types: “option1” | “option2” or 1 | 2 | 3
  • Optional props: propName?: Type

Prop Best Practices

  1. Always use TypeScript - Make explicit type definitions for all props.
  2. Use type or interface - type Props = {...} or interface Props {...} both work.
  3. Provide defaults - Optional props should have logical defaults.
  4. Keep props simple - Use primitive types as much as possible for Designer support.

AngularJS Components

AngularJS widgets work differently from other frameworks. Since AngularJS does not use TypeScript for component definitions, you must explicitly define the props in the manifest file.

AngularJS Manifest Structure

import { defineWidgetComponent, defineWidgetManifest } from “@kuika/sdk/angularjs”;
export default defineWidgetManifest({
projectId: “com.mycompany.angularjs-widgets”,
name: “My AngularJS Widgets”,
version: “1.0.0”,
components: [
defineWidgetComponent(“counter”, {
title: “Counter”,
props: {
initialValue: { type: “number” },
step: { type: ‘number’ },
label: { type: “string” }
}
}),
defineWidgetComponent(“statusBadge”, {
title: “Status Badge”,
props: {
status: {
type: “string”,
required: true,
unionValues: [“active”, ‘inactive’, “pending”]
},
showIcon: { type: “boolean” }
}
})
]
});

Key Differences for AngularJS

  1. Component Name as String - Pass the directive/component name as a string, not a reference.
  2. Props Are Defined in Manifest - All props must be explicitly defined in the manifest.
  3. Type Descriptions Required - Specify the type for each prop.

AngularJS Prop Schema

  • type (Required): Must be one of the following values: “string”, “number”, ‘boolean’, “function”.
  • required (Optional): Set to true if the prop is required.
  • unionValues (Optional): An array of allowed string values for enum-like props.
  • parameters (Optional): An array of parameter definitions for function-type props.

Function Properties in AngularJS

defineWidgetComponent(“myWidget”, {
title: “My Widget”,
props: {
onSubmit: {
type: “function”,
parameters: [
{ name: “data”, type: “object” },
{ name: ‘isValid’, type: “boolean” }
]
}
}
})

Development Flow

Available Commands

  • yarn dev: Starts the development server with hot reload.
  • yarn build: Creates a production build.
  • yarn run publish: Uploads the created package to the Kuika platform.

Development Server

The development server provides:

  • Hot module replacement
  • Automatic framework detection
  • Tailwind CSS v4 support (if detected)
  • Local playground on http://localhost:5173 (port may vary)
yarn dev

Testing Your Components

Use the App.tsx (or equivalent) file as a local playground:

// src/App.tsx
import { Counter } from “./Components/Counter/Counter”;
function App() {
return (
<div>
<h1>Widget Playground</h1>
<Counter initialValue={10} step={5} label="Items" />
</div>
);
}
export default App;

This playground file is NOT INCLUDED in the published widget pack.

Building and Publishing

Always test your build locally before publishing:

yarn build

This creates optimized outputs along with asset-manifest.json in the dist/ folder.

Always run yarn build to catch potential build errors early before publishing.

Publishing on Kuika

yarn run publish

The publish command will:

  1. Request credentials - Enter your Kuika platform email and password
  2. Workspace selection - Select which workspace to publish to
  3. Uploads - Sends the package to the Kuika platform
  4. Validates - The server validates your widget pack and reports any issues

On-Premises Deployments: If you are using an on-premises Kuika installation, use the --api-url flag to specify your API endpoint:

yarn run kuika publish --api-url https://your-kuika-instance.com

Using Widgets in Kuika UI Design

  1. Open the Kuika platform.
  2. Select the project where you will use the widget.
  3. Ensure that the technical infrastructure is ready by completing the necessary steps. Once these steps are complete, the widgets will be available for use.
  4. Open the UI Design module.
  1. Click on the Widgets tab in the left panel.
  2. Drag the element you want to use from the Widgets area and drop it into the design area.
  1. You can edit the element's properties via the Properties panel on the right and add trigger actions using the Add Action button.
Element properties and actions that can be added are defined during technical configuration. These properties or actions will not be displayed until these configurations are made.
No items found.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar