• Public
  • Public/Protected
  • All

Tiled Scripting API

Tiled can be extended with the use of JavaScript.

Scripts can be used to implement custom map formats, custom actions and new tools. Scripts can also automate actions based on signals.

See the Tiled Manual for more information on writing or installing extensions.

Type Definitions

TypeScript type definitions for this API are available by installing the @mapeditor/tiled-api package, which allows you to write scripts using TypeScript and can provide auto-completion in your editor (also when using plain JavaScript).

This documentation is also generated based on these type definitions.


Type aliases


FileFilter: string

A string used to show only certain types of files when prompting the user to select a file path.

Used in FileEdit and in tiled.promptOpenFile and related methods. The filter is given in a format like "Images (*.png *.xpm *.jpg)".

If you want multiple filters, separate them with ';;', for example:

"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"


MapObjectShape: typeof Rectangle | typeof Polygon | typeof Polyline | typeof Ellipse | typeof Text | typeof Point

The various possible shapes for MapObject instances.

Accessible like MapObject.Rectangle, MapObject.Polygon, etc.


An item in a menu, which is either an action or a separator. Used with tiled.extendMenu.


Polygon: point[]

A polygon is not strictly a custom type. It is an array of objects that each have an x and y property, representing the points of the polygon.

To modify the polygon of a MapObject, change or set up the polygon array and then assign it to MapObject.polygon.


TiledObjectPropertyValue: number | string | boolean | ObjectRef | FilePath | MapObject | PropertyValue | undefined

A type alias used to describe the possible values in object properties.

Generated using TypeDoc