---
title: "layer.newText: Text — Motion kit command — Kition"
description: "Adds a text layer with `text` (point text at `position`, or paragraph text in `box` [x, y, w, h]) and character options: `font`, `size`, `fill`, `stroke`, `tracking`, `leading`, `justify`. Edit it later with layer.setText. Returns the layer."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/layer.newText"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/layer.newText](https://developer.kition.ai/docs/kits/motion/commands/layer.newText)

# layer.newText

**Text.** Adds a text layer with `text` (point text at `position`, or paragraph text in `box` [x, y, w, h]) and character options: `font`, `size`, `fill`, `stroke`, `tracking`, `leading`, `justify`. Edit it later with layer.setText. Returns the layer.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `allCaps` | `boolean` | no |  |
| `applyFill` | `boolean` | no |  |
| `applyStroke` | `boolean` | no |  |
| `baseline` | `string` | no |  |
| `baselineShift` | `number` | no |  |
| `box` | `number[]` | no | paragraph text, comp space |
| `comp` | `integer \| string` | no | read by the command beside its listed parameters |
| `composer` | `string` | no |  |
| `direction` | `string` | no |  |
| `edit` | `boolean` | no | start editing |
| `fauxBold` | `boolean` | no |  |
| `fauxItalic` | `boolean` | no |  |
| `fill` | `string \| number[]` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1) |
| `font` | `string` | no |  |
| `hScale` | `number` | no |  |
| `hangingPunctuation` | `boolean` | no |  |
| `indentFirst` | `number` | no |  |
| `indentLeft` | `number` | no |  |
| `indentRight` | `number` | no |  |
| `justify` | `string` | no |  |
| `kerning` | `"metrics" \| "optical" \| number` | no |  |
| `leading` | `number` | no |  |
| `ligatures` | `boolean` | no |  |
| `name` | `string` | no | layer name; default the text |
| `position` | `number[]` | no |  |
| `size` | `number` | no |  |
| `smallCaps` | `boolean` | no |  |
| `spaceAfter` | `number` | no |  |
| `spaceBefore` | `number` | no |  |
| `stroke` | `string \| number[]` | no | a colour, "#rrggbb" or [r, g, b] (0 to 1) |
| `strokeOverFill` | `boolean` | no |  |
| `strokeWidth` | `number` | no |  |
| `style` | `string` | no |  |
| `subscript` | `boolean` | no |  |
| `superscript` | `boolean` | no |  |
| `text` | `string` | no |  |
| `tracking` | `number` | no |  |
| `tsume` | `number` | no |  |
| `vScale` | `number` | no |  |
| `vertical` | `boolean` | no |  |

## Call through motion_run

```text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "layer.newText" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `allCaps`, `applyFill`, `applyStroke`, `baseline`, `baselineShift`, `box`, `comp`, `composer`, `direction`, `edit`, `fauxBold`, `fauxItalic`, `fill`, `font`, `hScale`, `hangingPunctuation`, `indentFirst`, `indentLeft`, `indentRight`, `justify`, `kerning`, `leading`, `ligatures`, `name`, `position`, `size`, `smallCaps`, `spaceAfter`, `spaceBefore`, `stroke`, `strokeOverFill`, `strokeWidth`, `style`, `subscript`, `superscript`, `text`, `tracking`, `tsume`, `vScale`, `vertical`. motion_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "allCaps": {
      "type": "boolean"
    },
    "applyFill": {
      "type": "boolean"
    },
    "applyStroke": {
      "type": "boolean"
    },
    "baseline": {
      "type": "string"
    },
    "baselineShift": {
      "type": "number"
    },
    "box": {
      "description": "paragraph text, comp space",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "comp": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "description": "comp's item id as motion_inspect lists it",
          "type": "integer"
        },
        {
          "description": "the item id as receipts print it (\"1\"), or the comp's name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Item"
      ]
    },
    "composer": {
      "type": "string"
    },
    "direction": {
      "type": "string"
    },
    "edit": {
      "description": "start editing",
      "type": "boolean"
    },
    "fauxBold": {
      "type": "boolean"
    },
    "fauxItalic": {
      "type": "boolean"
    },
    "fill": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1)",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      ]
    },
    "font": {
      "type": "string"
    },
    "hScale": {
      "type": "number"
    },
    "hangingPunctuation": {
      "type": "boolean"
    },
    "indentFirst": {
      "type": "number"
    },
    "indentLeft": {
      "type": "number"
    },
    "indentRight": {
      "type": "number"
    },
    "justify": {
      "type": "string"
    },
    "kerning": {
      "oneOf": [
        {
          "enum": [
            "metrics",
            "optical"
          ],
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "leading": {
      "type": "number"
    },
    "ligatures": {
      "type": "boolean"
    },
    "name": {
      "description": "layer name; default the text",
      "type": "string"
    },
    "position": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "size": {
      "type": "number"
    },
    "smallCaps": {
      "type": "boolean"
    },
    "spaceAfter": {
      "type": "number"
    },
    "spaceBefore": {
      "type": "number"
    },
    "stroke": {
      "description": "a colour, \"#rrggbb\" or [r, g, b] (0 to 1)",
      "oneOf": [
        {
          "description": "#rrggbb",
          "type": "string"
        },
        {
          "description": "[r, g, b], 0 to 1",
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      ]
    },
    "strokeOverFill": {
      "type": "boolean"
    },
    "strokeWidth": {
      "type": "number"
    },
    "style": {
      "type": "string"
    },
    "subscript": {
      "type": "boolean"
    },
    "superscript": {
      "type": "boolean"
    },
    "text": {
      "type": "string"
    },
    "tracking": {
      "type": "number"
    },
    "tsume": {
      "type": "number"
    },
    "vScale": {
      "type": "number"
    },
    "vertical": {
      "type": "boolean"
    }
  },
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
