Create a widget

How to build, package, and organize a widget for Appinapp.
use this prompt to create widget with AI you want to use:
this is widget schema: https://appinapp.mutawirr.uz/schema.md, create a widget of

or continue with

Folder naming

Your widget folder name must end with .widget — the app only recognizes folders with this suffix as widgets.
Clock.widget

Layout

Every widget folder must contain these files at its root:
Clock.widget/
├── index.jsx        # widget code (REQUIRED — the only entry point)
└── config.json      # OPTIONAL declarative defaults (geometry, placement, behavior)
A widget is only recognized if the folder contains an
index.jsx. Without index file, the app skips the folder.

index.jsx

The app loads index.jsx, compiles JSX in place, and reads its exports. You
should export React component as default, plus optional config exports.

Imports — limited environment

Only three modules resolve inside a widget:
import { useState } from "appinapp-react";
import { Clock } from "appinapp-icons";
import Scritto from "appinapp-animations";
System-audio frames and now-playing info arrive through dedicated
modules (never shell out — widgets must not depend on binaries the user
may not have installed):
import { onAudioFrame } from "appinapp-audio";
import { onNowPlaying, onPlayers, togglePlayPause } from "appinapp-music";
Any other import throws Import not allowed: <name>. No
npm deps. Bring your own logic in the file. Relative ./ asset imports
(images, fonts, .css) resolve to data URLs / text; .. segments and
absolute paths are rejected.

Minimal widget

import { useState } from "appinapp-react";

export default function Widget() {
  return <div className="widget">Hello</div>;
}

Widget props

The app provides output, error, run, setHeight, setWidth, setX, setY:
export const command = "whoami"

export default function Widget({ output, error, run }) {

  if (error) {
    return <div style={{ color: "red" }}>{error}</div>;
  }

  return <div>{output}</div>;
}
PropWhat it is
outputstdout string from your command (see below)
errorerror if the command failed (null on success)
runasync (cmd) => stdout — run a shell command in the widget dir (throws on failure)
setHeight / setWidth / setX / setYresize/move the live instance (persisted)
looksuser's customization values merged over your looks schema defaults (see below); {} when you don't export looks
ExportTypeEffect
defaultComponentThe widget UI (or export render)
commandstringShell command, stdout → output prop (read once at add-time; afterwards the per-instance copy wins)
classNamestringCSS injected as <style>
looksobjectCustomization schema — a paintbrush button on the widget row opens the Looks editor built from it; values persist per instance and arrive as the looks prop
index.jsx exports exactly these four things. Geometry, refresh interval,
surfaces, z-index, workspaces, click-through, and glass live in config.json, never in JS.
The strings refreshFreq, surface, allWorkspace(s),
visible_on_all_workspaces, and colors do not exist anywhere in the app —
never use them.

Looks customization (user "looks")

Export a looks object to let users customize colors, sizes, fonts, and text. The
app shows a paintbrush button on the widget row (only when a non-empty
looks exists), opens the Looks editor from the schema, stores the
user's values per widget instance, and passes the merged values
(schema default + user's edits) to your component as the looks prop.
Field types (discriminated on type):
typeValueExtra keysDialog control
"text"string—text input
"color"string (hex)—color picker + hex input
"font"string (font-family name, e.g. "Helvetica Neue" or "system-ui")—searchable font selector
"number"numbermin?, max?, step?number input + slider (clamped)
"select"stringoptions (`(string{ label, value })[]`)
"checkbox"boolean—checkbox toggle
const Weather = ({ looks }) => (
  <div style={{
    background: looks.bg,
    color: looks.text,
    borderRadius: looks.radius,
    fontSize: looks.size,
    fontFamily: looks.font,
    padding: 14,
  }}>
    <span style={{ color: looks.accent }}>Tashkent</span> 21° ☀︎
  </div>
);

export default Weather;
export const looks = {
  bg:     { type: "color",  label: "Background", default: "#1c1c1e" },
  text:   { type: "color",  label: "Text color", default: "#f5f5f5" },
  accent: { type: "color",  label: "Accent",     default: "#34d399" },
  font:   { type: "font",   label: "Font",       default: "system-ui" },
  radius: { type: "number", label: "Roundness",  default: 14, min: 0, max: 32, step: 1 },
  size:   { type: "number", label: "Font size",  default: 14, min: 10, max: 48 },
};
The font field:
  • Value is a plain font-family string — use it directly as fontFamily in a style: fontFamily: looks.font.
  • The selector lists the fonts actually installed on the user's system (detected by the host), each option previewed in its own font. It has a built-in search field.
  • "system-ui" is a recognized special value meaning the system font; use it as the safe default.
  • If the stored value isn't in the detected list, the editor shows it as an extra entry so nothing breaks.
  • Don't assume any specific font beyond "system-ui" is available — treat other families as best-effort.
Notes:
  • looks is a plain object literal — only the six field types above are recognized.
  • The looks prop is always present when you export a schema (keys merged over defaults, sanitized; unknown keys dropped, wrong types fall back to default, numbers clamped).
  • Reset in the dialog restores every field's default. Values persist per instance (active_widgets.json) — editing defaults later does not change existing instances (delete + re-add to re-seed).
  • The export is looks and the prop is looks — the name theme does not exist anywhere in the app, never use it.

Config.json (declarative defaults)

Create a config.json next to index.jsx to provide defaults that apply when users add your widget. All keys optional, canonical keys only — unknown keys are dropped:
{
  "renderMode": "board",
  "zIndex": "top",
  "height": 100,
  "width": 100,
  "x": 10,
  "y": 20,
  "onAllWorkspaces": true,
  "clickThrough": false,
  "refreshFrequency": 3000,
  "liquidGlass": {
    "enabled": false,
    "variant": 0,
    "corner_radius": 5,
    "tint_color": "#FFFFFF80"
  }
}
Tip: refreshFrequency supports * expressions like "5 * 1000" (5 seconds) or "60 * 60 * 1000" (1 hour). 0/null/missing = run command once, no interval.
Canonical keys (all optional):
  • renderMode — "board" | "window"
  • zIndex — "bottom" | "normal" | "top"
  • height, width, x, y — numbers
  • onAllWorkspaces — boolean
  • clickThrough — boolean (window surface only; mouse events pass through the widget)
  • refreshFrequency — ms or * expression (e.g., "5 * 1000", "60 * 60 * 1000")
  • liquidGlass — object with enabled, variant, corner_radius, tint_color
Note: liquidGlass is entirely optional - omit for defaults (enabled: false, variant: 0, corner_radius: 5).
Note: command is NOT a config.json key — it comes from the index.jsx export and seeds the per-instance default at add-time. Gallery metadata (name, description, email) is not read from config.json by the app — do not add it here.
Precedence (highest wins):
  1. config.json (per-type defaults — read at widget add time)
  2. active_widgets.json (per-instance WidgetConfig — user overrides via WindowSettings)
  3. index.jsx command export (seeds the per-instance command at add-time only)
  4. Built-in defaults
config.json is read as defaults at add time — WindowSettings edits the per-instance copy afterwards, so editing the file later does not move existing instances (delete + re-add to re-seed).

Sizing — window vs board (important)

width / height are plain pixel numbers, and the component always renders inside exactly a width × height box — no matter the surface:
  • window mode: the widget is its own OS window whose content area is exactly width × height px.
  • board mode: the widget is a width × height px rectangle at x, y inside the shared fullscreen transparent overlay (the overlay covers the whole screen; your widget is just a rect inside it).
Never use viewport units (vw, vh, dvh, dvw) or window.innerWidth/innerHeight. The component has no viewport of its own, and the same stored width/height carry over if the widget's renderMode is later switched between window and board. Example of what breaks: a widget styled with height: 100vh "works" in window mode, but on the board 100vh resolves against the fullscreen overlay, so the content becomes screen-sized inside a small rect — the layout is destroyed.
Rules:
  1. Design for the configured width × height box — treat it as a fixed-size canvas.
  2. Always set concrete pixel width / height in config.json (e.g. 200 × 80); don't rely on screen-relative guesses.
  3. Make the root fill the box (width: "100%", height: "100%") and adapt inner content with flex/percent/overflow — percent values are relative to the widget box, which is safe on both surfaces.
  4. Programmatic resizing uses only setWidth/setHeight — pixel numbers, never "100%"/"100vh" strings (they are number params).
  5. To react to size changes, measure the DOM (ResizeObserver on your root element), not the window.
  6. Keep both modes in mind: a widget that only looks right fullscreen breaks when moved to a window, and vice versa.

Styling

The app supports Tailwind classnames — write Tailwind utility classes directly in your JSX:
export default function Widget({ output }) {
  return (
    <div className="flex items-center gap-2 rounded-lg bg-background px-3 py-2 text-sm text-muted-foreground">
      {output}
    </div>
  );
}
No build step, no config, no import — the host compiles the classes your widget uses at runtime (dynamic ones included) and scopes them to the widget, so they never override the app's styles. Variants (hover:, dark:, md:), arbitrary values (w-[37px]), the app's theme tokens (bg-background, text-muted-foreground, rounded-lg, …), and animate-in/fade-in-* all work out of the box. Tailwind's preflight already applies.
Besides Tailwind classnames you can use inline style={{...}}, imported .css files, and the className export (raw CSS injected as <style>). Don't put @apply in the className export — it's injected verbatim, never compiled; use Tailwind classes in JSX instead.

Full example

// index.jsx
export const command = "date +%H:%M:%S";

export const className = `
  .clock { font: 600 28px monospace; color: #fff; padding: 12px; }
`;

export default function Clock({ output, error }) {
  if (error) return <div className="clock">err</div>;
  return <div className="clock">{output || "--:--:--"}</div>;
}
// config.json
{
  "renderMode": "board",
  "zIndex": "top",
  "width": 200,
  "height": 80,
  "x": 40,
  "y": 40,
  "onAllWorkspaces": true,
  "clickThrough": false,
  "refreshFrequency": 1000,
  "liquidGlass": {
    "enabled": false,
    "variant": 0,
    "corner_radius": 5
  }
}

screenshot.png

A preview image shown in the app gallery. Capture your widget running.
It's aspect ratio should be between 1.3 - 3:
Forced UP to 2.25 (9/4) (because they're below the minimum):
RatioValueWhat it is
1/11.0Square
4/50.8Instagram portrait
9/160.56Vertical phone video/story
3/40.75Portrait photo
5/41.25Slightly wide print photo
All of these become 1.3 — the function treats squares and anything portrait-oriented (taller than wide, or just barely wide) as "too narrow" and pushes them up.
Left UNCHANGED (already inside 1.3–3):
RatioValueWhat it is
4/31.33Old TV / classic photo
3/21.535mm film / DSLR photo
16/91.78Widescreen video/monitor
2/12.0Wide banner
21/92.33Ultrawide monitor
2.35/12.35Cinematic movie
These pass through exactly as-is since they already fall in the 1.3–3 sweet spot.
Forced DOWN to 3 (because they're above the maximum):
RatioValueWhat it is
16/53.2Very wide banner
4/14.0Extreme panorama
32/93.56Super ultrawide monitor
All of these become 3 — capped rather than left at their true, more extreme value.
Bottom line: the only ratio "zone" that survives untouched is roughly between 4:3 and slightly beyond cinematic widescreen (1.3–3). Anything square or portrait gets pulled up to 2.25.

README.md

Describe what the widget does and how to customize it. It will be shown to users when open
your widget. Follow the template below! Examples
  1. Name
  2. Description
  3. Features
  4. How it works
  5. Customization
  6. Notes
  7. License