---
title: "text.fit: Fit text to its box — Design kit command — Kition"
description: "Shrinks the font of text layers so their text fits the box, within a minimum size and line limit."
canonical: "https://developer.kition.ai/docs/kits/design/commands/text.fit"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/design/commands/text.fit](https://developer.kition.ai/docs/kits/design/commands/text.fit)

# text.fit

**Fit text to its box.** Shrinks the font of text layers so their text fits the box, within a minimum size and line limit.

- Kit: Design 0.1.0 (.kdesign); reference: [Design kit commands](https://developer.kition.ai/docs/kits/design.md)
- Changes the document: yes
- Acts on: `ids` (a list of ids), which a run step’s `on` fills

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `ids` | `(integer \| string)[]` | no | text layers; default the selection |
| `maxLines` | `integer` | no |  |
| `minSize` | `number` | no |  |
| `orphans` | `boolean` | no |  |

## Call through design_run

```text
design_run {
  "path": "<file>.kdesign",
  "steps": [{ "command": "text.fit" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `ids`, `maxLines`, `minSize`, `orphans`. design_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": {
    "ids": {
      "description": "text layers; default the selection",
      "items": {
        "description": "an id",
        "oneOf": [
          {
            "type": "integer"
          },
          {
            "type": "string"
          }
        ]
      },
      "type": "array",
      "x-khp-types": [
        "Node"
      ]
    },
    "maxLines": {
      "type": "integer"
    },
    "minSize": {
      "type": "number"
    },
    "orphans": {
      "type": "boolean"
    }
  },
  "returns": "{fitted: [{id, fontSize, lines, fits, orphan}]}",
  "type": "object"
}
```

Generated from the command list of @kition/design-darwin-arm64@0.1.0 and the kit itself (design_commands through @kition/cli@0.1.1, built from KitionAI/kition-design@abc7e16).
