Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/validate-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Validate README

on:
workflow_dispatch:
pull_request:
paths:
- README.md

permissions:
contents: read
pull-requests: write

jobs:
validate-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: gravity-ui/readme-validator@v1
with:
type: package
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -629,5 +629,36 @@ server {
proxy_redirect off;
}
}

```

## License

Distributed under the MIT License. See [LICENSE](LICENSE) for details.

## For AI agents

A dashboard grid composer that arranges resizable, draggable widgets in a responsive grid via a plugin system — reach for it when you build a user-editable dashboard (add/move/resize/delete widgets) instead of placing individual charts or panels by hand.

### When to use

- Rendering a configurable dashboard where widgets are positioned, resized, and rearranged on a grid (built on `react-grid-layout`).
- User-editable layouts: adding/removing widgets from an action panel, drag-and-drop, edit mode with overlay controls.
- Plugin-based widgets where each widget type (title, text, chart, custom) is registered once and driven by a `config`.

### When not to use

- For a single, fixed chart or panel, use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/chartkit`](https://github.com/gravity-ui/chartkit) directly — the grid/plugin machinery is overhead for one widget.
- For a general-purpose responsive grid that is not a widget dashboard, use `react-grid-layout` directly.
- For embedding ChartKit-backed chart widgets inside a DashKit dashboard, DashKit is the shell; it still relies on [`@gravity-ui/chartkit`](https://github.com/gravity-ui/chartkit) to render the actual charts.

### Common pitfalls

- **Hallucinated component `<Dashboard>`** — the export is `<DashKit>` (the drag-and-drop shell is `<DashKitDnDWrapper>` wrapping `<DashKit>` + `<ActionPanel>`).
- **Mutating `config` instead of using helpers** — use the static `DashKit.setItem({...})` / `DashKit.removeItem({...})` helpers to add/change/remove items so layout and ids stay consistent.
- **Forgetting `DashKit.setSettings` / `DashKit.registerPlugins`** — the component must be configured (language, grid settings, plugin registration) before it is rendered, or widgets show nothing.
- **Confusing the two param props** — `defaultGlobalParams` (dashboard-level defaults) vs `globalParams` (URL-overridable globals); both flow into the params generation queue consumed by ChartKit.
- **Calling `onChange` manually with the `change` event** — when you `event.preventDefault()` in the experimental `change` handler, DashKit keeps the visual state internally; re-setting `config.layout` from props resets that baseline.

## Documentation for AI agents

Agent-readable documentation for the installed version is located in `node_modules/@gravity-ui/dashkit/build/docs/INDEX.md`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it valid link for this package?
We are already in @gravity-ui/dashkit/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is valid because the documentation will be stored in the compiled bundle.

13 changes: 13 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,26 @@ task('styles-components', () => {
.pipe(dest(path.resolve(BUILD_DIR, 'cjs')));
});

// Bundles the AI-facing docs tree (cleaned README overview) into build/docs so it ships
// in the npm tarball.
task('copy-docs', (done) => {
const {buildDocs} = require('@gravity-ui/readme-validator');
buildDocs({
rootDir: __dirname,
outDir: path.join(__dirname, 'build', 'docs'),
sources: [],
});
done();
});

task(
'build',
series([
'clean',
parallel(['compile-to-esm', 'compile-to-cjs']),
parallel(['copy-js-declarations', 'copy-i18n']),
'styles-components',
'copy-docs',
]),
);

Expand Down
Loading
Loading