---
title: "ktm dashboards edit-widget"
description: "Use ktm dashboards edit-widget to replace a widget's data from a JSON file or stdin while keeping its type unchanged."
sidebarTitle: "edit-widget"
lastUpdated: "2026-09-23"
---

> **For AI agents:** the complete documentation index is at [llms.txt](/llms.txt). Append `.md` to any page URL for its markdown version.

{/* GENERATED FILE: do not edit by hand. Regenerate with: node scripts/generate.mjs */}

Replace a widget's data from a JSON file or stdin

## Usage

```bash
ktm dashboards edit-widget <uid> <widget-id> [flags]
```

## Examples

```bash
# Edit widget from file
ktm dashboards edit-widget abc123 RandomID-xxx --json widget.json

# Pipe from stdin
cat updated.json | ktm dashboards edit-widget abc123 RandomID-xxx --json -
```

## Arguments

| Argument | Required |
| --- | --- |
| `uid` | Yes |
| `widget-id` | Yes |

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--json` | string |  | Widget JSON file path, or "-" for stdin (required) |

## Details

Update a widget's data section in a dashboard.

Provide the full updated data section as JSON (same format as add-widget).
The widget is identified by its ID within the dashboard layout.

The widget type cannot be changed — only data within the same type.
Validation runs before the update; placeholder values are rejected.

customDisplay: script changes must follow the IIFE pattern and 20KB limit.
Always show the full updated script to the user before applying.

## Related

- [`ktm dashboards`](/cli/commands/dashboards)

<Note>
  Global flags (`--output`, `--debug`, `--host`, …) apply to every command. See the [command reference overview](/cli/commands/overview).
</Note>

## What's next?

<Columns cols={2}>
  <Card title="All commands" icon="terminal" href="/cli/commands/overview">
    Browse the full CLI reference.
  </Card>
  <Card title="Get started" icon="rocket" href="/cli/getting-started">
    Install the CLI and authenticate.
  </Card>
</Columns>
