Cosmo

Widget Configuration

The widget.config.json file defines the metadata and behavior of your widget. Cosmo reads this file to determine initial dimensions, resizing constraints, and positioning.

Changes to widget.config.json are not hot-reloaded. You must restart the development server (npm run dev) for configuration changes to take effect in the Cosmo app.

Required Fields

The build process validates these fields. Missing or invalid values will prevent the project from building.

FieldTypeExampleDescription
namestring"Clock Widget"The display name of the widget shown in the marketplace and app.
minCosmoVersionstring"0.4.0"The minimum version of the Cosmo app required to run this widget.
defaultWidthnumber320Initial width in points.
defaultHeightnumber200Initial height in points.
minWidthnumber200Minimum width allowed during resizing.
minHeightnumber120Minimum height allowed during resizing.
allowResizebooleantrueIf true, the user can resize the widget window.
keepAspectRatiobooleanfalseIf true, the aspect ratio is locked during resizing.
allowLockScreenbooleantrueIf true, the widget can be put on computer's lock screen.
allowInternetbooleanfalseWhether the widget can make outgoing network requests. Set this to false unless internet access is necessary for your widget to function.

Internet access is allowed in development mode regardless of the allowInternet setting.

Optional Fields

FieldTypeExampleDescription
maxWidthnumber800Maximum width allowed.
maxHeightnumber600Maximum height allowed.
defaultPosnumber[][0.5, 0.5]Initial normalized position [x, y] on the screen. [0,0] is bottom-left; [1,1] is top-right.
backgroundBlurRadiusnumber20Applies a Gaussian blur to the window background (in points). Requires a semi-transparent background color in your CSS (e.g., rgba(255, 255, 255, 0.5)). Set to 0 to disable.