# Gravity UI Gravity UI is a open-source design system and ecosystem of React libraries for building web applications. This file is a compact catalog: pick a package, then fetch its per-package llms.txt for the full agent-facing docs. Read the user's `package.json` first and match the installed `@gravity-ui/*` versions — peer-version mismatches across the ecosystem are the most common failure. > **`@gravity-ui/uikit` MUST be installed in every Gravity UI project.** It is the base component and design-token library that every other `@gravity-ui/*` package builds on — without it, components render unstyled. Check the user's `package.json` first. > > **If it is not installed, stop and have the user install and configure it before doing anything else.** Setup and theming instructions: https://gravity-ui.com/llms/uikit/llms.txt > **Per-package docs are versioned.** Each package lives at `/llms///llms.txt` (exact version), `/llms///llms.txt` (latest of a major line), and `/llms//llms.txt` (latest). The links below point at `latest` — read the user's `package.json` and switch the URL to the installed version (or major) when it differs. > **Agent skill recommended.** A `gravity-ui` skill is available that helps route to the correct package and avoid common API mistakes. Consider installing it when working with Gravity UI: > > ```bash npx skills add gravity-ui/skills > ``` > > It can help with tasks involving `@gravity-ui/*` imports, `ThemeProvider`, or `--g-` CSS tokens. Details: https://github.com/gravity-ui/skills ## UIKit (primary) — `@gravity-ui/uikit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/uikit/llms.txt) > GitHub: [gravity-ui/uikit](https://github.com/gravity-ui/uikit) The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. #### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). #### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ## AIKit — `@gravity-ui/aikit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/aikit/llms.txt) > GitHub: [gravity-ui/aikit](https://github.com/gravity-ui/aikit) A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. #### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. #### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ## App Layout — `@gravity-ui/app-layout` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/app-layout/llms.txt) > GitHub: [gravity-ui/app-layout](https://github.com/gravity-ui/app-layout) HTML layout generator used in our SPA applications. ## Axios wrapper — `@gravity-ui/axios-wrapper` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/axios-wrapper/llms.txt) > GitHub: [gravity-ui/axios-wrapper](https://github.com/gravity-ui/axios-wrapper) Axios wrapper that provides automatic cancelling of concurrent requests. ## Babel Preset — `@gravity-ui/babel-preset` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/babel-preset/llms.txt) > GitHub: [gravity-ui/babel-preset](https://github.com/gravity-ui/babel-preset) Babel configuration preset for Gravity UI projects. ## Blog Constructor — `@gravity-ui/blog-constructor` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/blog-constructor/llms.txt) > GitHub: [gravity-ui/blog-constructor](https://github.com/gravity-ui/blog-constructor) A library based on the Page constructor library for creating blog-like services. ## Browserslist Config — `@gravity-ui/browserslist-config` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/browserslist-config/llms.txt) > GitHub: [gravity-ui/browserslist-config](https://github.com/gravity-ui/browserslist-config) Browserslist configuration preset used in our services. ## ChartKit — `@gravity-ui/chartkit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/chartkit/llms.txt) > GitHub: [gravity-ui/chartkit](https://github.com/gravity-ui/chartkit) A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. #### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. #### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ## Charts — `@gravity-ui/charts` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/charts/llms.txt) > GitHub: [gravity-ui/charts](https://github.com/gravity-ui/charts) A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. #### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. #### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ## DashKit — `@gravity-ui/dashkit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/dashkit/llms.txt) > GitHub: [gravity-ui/dashkit](https://github.com/gravity-ui/dashkit) 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. ## Data Source — `@gravity-ui/data-source` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/data-source/llms.txt) > GitHub: [gravity-ui/data-source](https://github.com/gravity-ui/data-source) A wrapper around data fetching. ## Date Components — `@gravity-ui/date-components` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/date-components/llms.txt) > GitHub: [gravity-ui/date-components](https://github.com/gravity-ui/date-components) React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. #### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. #### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ## Date Utils — `@gravity-ui/date-utils` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/date-utils/llms.txt) > GitHub: [gravity-ui/date-utils](https://github.com/gravity-ui/date-utils) Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. #### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. #### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ## Dialog Fields — `@gravity-ui/dialog-fields` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/dialog-fields/llms.txt) > GitHub: [gravity-ui/dialog-fields](https://github.com/gravity-ui/dialog-fields) A react-final-form wrapper that provides some useful high-level components for building forms. ## Dynamic Forms — `@gravity-ui/dynamic-forms` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/dynamic-forms/llms.txt) > GitHub: [gravity-ui/dynamic-forms](https://github.com/gravity-ui/dynamic-forms) Library for rendering neat and functional react forms described by JSON schema ## ESlint Config — `@gravity-ui/eslint-config` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/eslint-config/llms.txt) > GitHub: [gravity-ui/eslint-config](https://github.com/gravity-ui/eslint-config) ESLint configuration preset for Gravity UI projects. ## ExpressKit — `@gravity-ui/expresskit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/expresskit/llms.txt) > GitHub: [gravity-ui/expresskit](https://github.com/gravity-ui/expresskit) Lightweight express.js wrapper that integrates with NodeKit. ## Farm — `@gravity-ui/farm` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/farm/llms.txt) > GitHub: [gravity-ui/farm](https://github.com/gravity-ui/farm) Documentation for the Farm package. ## Graph — `@gravity-ui/graph` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/graph/llms.txt) > GitHub: [gravity-ui/graph](https://github.com/gravity-ui/graph) A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. #### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. #### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ## I18n — `@gravity-ui/i18n` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/i18n/llms.txt) > GitHub: [gravity-ui/i18n](https://github.com/gravity-ui/i18n) Internationalization helpers of Gravity UI projects. ## Icons — `@gravity-ui/icons` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/icons/llms.txt) > GitHub: [gravity-ui/icons](https://github.com/gravity-ui/icons) The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. #### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. #### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ## Illustrations — `@gravity-ui/illustrations` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/illustrations/llms.txt) > GitHub: [gravity-ui/illustrations](https://github.com/gravity-ui/illustrations) A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons. #### When to use - Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control. - Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables. - Importing artwork as React components (default) or as raw `.svg` files. #### When not to use - For functional UI iconography (chevrons, checks, buttons), use [`@gravity-ui/icons`](https://gravity-ui.com/icons) — illustrations are decorative artwork, not UI glyphs. - For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package. ## Markdown editor — `@gravity-ui/markdown-editor` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/markdown-editor/llms.txt) > GitHub: [gravity-ui/markdown-editor](https://github.com/gravity-ui/markdown-editor) A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. #### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. #### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ## Navigation — `@gravity-ui/navigation` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/navigation/llms.txt) > GitHub: [gravity-ui/navigation](https://github.com/gravity-ui/navigation) Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. #### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. #### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ## NodeKit — `@gravity-ui/nodekit` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/nodekit/llms.txt) > GitHub: [gravity-ui/nodekit](https://github.com/gravity-ui/nodekit) A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. #### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. #### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ## Page constructor — `@gravity-ui/page-constructor` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/page-constructor/llms.txt) > GitHub: [gravity-ui/page-constructor](https://github.com/gravity-ui/page-constructor) A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. #### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. #### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ## Page-constructor-builder — `@gravity-ui/page-constructor-builder` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/page-constructor-builder/llms.txt) > GitHub: [gravity-ui/page-constructor-builder](https://github.com/gravity-ui/page-constructor-builder) A powerful command-line utility for building static pages from YAML configurations ## Playwright Tools — `@gravity-ui/playwright-tools` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/playwright-tools/llms.txt) > GitHub: [gravity-ui/playwright-tools](https://github.com/gravity-ui/playwright-tools) A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. ## Prettier Config — `@gravity-ui/prettier-config` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/prettier-config/llms.txt) > GitHub: [gravity-ui/prettier-config](https://github.com/gravity-ui/prettier-config) Prettier configuration preset for Gravity UI projects. ## Stylelint Config — `@gravity-ui/stylelint-config` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/stylelint-config/llms.txt) > GitHub: [gravity-ui/stylelint-config](https://github.com/gravity-ui/stylelint-config) Stylelint configuration preset for Gravity UI projects. ## Table — `@gravity-ui/table` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/table/llms.txt) > GitHub: [gravity-ui/table](https://github.com/gravity-ui/table) A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. #### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. #### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ## Timeline — `@gravity-ui/timeline` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/timeline/llms.txt) > GitHub: [gravity-ui/timeline](https://github.com/gravity-ui/timeline) A React-based library for building interactive timeline visualizations with canvas rendering. ## TSconfig — `@gravity-ui/tsconfig` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/tsconfig/llms.txt) > GitHub: [gravity-ui/tsconfig](https://github.com/gravity-ui/tsconfig) TypeScript compiler configuration preset for Gravity UI projects. ## Webpack i18n plugin — `@gravity-ui/webpack-i18n-assets-plugin` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/webpack-i18n-assets-plugin/llms.txt) > GitHub: [gravity-ui/webpack-i18n-assets-plugin](https://github.com/gravity-ui/webpack-i18n-assets-plugin) A plugin for Webpack that replaces calls to localization functions (i18n) with target texts. ## Yagr — `@gravity-ui/yagr` > If you need this library, read more at package [llms.txt](https://gravity-ui.com/llms/yagr/llms.txt) > GitHub: [gravity-ui/yagr](https://github.com/gravity-ui/yagr) A high-performance canvas charts renderer, based on uPlot. --- > Generated for `@gravity-ui/uikit@7.48.0` # @gravity-ui/uikit documentation Documentation for the **7.48.0** version of `@gravity-ui/uikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/uikit/build/docs/`). ## For AI agents The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/layout.md) - [Theming, Colors & Branding](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/theming.md) - [Typography](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/typography.md) ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@types/react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS mixins file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/i18n.md) — set the built-in component language ## Guides - [Internationalization (I18N)](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/i18n.md) — English | Русский - [Layout components and spacings](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/layout.md) — This guide covers UIKit's layout foundations: a shared spacing scale (--g-spacing-*, used everywhere via tokens and props) and a responsive grid (Container/Row/Col), plus the flexbox-based Flex/Box primitives built on top of them. Compose pages from these instead of raw divs and inline styles. - [Server-Side Rendering](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/server-side-rendering.md) — English | Русский - [Theming, Colors & Branding](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/theming.md) — English | Русский - [Typography](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/typography.md) — UIKit's type scale is a fixed set of text variants, each with predefined font-size and line-height. Render text with the Text component and a variant — not raw

/

tags or inline font-size. This keeps sizing consistent and theme-aware across the app. - [Интернационализация (I18N)](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/i18n-ru.md) — English | Русский - [Серверный рендеринг (SSR)](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/server-side-rendering-ru.md) — English | Русский - [Темизация](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/guides/theming-ru.md) — English | Русский ## Components - [Accordion](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Accordion.md) — The Accordion component allows you to create collapsible content panels where users can show or hide sections of information. This is useful for organizing large amounts of content in a compact way. - [ActionsPanel](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/ActionsPanel.md) — Use an ActionsPanel to render multiple buttons in a row. When there is not enough space, buttons that don't fit will be added to an overflow menu. - [ActionTooltip](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/ActionTooltip.md) — Tooltip for labeling action buttons without descriptive text (e.g. icon buttons). - [Alert](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Alert.md) — The Alert component displays a prominent message to draw the user's attention to important information. - [ArrowToggle](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/ArrowToggle.md) — ArrowToggle is a component for displaying the chevron icon. It can rotate in four directions and can be used to display drop-down lists, cut components, etc. - [Avatar](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Avatar.md) — This component is intended for rendering avatars. It has three basic avatar types: image, icon, and text (name initials). All these types have special properties to configure the behavior and appearance. - [AvatarStack](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/AvatarStack.md) — This component is used for a stack of images with overlap over one another and, optionally, a control. It usually refers to user avatars. - [Breadcrumbs](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Breadcrumbs.md) — Breadcrumbs is a navigation element that shows the current location of a page within a website’s hierarchy. It provides links that allow users to return to higher levels in the hierarchy, making it easier to navigate through a website with multiple layers. Breadcrumbs are especially useful for large websites and applications with hierarchy-based structure of pages. - [Button](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Button.md) — Buttons act as a trigger for certain actions. While this is their main purpose, in some very rare cases, they can be used as links to navigate to other pages. - [Card](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Card.md) — Card is a reusable React component that basically is a card-like container with customizable styles and features. It is used to display information or content in a visually appealing and well-organized manner. - [Checkbox](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Checkbox.md) — The Checkbox component allows the user to select or deselect a specific value. - [ClipboardButton](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/ClipboardButton.md) — ClipboardButton is a ready-made button that copies given text to the clipboard and plays a success animation. It combines CopyToClipboard (the copy behavior) with ClipboardIcon (the animated icon). - [ClipboardIcon](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/ClipboardIcon.md) — ClipboardIcon is an animated copy icon that reflects the copy state (idle or success); it is meant to sit inside CopyToClipboard or ClipboardButton rather than be used on its own. - [controls/PasswordInput](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/controls/PasswordInput.md) - [controls/TextArea](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/controls/TextArea.md) - [controls/TextInput](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/controls/TextInput.md) - [CopyToClipboard](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/CopyToClipboard.md) — CopyToClipboard is a render-prop wrapper that copies text to the clipboard and exposes the copy status to its child, letting you render your own trigger; for a ready-made button use ClipboardButton. - [DefinitionList](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/DefinitionList.md) — The component to display definition list with term and definition separated by dots. - [Dialog](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Dialog.md) — Dialog is a modal window with a title, body, and footer actions, used for confirmations, forms, and prompts. It is built on top of Modal. - [Disclosure](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Disclosure.md) — Disclosure is a collapsible component that allows to display and hide its nested content. - [Divider](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Divider.md) — The Divider component is used as a thin line for delimiting and grouping elements to reinforce visual hierarchy. - [Drawer](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Drawer.md) — The Drawer component is a versatile interface element used in web applications to provide a sliding panel that emerges from the edge of the screen. This panel can house navigations, tools, or additional content. The component is implemented using React and CSS transitions for smooth animations. - [DropdownMenu](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/DropdownMenu.md) — The dropdown menu component provides item grouping, submenus, and a customizable toggle. The dropdown menu items are configured with the items property. By default, the menu toggle is a button with the ellipsis icon (⋯), which can be overridden with the renderSwitcher property. - [FilePreview](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/FilePreview.md) — FilePreview is a compact preview card for a single file, showing a thumbnail or file-type icon with the file name and optional actions. - [HelpMark](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/HelpMark.md) — A help icon that reveals contextual information in a popover on hover or click. Ideal for showing tips, explanations, or supporting content without taking up extra space in the interface. - [Hotkey](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Hotkey.md) — You can use the Hotkey component to display keyboard shortcuts for both Mac and PC. - [Icon](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Icon.md) — Icon renders an SVG glyph at a given size and color, taking the SVG as a React component or an imported asset. It serves as a single proxy for using SVGs across the codebase, which can be loaded through a React component or Webpack loaders such as SVGR, svg-react-loader, svg-inline-loader, or svg-sprite-loader. - [lab/ColorPicker](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/lab/ColorPicker.md) - [lab/FileDropZone](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/lab/FileDropZone.md) - [lab/Menu](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/lab/Menu.md) - [Label](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Label.md) — You can use Labels for highlighting certain information. A Label with the Close or Copy button may be useful for various simple actions. - [Link](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Link.md) — Link is a part of text that, when clicked, takes the user to another part of the page, another page within the service, or an external website page. - [List](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/List.md) — The List component renders a filterable, sortable, and virtualized list of items with support for custom rendering and keyboard navigation. - [Loader](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Loader.md) — The Loader component displays the loading progress as flashing bars. Unlike Spin, this component is used in global scenarios, e.g., for an entire page or Dialog. - [Menu](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Menu.md) — The Menu component enables easily creating views for action lists. - [Modal](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Modal.md) — The Modal component serves as base for creating pop-up windows with a backdrop above the rest of the content on a page. It disables scrolling while opening and manages focus for content. The Modal child components are rendered inside the Portal component. With Modal, you can implement dialogs, alerts, confirmations, and more. - [NumberInput](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/NumberInput.md) — NumberInput is a text field for entering numeric values, with optional stepper controls, min/max bounds, and value formatting. - [Overlay](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Overlay.md) — The Overlay component renders an overlay over the parent element with the relative position, i.e., the parent element must have position set to relative. For example, it can be used to preserve the desired layout while loading data. - [Pagination](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Pagination.md) — Pagination renders page-navigation controls — page numbers with previous/next buttons and an optional page-size selector — used for splitting long lists or tables across pages. - [Palette](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Palette.md) — The Palette component is used to display a grid of icons, emojis, reactions, and symbols which you can select or deselect. - [PinInput](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/PinInput.md) — PinInput is a group of inputs to enter sequence of numeric or alphanumeric values quickly. Its most common use case is entering OTP or confirmation codes received through text messages (SMS), emails, or authenticator apps. - [PlaceholderContainer](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/PlaceholderContainer.md) — PlaceholderContainer is a component for displaying content with an image, text content, and action controls. - [Popover](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Popover.md) — Popover shows floating, optionally interactive content (text, links, or buttons) anchored to a child element and opened on hover or click. It wraps Popup with built-in trigger interactivity, using the ReactElement passed via the children property as the trigger. - [Popup](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Popup.md) — Popup positions floating content above the page, anchored to a reference element — the low-level primitive behind tooltips, popovers, and menus, built on Floating UI. Its visibility is controlled with the open property; its children render inside the Portal component unless you set the disablePortal property. - [Portal](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Portal.md) — Portal is a utility component. Basically, it is a simple wrapper around React's createPortal that allows you to render children into a DOM node outside the parent component. - [Progress](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Progress.md) — The Progress component shows current operation progress. It can also be divided into sections. - [Radio](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Radio.md) — The Radio component allows the users to select a single option from a list of choices. - [RadioGroup](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/RadioGroup.md) — The RadioGroup component is used to create a group where users can select a single option from multiple choices. - [SegmentedRadioGroup](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/SegmentedRadioGroup.md) — The SegmentedRadioGroup component is used to create a group of radio buttons where users can select a single option from multiple choices. - [Select](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Select.md) — Select is a control that provides a list of options that a user can select. - [Select/hooks-public/useSelectOptions](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Select/hooks-public/useSelectOptions.md) — The useSelectOptions hook that helps to manage options data before passing into Select component. It could be handy in case of options management outside the component. - [Sheet](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Sheet.md) — Sheet is a component designed for using in the mobile context as an information or interactive element. You can place content of any size in it, since the internal scrolling and dynamic resizing are supported. - [Skeleton](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Skeleton.md) — The Skeleton component displays a placeholder preview of your content before the data gets loaded. This preview is shown in order to reduce the loading time frustration. - [Slider](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Slider.md) — The slider is a customizable and responsive React component that allows users to select a single value or a range of values from a specified data set. - [Spin](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Spin.md) — The Spin component displays the loading state (a rotating semicircle) in inline scenarios. Unlike Loader, this component is used to display the loading state in inline scenarios, e.g., in a Button or Label. - [Stepper](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Stepper.md) — Stepper guides users through a sequence of numbered steps, showing progress in a wizard-like, multi-step workflow. - [Switch](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Switch.md) — The Switch component is used to toggle between two states: typically, between on and off, or enabled and disabled. - [Table](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Table.md) — A Table allows selecting and sorting rows, as well as performing actions on a row. - [TableColumnSetup](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/TableColumnSetup.md) — The TableColumnSetup component provides a user interface for configuring table column visibility and order. It displays a button that opens a popup with a list of available columns, allowing users to show/hide columns and optionally reorder them via drag and drop. - [tabs](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/tabs.md) — Tabs components is used to explore, organize content and switch between different views. - [Text](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Text.md) — The Text component applies typography styles such as font variant, color, and text overflow handling to its content. - [Toaster](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Toaster.md) — This is a component for adjustable notifications also known as toasts. - [Toc](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Toc.md) — The Toc component is designed to display a table of contents of the page, namely showing a set items with two levels of hierarchy. - [Tooltip](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/Tooltip.md) — A simple text tip that uses its child node as an anchor. This component accepts only text content and may be an excellent alternative to the browser's title attribute with its small size and long appearance delay. - [User](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/User.md) — This is a general component for displaying a user avatar with an info block. It uses the Avatar component to render the avatar. It can also accept a custom React node as an avatar. - [UserLabel](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/components/UserLabel.md) — UserLabel is a compact chip with a user's avatar and name or email, suited for inline mentions and lists (use User for a larger profile block and Avatar for the picture alone). ## Hooks - [lab/useDropZone](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/lab/useDropZone.md) - [useActionHandlers](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useActionHandlers.md) - [useAsyncActionHandler](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useAsyncActionHandler.md) - [useCollapseChildren](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useCollapseChildren.md) - [useColorGenerator](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useColorGenerator.md) - [useControlledState](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useControlledState.md) - [useFileInput](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useFileInput.md) - [useFocusWithin](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useFocusWithin.md) - [useForkRef](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useForkRef.md) - [useIntersection](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useIntersection.md) - [useListNavigation](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useListNavigation.md) - [useOutsideClick](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useOutsideClick.md) - [usePortalContainer](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/usePortalContainer.md) - [useResizeObserver](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useResizeObserver.md) - [useSelect](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useSelect.md) - [useTimeout](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useTimeout.md) - [useUniqId](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useUniqId.md) - [useViewportSize](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useViewportSize.md) - [useVirtualElementRef](https://unpkg.com/@gravity-ui/uikit@7.48.0/build/docs/hooks/useVirtualElementRef.md) --- > Docs for `@gravity-ui/uikit@7.48.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.48.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.47.0` # @gravity-ui/uikit documentation Documentation for the **7.47.0** version of `@gravity-ui/uikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/uikit/build/docs/`). ## For AI agents The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/layout.md) - [Theming, Colors & Branding](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/theming.md) - [Typography](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/typography.md) ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@types/react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS mixins file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/i18n.md) — set the built-in component language ## Guides - [Internationalization (I18N)](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/i18n.md) — English | Русский - [Layout components and spacings](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/layout.md) — This guide covers UIKit's layout foundations: a shared spacing scale (--g-spacing-*, used everywhere via tokens and props) and a responsive grid (Container/Row/Col), plus the flexbox-based Flex/Box primitives built on top of them. Compose pages from these instead of raw divs and inline styles. - [Server-Side Rendering](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/server-side-rendering.md) — English | Русский - [Theming, Colors & Branding](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/theming.md) — English | Русский - [Typography](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/typography.md) — UIKit's type scale is a fixed set of text variants, each with predefined font-size and line-height. Render text with the Text component and a variant — not raw

/

tags or inline font-size. This keeps sizing consistent and theme-aware across the app. - [Интернационализация (I18N)](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/i18n-ru.md) — English | Русский - [Серверный рендеринг (SSR)](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/server-side-rendering-ru.md) — English | Русский - [Темизация](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/guides/theming-ru.md) — English | Русский ## Components - [Accordion](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Accordion.md) — The Accordion component allows you to create collapsible content panels where users can show or hide sections of information. This is useful for organizing large amounts of content in a compact way. - [ActionsPanel](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/ActionsPanel.md) — Use an ActionsPanel to render multiple buttons in a row. When there is not enough space, buttons that don't fit will be added to an overflow menu. - [ActionTooltip](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/ActionTooltip.md) — Tooltip for labeling action buttons without descriptive text (e.g. icon buttons). - [Alert](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Alert.md) — The Alert component displays a prominent message to draw the user's attention to important information. - [ArrowToggle](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/ArrowToggle.md) — ArrowToggle is a component for displaying the chevron icon. It can rotate in four directions and can be used to display drop-down lists, cut components, etc. - [Avatar](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Avatar.md) — This component is intended for rendering avatars. It has three basic avatar types: image, icon, and text (name initials). All these types have special properties to configure the behavior and appearance. - [AvatarStack](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/AvatarStack.md) — This component is used for a stack of images with overlap over one another and, optionally, a control. It usually refers to user avatars. - [Breadcrumbs](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Breadcrumbs.md) — Breadcrumbs is a navigation element that shows the current location of a page within a website’s hierarchy. It provides links that allow users to return to higher levels in the hierarchy, making it easier to navigate through a website with multiple layers. Breadcrumbs are especially useful for large websites and applications with hierarchy-based structure of pages. - [Button](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Button.md) — Buttons act as a trigger for certain actions. While this is their main purpose, in some very rare cases, they can be used as links to navigate to other pages. - [Card](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Card.md) — Card is a reusable React component that basically is a card-like container with customizable styles and features. It is used to display information or content in a visually appealing and well-organized manner. - [Checkbox](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Checkbox.md) — The Checkbox component allows the user to select or deselect a specific value. - [ClipboardButton](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/ClipboardButton.md) — ClipboardButton is a ready-made button that copies given text to the clipboard and plays a success animation. It combines CopyToClipboard (the copy behavior) with ClipboardIcon (the animated icon). - [ClipboardIcon](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/ClipboardIcon.md) — ClipboardIcon is an animated copy icon that reflects the copy state (idle or success); it is meant to sit inside CopyToClipboard or ClipboardButton rather than be used on its own. - [controls/PasswordInput](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/controls/PasswordInput.md) - [controls/TextArea](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/controls/TextArea.md) - [controls/TextInput](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/controls/TextInput.md) - [CopyToClipboard](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/CopyToClipboard.md) — CopyToClipboard is a render-prop wrapper that copies text to the clipboard and exposes the copy status to its child, letting you render your own trigger; for a ready-made button use ClipboardButton. - [DefinitionList](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/DefinitionList.md) — The component to display definition list with term and definition separated by dots. - [Dialog](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Dialog.md) — Dialog is a modal window with a title, body, and footer actions, used for confirmations, forms, and prompts. It is built on top of Modal. - [Disclosure](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Disclosure.md) — Disclosure is a collapsible component that allows to display and hide its nested content. - [Divider](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Divider.md) — The Divider component is used as a thin line for delimiting and grouping elements to reinforce visual hierarchy. - [Drawer](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Drawer.md) — The Drawer component is a versatile interface element used in web applications to provide a sliding panel that emerges from the edge of the screen. This panel can house navigations, tools, or additional content. The component is implemented using React and CSS transitions for smooth animations. - [DropdownMenu](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/DropdownMenu.md) — The dropdown menu component provides item grouping, submenus, and a customizable toggle. The dropdown menu items are configured with the items property. By default, the menu toggle is a button with the ellipsis icon (⋯), which can be overridden with the renderSwitcher property. - [FilePreview](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/FilePreview.md) — FilePreview is a compact preview card for a single file, showing a thumbnail or file-type icon with the file name and optional actions. - [HelpMark](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/HelpMark.md) — A help icon that reveals contextual information in a popover on hover or click. Ideal for showing tips, explanations, or supporting content without taking up extra space in the interface. - [Hotkey](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Hotkey.md) — You can use the Hotkey component to display keyboard shortcuts for both Mac and PC. - [Icon](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Icon.md) — Icon renders an SVG glyph at a given size and color, taking the SVG as a React component or an imported asset. It serves as a single proxy for using SVGs across the codebase, which can be loaded through a React component or Webpack loaders such as SVGR, svg-react-loader, svg-inline-loader, or svg-sprite-loader. - [lab/ColorPicker](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/lab/ColorPicker.md) - [lab/FileDropZone](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/lab/FileDropZone.md) - [lab/Menu](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/lab/Menu.md) - [Label](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Label.md) — You can use Labels for highlighting certain information. A Label with the Close or Copy button may be useful for various simple actions. - [Link](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Link.md) — Link is a part of text that, when clicked, takes the user to another part of the page, another page within the service, or an external website page. - [List](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/List.md) — The List component renders a filterable, sortable, and virtualized list of items with support for custom rendering and keyboard navigation. - [Loader](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Loader.md) — The Loader component displays the loading progress as flashing bars. Unlike Spin, this component is used in global scenarios, e.g., for an entire page or Dialog. - [Menu](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Menu.md) — The Menu component enables easily creating views for action lists. - [Modal](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Modal.md) — The Modal component serves as base for creating pop-up windows with a backdrop above the rest of the content on a page. It disables scrolling while opening and manages focus for content. The Modal child components are rendered inside the Portal component. With Modal, you can implement dialogs, alerts, confirmations, and more. - [NumberInput](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/NumberInput.md) — NumberInput is a text field for entering numeric values, with optional stepper controls, min/max bounds, and value formatting. - [Overlay](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Overlay.md) — The Overlay component renders an overlay over the parent element with the relative position, i.e., the parent element must have position set to relative. For example, it can be used to preserve the desired layout while loading data. - [Pagination](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Pagination.md) — Pagination renders page-navigation controls — page numbers with previous/next buttons and an optional page-size selector — used for splitting long lists or tables across pages. - [Palette](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Palette.md) — The Palette component is used to display a grid of icons, emojis, reactions, and symbols which you can select or deselect. - [PinInput](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/PinInput.md) — PinInput is a group of inputs to enter sequence of numeric or alphanumeric values quickly. Its most common use case is entering OTP or confirmation codes received through text messages (SMS), emails, or authenticator apps. - [PlaceholderContainer](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/PlaceholderContainer.md) — PlaceholderContainer is a component for displaying content with an image, text content, and action controls. - [Popover](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Popover.md) — Popover shows floating, optionally interactive content (text, links, or buttons) anchored to a child element and opened on hover or click. It wraps Popup with built-in trigger interactivity, using the ReactElement passed via the children property as the trigger. - [Popup](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Popup.md) — Popup positions floating content above the page, anchored to a reference element — the low-level primitive behind tooltips, popovers, and menus, built on Floating UI. Its visibility is controlled with the open property; its children render inside the Portal component unless you set the disablePortal property. - [Portal](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Portal.md) — Portal is a utility component. Basically, it is a simple wrapper around React's createPortal that allows you to render children into a DOM node outside the parent component. - [Progress](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Progress.md) — The Progress component shows current operation progress. It can also be divided into sections. - [Radio](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Radio.md) — The Radio component allows the users to select a single option from a list of choices. - [RadioGroup](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/RadioGroup.md) — The RadioGroup component is used to create a group where users can select a single option from multiple choices. - [SegmentedRadioGroup](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/SegmentedRadioGroup.md) — The SegmentedRadioGroup component is used to create a group of radio buttons where users can select a single option from multiple choices. - [Select](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Select.md) — Select is a control that provides a list of options that a user can select. - [Select/hooks-public/useSelectOptions](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Select/hooks-public/useSelectOptions.md) — The useSelectOptions hook that helps to manage options data before passing into Select component. It could be handy in case of options management outside the component. - [Sheet](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Sheet.md) — Sheet is a component designed for using in the mobile context as an information or interactive element. You can place content of any size in it, since the internal scrolling and dynamic resizing are supported. - [Skeleton](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Skeleton.md) — The Skeleton component displays a placeholder preview of your content before the data gets loaded. This preview is shown in order to reduce the loading time frustration. - [Slider](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Slider.md) — The slider is a customizable and responsive React component that allows users to select a single value or a range of values from a specified data set. - [Spin](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Spin.md) — The Spin component displays the loading state (a rotating semicircle) in inline scenarios. Unlike Loader, this component is used to display the loading state in inline scenarios, e.g., in a Button or Label. - [Stepper](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Stepper.md) — Stepper guides users through a sequence of numbered steps, showing progress in a wizard-like, multi-step workflow. - [Switch](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Switch.md) — The Switch component is used to toggle between two states: typically, between on and off, or enabled and disabled. - [Table](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Table.md) — A Table allows selecting and sorting rows, as well as performing actions on a row. - [TableColumnSetup](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/TableColumnSetup.md) — The TableColumnSetup component provides a user interface for configuring table column visibility and order. It displays a button that opens a popup with a list of available columns, allowing users to show/hide columns and optionally reorder them via drag and drop. - [tabs](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/tabs.md) — Tabs components is used to explore, organize content and switch between different views. - [Text](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Text.md) — The Text component applies typography styles such as font variant, color, and text overflow handling to its content. - [Toaster](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Toaster.md) — This is a component for adjustable notifications also known as toasts. - [Toc](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Toc.md) — The Toc component is designed to display a table of contents of the page, namely showing a set items with two levels of hierarchy. - [Tooltip](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/Tooltip.md) — A simple text tip that uses its child node as an anchor. This component accepts only text content and may be an excellent alternative to the browser's title attribute with its small size and long appearance delay. - [User](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/User.md) — This is a general component for displaying a user avatar with an info block. It uses the Avatar component to render the avatar. It can also accept a custom React node as an avatar. - [UserLabel](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/components/UserLabel.md) — UserLabel is a compact chip with a user's avatar and name or email, suited for inline mentions and lists (use User for a larger profile block and Avatar for the picture alone). ## Hooks - [lab/useDropZone](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/lab/useDropZone.md) - [useActionHandlers](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useActionHandlers.md) - [useAsyncActionHandler](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useAsyncActionHandler.md) - [useCollapseChildren](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useCollapseChildren.md) - [useColorGenerator](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useColorGenerator.md) - [useControlledState](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useControlledState.md) - [useFileInput](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useFileInput.md) - [useFocusWithin](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useFocusWithin.md) - [useForkRef](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useForkRef.md) - [useIntersection](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useIntersection.md) - [useListNavigation](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useListNavigation.md) - [useOutsideClick](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useOutsideClick.md) - [usePortalContainer](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/usePortalContainer.md) - [useResizeObserver](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useResizeObserver.md) - [useSelect](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useSelect.md) - [useTimeout](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useTimeout.md) - [useUniqId](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useUniqId.md) - [useViewportSize](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useViewportSize.md) - [useVirtualElementRef](https://unpkg.com/@gravity-ui/uikit@7.47.0/build/docs/hooks/useVirtualElementRef.md) --- > Docs for `@gravity-ui/uikit@7.47.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.47.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.46.0` # @gravity-ui/uikit documentation Documentation for the **7.46.0** version of `@gravity-ui/uikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/uikit/build/docs/`). ## For AI agents The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](https://unpkg.com/@gravity-ui/uikit@7.46.0/build/docs/guides/layout.md) - [Theming, Colors & Branding](https://unpkg.com/@gravity-ui/uikit@7.46.0/build/docs/guides/theming.md) - [Typography](https://unpkg.com/@gravity-ui/uikit@7.46.0/build/docs/guides/typography.md) ## Install ```shell npm install --save-dev @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.44.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.44.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.43.0` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.43.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.43.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.42.0` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.42.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.42.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.41.0` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.41.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.41.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.40.0` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.40.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.40.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@7.39.0` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@7.39.0`. Versioned at: `https://gravity-ui.com/llms/uikit/7.39.0/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/uikit@6.43.4` # UIKit > The base React component and design-token library for Gravity UI apps — controls, inputs, overlays, layout, and theming that every other @gravity-ui package builds on. > > **npm:** `@gravity-ui/uikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Prerequisites React 16.14, 17, 18, or 19 must be installed in your project. Import components directly from the package: ```jsx import {Button} from '@gravity-ui/uikit'; const SubmitButton = ( ); ``` ### Styles Include the base styles and fonts once at the top of your app entry point: ```js // index.js import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` A SCSS [mixins](styles/mixins.scss) file with useful helpers is also available for use in your own stylesheets. ### Guides Read more: - [Theming](docs/theming.md) — enable light, dark, and high-contrast themes - [Server-side rendering](docs/server-side-rendering.md) — generate the root CSS class on the server - [Internationalization](docs/i18n.md) — set the built-in component language ### When to use - Standard application UI: buttons, form controls, modals and popups, menus, tabs, labels, typography, and layout primitives. - The theming foundation of a Gravity UI app: `ThemeProvider`, design tokens, and CSS variables the rest of the `@gravity-ui/*` ecosystem expects to be present. - Simple tabular data via the built-in `Table` component (selection, sorting, row actions). ### When not to use - Feature-rich data grids (virtualization, column resizing, grouping, reordering) — use [`@gravity-ui/table`](https://github.com/gravity-ui/table), a separate headless package. It is **not** the same as uikit's `Table` component. - Charts and data visualization — use [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (`@gravity-ui/chartkit` is the legacy wrapper). - Application navigation shells (aside header, footer, logo) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation). - Date pickers, calendars, and range controls — use [`@gravity-ui/date-components`](https://github.com/gravity-ui/date-components). - The SVG icon set itself — use [`@gravity-ui/icons`](https://github.com/gravity-ui/icons); uikit only ships the `Icon` renderer. ### Common pitfalls - `Button` styling prop is `view`, not `variant` or `color` - **Components render unstyled without setup.** Wrap the app in `ThemeProvider` **and** import `@gravity-ui/uikit/styles/styles.css` (plus `fonts.css`) once at the entry point — both are required. - **`Icon` has no `name` prop.** Pass an imported icon component through `data`: `import {Gear} from '@gravity-ui/icons'; `. - **`theme` values are `light | dark | light-hc | dark-hc`.** There is no `theme="default"`. ### Useful docs - [Layout components and spacings](./docs/layout.md) - [Theming, Colors & Branding](./docs/theming.md) - [Typography](./docs/typography.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/uikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/uikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/uikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/uikit) --- > Docs for `@gravity-ui/uikit@6.43.4`. Versioned at: `https://gravity-ui.com/llms/uikit/6.43.4/llms.txt` (exact), `https://gravity-ui.com/llms/uikit/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/uikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.46.0` # @gravity-ui/markdown-editor documentation Documentation for the **15.46.0** version of `@gravity-ui/markdown-editor`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/markdown-editor/build/docs/`). ## For AI agents A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/latex-extension` | `^1.0.3 || ^2.0.0` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `highlight.js` | `^11.8.0` | | `katex` | `^0.16.9` | | `lowlight` | `^3.0.0` | | `markdown-it` | `^13.0.0` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ## Guides - [guidelines-contributions](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/guidelines-contributions.md) - [how-to-add-editor-with-create-react-app](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-add-editor-with-create-react-app.md) - [how-to-add-editor-with-nextjs](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-add-editor-with-nextjs.md) - [how-to-add-preview](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-add-preview.md) - [how-to-add-text-binding-extension-in-markdown](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-add-text-binding-extension-in-markdown.md) - [how-to-connect-gpt-extensions](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-connect-gpt-extensions.md) - [how-to-connect-html-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-connect-html-extension.md) - [how-to-connect-latex-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-connect-latex-extension.md) - [how-to-connect-mermaid-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-connect-mermaid-extension.md) - [how-to-create-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-create-extension.md) - [how-to-customize-the-editor](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-customize-the-editor.md) - [how-to-customize-toolbars](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-customize-toolbars.md) - [Visual Testing with Playwright](https://unpkg.com/@gravity-ui/markdown-editor@15.46.0/build/docs/guides/how-to-add-visual-test.md) --- > Docs for `@gravity-ui/markdown-editor@15.46.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.46.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.45.0` # @gravity-ui/markdown-editor documentation Documentation for the **15.45.0** version of `@gravity-ui/markdown-editor`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/markdown-editor/build/docs/`). ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ## Guides - [guidelines-contributions](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/guidelines-contributions.md) - [how-to-add-editor-with-create-react-app](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-add-editor-with-create-react-app.md) - [how-to-add-editor-with-nextjs](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-add-editor-with-nextjs.md) - [how-to-add-preview](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-add-preview.md) - [how-to-add-text-binding-extension-in-markdown](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-add-text-binding-extension-in-markdown.md) - [how-to-connect-gpt-extensions](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-connect-gpt-extensions.md) - [how-to-connect-html-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-connect-html-extension.md) - [how-to-connect-latex-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-connect-latex-extension.md) - [how-to-connect-mermaid-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-connect-mermaid-extension.md) - [how-to-create-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-create-extension.md) - [how-to-customize-the-editor](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-customize-the-editor.md) - [how-to-customize-toolbars](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-customize-toolbars.md) - [Visual Testing with Playwright](https://unpkg.com/@gravity-ui/markdown-editor@15.45.0/build/docs/guides/how-to-add-visual-test.md) --- > Docs for `@gravity-ui/markdown-editor@15.45.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.45.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.44.0` # @gravity-ui/markdown-editor documentation Documentation for the **15.44.0** version of `@gravity-ui/markdown-editor`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/markdown-editor/build/docs/`). ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ## Guides - [guidelines-contributions](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/guidelines-contributions.md) - [how-to-add-editor-with-create-react-app](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-add-editor-with-create-react-app.md) - [how-to-add-editor-with-nextjs](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-add-editor-with-nextjs.md) - [how-to-add-preview](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-add-preview.md) - [how-to-add-text-binding-extension-in-markdown](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-add-text-binding-extension-in-markdown.md) - [how-to-connect-gpt-extensions](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-connect-gpt-extensions.md) - [how-to-connect-html-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-connect-html-extension.md) - [how-to-connect-latex-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-connect-latex-extension.md) - [how-to-connect-mermaid-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-connect-mermaid-extension.md) - [how-to-create-extension](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-create-extension.md) - [how-to-customize-the-editor](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-customize-the-editor.md) - [how-to-customize-toolbars](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-customize-toolbars.md) - [Visual Testing with Playwright](https://unpkg.com/@gravity-ui/markdown-editor@15.44.0/build/docs/guides/how-to-add-visual-test.md) --- > Docs for `@gravity-ui/markdown-editor@15.44.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.44.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.43.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.43.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.43.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.42.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.42.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.42.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.41.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.41.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.41.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.40.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.40.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.40.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.39.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.39.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.39.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.38.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.38.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.38.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@15.37.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^7.1.0` | | `@diplodoc/transform` | `^4.43.0` | | `@gravity-ui/components` | `^4.10.0` | | `@diplodoc/cut-extension` | `^0.5.0 || ^0.6.1 || ^0.7.1 || ^1.0.0` | | `@diplodoc/file-extension` | `^0.2.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0 || ^2.0.0` | | `@diplodoc/quote-link-extension` | `^0.1.3` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@15.37.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/15.37.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/15/llms.txt` (latest of major 15), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/markdown-editor@14.13.0` # Markdown editor > A dual-mode Markdown editor for React that combines a WYSIWYG mode (ProseMirror) and a raw markup mode (CodeMirror), with support for basic Markdown and YFM. > > **npm:** `@gravity-ui/markdown-editor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/markdown-editor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `katex` | `^0.16.9` | | `react` | `^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `lodash` | `^4.17.20` | | `lowlight` | `^3.0.0` | | `react-dom` | `^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `markdown-it` | `^13.0.0` | | `highlight.js` | `^11.8.0` | | `@gravity-ui/uikit` | `^6.11.0` | | `@diplodoc/transform` | `^4.33.0` | | `@gravity-ui/components` | `^3.0.0` | | `@diplodoc/cut-extension` | `^0.3.1 || ^0.4.0 || ^0.5.0 || ^0.6.1 || ^0.7.1` | | `@diplodoc/html-extension` | `^2.3.2` | | `@diplodoc/tabs-extension` | `^3.5.1` | | `@diplodoc/latex-extension` | `^1.0.3` | | `@diplodoc/mermaid-extension` | `^1.0.0` | | `@diplodoc/folding-headings-extension` | `^0.1.0` | ### Required dependencies Please note that to start using the package, your project must also have the following installed: `@diplodoc/transform`, `react`, `react-dom`, `@gravity-ui/uikit`, `@gravity-ui/components` and some others. Check out the `peerDependencies` section of `package.json` for accurate information. ## Usage The markdown editor is supplied as a React hook to create an instance of editor and a component for rendering the view.\ To set up styling and theme see [UIKit docs](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ```tsx import React from 'react'; import {useMarkdownEditor, MarkdownEditorView} from '@gravity-ui/markdown-editor'; function Editor({onSubmit}) { const editor = useMarkdownEditor({allowHTML: false}); React.useEffect(() => { function submitHandler() { // Serialize current content to markdown markup const value = editor.getValue(); onSubmit(value); } editor.on('submit', submitHandler); return () => { editor.off('submit', submitHandler); }; }, [onSubmit]); return ; } ``` Read more: - [How to connect the editor in the Create React App](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-create-react-app--docs) - [How to add preview for markup mode](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-getting-started-preview--docs) - [How to add HTML extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-html-block--docs) - [How to add Latex extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-latex-extension--docs) - [How to add Mermaid extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-mermaid-extension--docs) - [How to write extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-creation--docs) - [How to add GPT extension](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-extensions-gpt--docs) - [How to add text binding extension in markdown](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-develop-extension-with-popup--docs) ### Development 1. Install Nodejs environment, version is specified in `.nvmrc` file. We recommend using [NVM](https://github.com/nvm-sh/nvm) or a similar tool. 2. Install [pnpm](https://pnpm.io/installation), version is specified in `package.json` in "packageManager" property. 3. Install dependencies: `pnpm i` 4. Run storybook dev-server: `pnpm start` ### i18n To set up internationalization, you just need to use the `configure`: ```typescript import {configure} from '@gravity-ui/markdown-editor'; configure({ lang: 'ru', }); ``` Don't forget to call `configure()` from [UIKit](https://github.com/gravity-ui/uikit?tab=readme-ov-file#i18n) and other UI libraries. ### Contributing - [Contributor Guidelines](https://preview.gravity-ui.com/md-editor/?path=/docs/docs-contributing--docs) ### When to use - Editing Markdown/YFM content with a switchable visual (WYSIWYG) and source (markup) view. - You need an extensible editor: custom marks, nodes, toolbar items, and extensions (HTML, LaTeX, Mermaid, GPT) via the ProseMirror/CodeMirror engines. - Rendering the editor UI: create the instance with `useMarkdownEditor` and render it with `MarkdownEditorView`. ### When not to use - Read-only rendering of Markdown to HTML with no editing — transform it with [`@diplodoc/transform`](https://github.com/diplodoc-platform/transform) and render the output instead. - Plain multiline text input — use `TextArea` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Rich-text that is not Markdown/YFM — this editor is Markdown-first. ### Common pitfalls - **It is a hook plus a view, not one component.** Create the instance with `useMarkdownEditor(...)` and pass it to ``; there is no single `` you render directly. - **Read the value via the instance, not a controlled `value` prop.** Call `editor.getValue()` (e.g. on the `submit` event) to serialize to Markdown; the editor manages its own state. - **Peer dependencies are required.** Your project must provide `@diplodoc/transform`, `@gravity-ui/uikit`, `@gravity-ui/components`, `react`, and `react-dom` — check the `peerDependencies` in `package.json`. - **Styles and i18n come from uikit.** Set up theming/styles per the uikit docs and call `configure({lang})` from both this package and `@gravity-ui/uikit`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/README.md) - [Storybook](https://preview.gravity-ui.com/md-editor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/markdown-editor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/markdown-editor) --- > Docs for `@gravity-ui/markdown-editor@14.13.0`. Versioned at: `https://gravity-ui.com/llms/markdown-editor/14.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/markdown-editor/14/llms.txt` (latest of major 14), `https://gravity-ui.com/llms/markdown-editor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.16.0` # @gravity-ui/aikit documentation Documentation for the **2.16.0** version of `@gravity-ui/aikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/aikit/build/docs/`). ## For AI agents A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ## Guides - [Adding a New Component](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/guidelines/new-component.md) — A checklist for everything that must be wired up when creating a new component inside src/components///. Missing any of these makes the component invisible to consumers, breaks tree-shaking, or fails CI. - [AIKit Library Architecture](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/ARCHITECTURE.md) - [AIKit Project Structure](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/PROJECT_STRUCTURE.md) — This document describes the layout of the @gravity-ui/aikit source tree. - [Code Style and Language Requirements](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/guidelines/code-style.md) — CRITICAL: All code documentation, comments, and JSDoc must be written in English. - [Components](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/COMPONENTS.md) — 49 components organized by Atomic Design level. Each component lives in src/components/// and ships with its own README and Storybook stories. - [Documentation](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/README.md) — This directory contains all @gravity-ui/aikit documentation. - [Examples](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/EXAMPLES.md) — Practical patterns for common AIKit integrations. - [Generative UI (toolset)](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/GENUI.md) - [Hooks](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/HOOKS.md) — AIKit exports 8 public hooks. All are re-exported from the package root and from the @gravity-ui/aikit/hooks subpath. - [Internationalization (i18n)](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/I18N.md) — AIKit localizes user-facing strings on a per-component basis using @gravity-ui/i18n. There is no global i18n provider — each component bundles its own keyset. - [Playwright Commands Quick Reference](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/PLAYWRIGHT.md) - [Quick Start](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/GETTING_STARTED.md) — This guide walks you through installing @gravity-ui/aikit and rendering your first chat. - [README Documentation](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/guidelines/readme.md) — Every component must have a comprehensive README.md file documenting its purpose, usage, and API. - [Storybook Files Creation](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/guidelines/storybook.md) — All components should have Storybook stories for documentation and testing purposes. Stories are located in the __stories__ directory within each component folder. - [Testing Guide](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/TESTING.md) — This project uses Playwright Component Testing for visual regression testing and component validation. - [Testing Guidelines](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/guidelines/testing.md) — Tests should be created based on Storybook stories to ensure consistency between documentation and functionality. We use Playwright Component Testing for visual regression testing and interaction testing. - [Theming](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/THEMING.md) — AIKit uses CSS variables for theming, in the --g-aikit-* namespace. Values fall back to Gravity UI's --g-color-* system so AIKit picks up your existing uikit theme automatically. - [Troubleshooting](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/TROUBLESHOOTING.md) — Common issues when integrating @gravity-ui/aikit. - [Using AIKit with AI Agents (Claude Code / Cursor)](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/guides/AI_AGENTS.md) — When you install @gravity-ui/aikit in a downstream project, you can teach Claude Code and Cursor about it so they write correct code without you spelling out the API every time. ## Components - [atoms/ActionButton](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/ActionButton.md) — A button component with integrated tooltip functionality, combining Button and ActionTooltip from Gravity UI. - [atoms/Alert](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/Alert.md) — An alert message with an indicator of alert's type opportunity to pass a button - [atoms/ChatDate](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/ChatDate.md) — A ChatDate component displays formatted dates with time and locale support. - [atoms/ContextIndicator](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/ContextIndicator.md) — A circular progress indicator that visualizes context usage as a percentage (0-100%). - [atoms/ContextItem](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/ContextItem.md) — A label for rendering context - [atoms/DiffStat](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/DiffStat.md) — A compact component that displays diff statistics showing the number of added and deleted lines. - [atoms/Disclaimer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/Disclaimer.md) — A Disclaimer component displays informational or warning messages - [atoms/FileIcon](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/FileIcon.md) — Displays an icon representing a file based on its MIME type or file name extension. - [atoms/IntersectionContainer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/IntersectionContainer.md) — Wrapper component for Intersection Observer API. Used for automatic loading of previous messages when scrolling up in MessageList. - [atoms/Loader](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/Loader.md) — A Loader visualizes loading state - [atoms/MarkdownRenderer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/MarkdownRenderer.md) — A MarkdownRenderer component for rendering Yandex Flavored Markdown (YFM) content to HTML. - [atoms/MessageBalloon](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/MessageBalloon.md) — Visual wrapper for user's message - [atoms/Shimmer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/Shimmer.md) — A loading animation component that creates a shimmer effect over its children. - [atoms/SubmitButton](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/SubmitButton.md) — A submit button component with state management through props and send/cancel icon switching. - [atoms/ToolIndicator](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/atoms/ToolIndicator.md) — A status indicator component that displays different icons based on the tool execution status. Shows a loader for loading state. - [molecules/ActionPopup](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/ActionPopup.md) — Universal anchored popup container for displaying content near action buttons. - [molecules/BaseMessage](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/BaseMessage.md) — Base wrapper for message with support for rendering action buttons - [molecules/ButtonGroup](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/ButtonGroup.md) — Wrapper for buttons group - [molecules/FeedbackForm](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/FeedbackForm.md) — Reusable feedback form component with reason selection and comment field. - [molecules/FileDropZone](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/FileDropZone.md) — A drag-and-drop area with a hidden file input. No external dependencies — uses native HTML5 DnD. - [molecules/FileItem](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/FileItem.md) — Displays a single file row with icon, name, optional size, upload status indicator, and remove button. - [molecules/InputContext](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/InputContext.md) — React context provider for prompt input attachments: queued files, removable chips in the prompt header, and an attachment picker slot. Pairs with useInputContext() for consumers inside the provider tree. - [molecules/PromptInputBody](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/PromptInputBody.md) — A body component for prompt input that displays a textarea with auto-growing capabilities or custom content. - [molecules/PromptInputFooter](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/PromptInputFooter.md) — A footer component for prompt input that displays action icons (settings, attachment, microphone) and a submit button. - [molecules/PromptInputHeader](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/PromptInputHeader.md) — A header component for prompt input that displays context items, context indicator, or custom content. - [molecules/PromptInputPanel](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/PromptInputPanel.md) — A simple panel container component that displays custom content. - [molecules/RatingBlock](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/RatingBlock.md) — Universal rating block with title and star rating. - [molecules/StarRating](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/StarRating.md) — A star rating component for displaying and collecting user ratings from 1 to 5 stars. - [molecules/Suggestions](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/Suggestions.md) — A Suggestions component displays a group of clickable suggestion buttons arranged in either horizontal (grid) or vertical (list) layout. - [molecules/Tabs](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/Tabs.md) — Tabs component for switching between sections with optional delete functionality. Built on top of Gravity UI's Label component. - [molecules/ToolFooter](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/ToolFooter.md) — Footer component for tool messages with action buttons and status message - [molecules/ToolHeader](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/ToolHeader.md) — Header component for tool messages with icon, name, actions, and status indicators - [molecules/ToolStatus](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/molecules/ToolStatus.md) — Component for displaying tool status with indicators and localized text - [organisms/AssistantMessage](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/AssistantMessage.md) — Component for rendering assistant messages with support for multiple message parts and custom renderers. Built on top of BaseMessage component with assistant variant styling. - [organisms/AttachmentPicker](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/AttachmentPicker.md) — A paperclip button that opens a file upload dialog. - [organisms/FileUploadDialog](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/FileUploadDialog.md) — A dialog with a drag-and-drop zone and a list of queued/uploaded files. Pure UI — upload logic is wired externally via useFileUploadStore. - [organisms/Header](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/Header.md) — Header component for displaying chat header with navigation and actions. - [organisms/MessageList](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/MessageList.md) — Component for displaying a list of messages. Supports custom message renderers through MessageRendererRegistry. - [organisms/PromptInput](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/PromptInput.md) — A flexible input component for chat interfaces with support for simple and full views, expandable panels, attachments, suggestions, and more. - [organisms/ThinkingMessage](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/ThinkingMessage.md) — A message component that displays AI thinking process with collapsible content and a status indicator. - [organisms/ToolMessage](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/ToolMessage.md) — Complete tool message component with automatic expand/collapse functionality and status-based behavior - [organisms/UserMessage](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/organisms/UserMessage.md) — Component for rendering a user message in a chat interface. - [pages/AIStudioChat](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/pages/AIStudioChat.md) — A ready-to-use chat component with built-in OpenAI streaming support. Wraps ChatContainer and manages all internal state — requires only an API URL to start working. - [pages/ChatContainer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/pages/ChatContainer.md) — A fully assembled chat component - the main exportable component of the library that integrates Header, ChatContent, and History. - [templates/ChatContent](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/templates/ChatContent.md) — Main chat content container with view switching between empty state and message list. - [templates/EmptyContainer](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/templates/EmptyContainer.md) — A template component for displaying a welcome screen with image, title, description, and suggestions. - [templates/History](https://unpkg.com/@gravity-ui/aikit@2.16.0/build/docs/components/templates/History.md) — A comprehensive chat history component that displays a list of chats in a popup with integrated search, grouping, and action capabilities. --- > Docs for `@gravity-ui/aikit@2.16.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.15.0` # @gravity-ui/aikit documentation Documentation for the **2.15.0** version of `@gravity-ui/aikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/aikit/build/docs/`). ## For AI agents A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ## Guides - [Adding a New Component](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/guidelines/new-component.md) — A checklist for everything that must be wired up when creating a new component inside src/components///. Missing any of these makes the component invisible to consumers, breaks tree-shaking, or fails CI. - [AIKit Library Architecture](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/ARCHITECTURE.md) - [AIKit Project Structure](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/PROJECT_STRUCTURE.md) — This document describes the layout of the @gravity-ui/aikit source tree. - [Code Style and Language Requirements](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/guidelines/code-style.md) — CRITICAL: All code documentation, comments, and JSDoc must be written in English. - [Components](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/COMPONENTS.md) — 49 components organized by Atomic Design level. Each component lives in src/components/// and ships with its own README and Storybook stories. - [Documentation](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/README.md) — This directory contains all @gravity-ui/aikit documentation. - [Examples](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/EXAMPLES.md) — Practical patterns for common AIKit integrations. - [Generative UI (toolset)](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/GENUI.md) - [Hooks](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/HOOKS.md) — AIKit exports 8 public hooks. All are re-exported from the package root and from the @gravity-ui/aikit/hooks subpath. - [Internationalization (i18n)](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/I18N.md) — AIKit localizes user-facing strings on a per-component basis using @gravity-ui/i18n. There is no global i18n provider — each component bundles its own keyset. - [Playwright Commands Quick Reference](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/PLAYWRIGHT.md) - [Quick Start](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/GETTING_STARTED.md) — This guide walks you through installing @gravity-ui/aikit and rendering your first chat. - [README Documentation](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/guidelines/readme.md) — Every component must have a comprehensive README.md file documenting its purpose, usage, and API. - [Storybook Files Creation](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/guidelines/storybook.md) — All components should have Storybook stories for documentation and testing purposes. Stories are located in the __stories__ directory within each component folder. - [Testing Guide](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/TESTING.md) — This project uses Playwright Component Testing for visual regression testing and component validation. - [Testing Guidelines](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/guidelines/testing.md) — Tests should be created based on Storybook stories to ensure consistency between documentation and functionality. We use Playwright Component Testing for visual regression testing and interaction testing. - [Theming](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/THEMING.md) — AIKit uses CSS variables for theming, in the --g-aikit-* namespace. Values fall back to Gravity UI's --g-color-* system so AIKit picks up your existing uikit theme automatically. - [Troubleshooting](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/TROUBLESHOOTING.md) — Common issues when integrating @gravity-ui/aikit. - [Using AIKit with AI Agents (Claude Code / Cursor)](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/guides/AI_AGENTS.md) — When you install @gravity-ui/aikit in a downstream project, you can teach Claude Code and Cursor about it so they write correct code without you spelling out the API every time. ## Components - [atoms/ActionButton](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/ActionButton.md) — A button component with integrated tooltip functionality, combining Button and ActionTooltip from Gravity UI. - [atoms/Alert](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/Alert.md) — An alert message with an indicator of alert's type opportunity to pass a button - [atoms/ChatDate](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/ChatDate.md) — A ChatDate component displays formatted dates with time and locale support. - [atoms/ContextIndicator](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/ContextIndicator.md) — A circular progress indicator that visualizes context usage as a percentage (0-100%). - [atoms/ContextItem](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/ContextItem.md) — A label for rendering context - [atoms/DiffStat](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/DiffStat.md) — A compact component that displays diff statistics showing the number of added and deleted lines. - [atoms/Disclaimer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/Disclaimer.md) — A Disclaimer component displays informational or warning messages - [atoms/FileIcon](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/FileIcon.md) — Displays an icon representing a file based on its MIME type or file name extension. - [atoms/IntersectionContainer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/IntersectionContainer.md) — Wrapper component for Intersection Observer API. Used for automatic loading of previous messages when scrolling up in MessageList. - [atoms/Loader](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/Loader.md) — A Loader visualizes loading state - [atoms/MarkdownRenderer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/MarkdownRenderer.md) — A MarkdownRenderer component for rendering Yandex Flavored Markdown (YFM) content to HTML. - [atoms/MessageBalloon](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/MessageBalloon.md) — Visual wrapper for user's message - [atoms/Shimmer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/Shimmer.md) — A loading animation component that creates a shimmer effect over its children. - [atoms/SubmitButton](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/SubmitButton.md) — A submit button component with state management through props and send/cancel icon switching. - [atoms/ToolIndicator](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/atoms/ToolIndicator.md) — A status indicator component that displays different icons based on the tool execution status. Shows a loader for loading state. - [molecules/ActionPopup](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/ActionPopup.md) — Universal anchored popup container for displaying content near action buttons. - [molecules/BaseMessage](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/BaseMessage.md) — Base wrapper for message with support for rendering action buttons - [molecules/ButtonGroup](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/ButtonGroup.md) — Wrapper for buttons group - [molecules/FeedbackForm](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/FeedbackForm.md) — Reusable feedback form component with reason selection and comment field. - [molecules/FileDropZone](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/FileDropZone.md) — A drag-and-drop area with a hidden file input. No external dependencies — uses native HTML5 DnD. - [molecules/FileItem](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/FileItem.md) — Displays a single file row with icon, name, optional size, upload status indicator, and remove button. - [molecules/InputContext](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/InputContext.md) — React context provider for prompt input attachments: queued files, removable chips in the prompt header, and an attachment picker slot. Pairs with useInputContext() for consumers inside the provider tree. - [molecules/PromptInputBody](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/PromptInputBody.md) — A body component for prompt input that displays a textarea with auto-growing capabilities or custom content. - [molecules/PromptInputFooter](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/PromptInputFooter.md) — A footer component for prompt input that displays action icons (settings, attachment, microphone) and a submit button. - [molecules/PromptInputHeader](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/PromptInputHeader.md) — A header component for prompt input that displays context items, context indicator, or custom content. - [molecules/PromptInputPanel](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/PromptInputPanel.md) — A simple panel container component that displays custom content. - [molecules/RatingBlock](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/RatingBlock.md) — Universal rating block with title and star rating. - [molecules/StarRating](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/StarRating.md) — A star rating component for displaying and collecting user ratings from 1 to 5 stars. - [molecules/Suggestions](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/Suggestions.md) — A Suggestions component displays a group of clickable suggestion buttons arranged in either horizontal (grid) or vertical (list) layout. - [molecules/Tabs](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/Tabs.md) — Tabs component for switching between sections with optional delete functionality. Built on top of Gravity UI's Label component. - [molecules/ToolFooter](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/ToolFooter.md) — Footer component for tool messages with action buttons and status message - [molecules/ToolHeader](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/ToolHeader.md) — Header component for tool messages with icon, name, actions, and status indicators - [molecules/ToolStatus](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/molecules/ToolStatus.md) — Component for displaying tool status with indicators and localized text - [organisms/AssistantMessage](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/AssistantMessage.md) — Component for rendering assistant messages with support for multiple message parts and custom renderers. Built on top of BaseMessage component with assistant variant styling. - [organisms/AttachmentPicker](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/AttachmentPicker.md) — A paperclip button that opens a file upload dialog. - [organisms/FileUploadDialog](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/FileUploadDialog.md) — A dialog with a drag-and-drop zone and a list of queued/uploaded files. Pure UI — upload logic is wired externally via useFileUploadStore. - [organisms/Header](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/Header.md) — Header component for displaying chat header with navigation and actions. - [organisms/MessageList](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/MessageList.md) — Component for displaying a list of messages. Supports custom message renderers through MessageRendererRegistry. - [organisms/PromptInput](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/PromptInput.md) — A flexible input component for chat interfaces with support for simple and full views, expandable panels, attachments, suggestions, and more. - [organisms/ThinkingMessage](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/ThinkingMessage.md) — A message component that displays AI thinking process with collapsible content and a status indicator. - [organisms/ToolMessage](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/ToolMessage.md) — Complete tool message component with automatic expand/collapse functionality and status-based behavior - [organisms/UserMessage](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/organisms/UserMessage.md) — Component for rendering a user message in a chat interface. - [pages/AIStudioChat](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/pages/AIStudioChat.md) — A ready-to-use chat component with built-in OpenAI streaming support. Wraps ChatContainer and manages all internal state — requires only an API URL to start working. - [pages/ChatContainer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/pages/ChatContainer.md) — A fully assembled chat component - the main exportable component of the library that integrates Header, ChatContent, and History. - [templates/ChatContent](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/templates/ChatContent.md) — Main chat content container with view switching between empty state and message list. - [templates/EmptyContainer](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/templates/EmptyContainer.md) — A template component for displaying a welcome screen with image, title, description, and suggestions. - [templates/History](https://unpkg.com/@gravity-ui/aikit@2.15.0/build/docs/components/templates/History.md) — A comprehensive chat history component that displays a list of chats in a popup with integrated search, grouping, and action capabilities. --- > Docs for `@gravity-ui/aikit@2.15.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.14.0` # @gravity-ui/aikit documentation Documentation for the **2.14.0** version of `@gravity-ui/aikit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/aikit/build/docs/`). ## For AI agents A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ## Guides - [Adding a New Component](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/guidelines/new-component.md) — A checklist for everything that must be wired up when creating a new component inside src/components///. Missing any of these makes the component invisible to consumers, breaks tree-shaking, or fails CI. - [AIKit Library Architecture](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/ARCHITECTURE.md) - [AIKit Project Structure](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/PROJECT_STRUCTURE.md) — This document describes the layout of the @gravity-ui/aikit source tree. - [Code Style and Language Requirements](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/guidelines/code-style.md) — CRITICAL: All code documentation, comments, and JSDoc must be written in English. - [Components](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/COMPONENTS.md) — 49 components organized by Atomic Design level. Each component lives in src/components/// and ships with its own README and Storybook stories. - [Documentation](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/README.md) — This directory contains all @gravity-ui/aikit documentation. - [Examples](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/EXAMPLES.md) — Practical patterns for common AIKit integrations. - [Generative UI (toolset)](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/GENUI.md) - [Hooks](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/HOOKS.md) — AIKit exports 8 public hooks. All are re-exported from the package root and from the @gravity-ui/aikit/hooks subpath. - [Internationalization (i18n)](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/I18N.md) — AIKit localizes user-facing strings on a per-component basis using @gravity-ui/i18n. There is no global i18n provider — each component bundles its own keyset. - [Playwright Commands Quick Reference](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/PLAYWRIGHT.md) - [Quick Start](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/GETTING_STARTED.md) — This guide walks you through installing @gravity-ui/aikit and rendering your first chat. - [README Documentation](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/guidelines/readme.md) — Every component must have a comprehensive README.md file documenting its purpose, usage, and API. - [Storybook Files Creation](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/guidelines/storybook.md) — All components should have Storybook stories for documentation and testing purposes. Stories are located in the __stories__ directory within each component folder. - [Testing Guide](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/TESTING.md) — This project uses Playwright Component Testing for visual regression testing and component validation. - [Testing Guidelines](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/guidelines/testing.md) — Tests should be created based on Storybook stories to ensure consistency between documentation and functionality. We use Playwright Component Testing for visual regression testing and interaction testing. - [Theming](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/THEMING.md) — AIKit uses CSS variables for theming, in the --g-aikit-* namespace. Values fall back to Gravity UI's --g-color-* system so AIKit picks up your existing uikit theme automatically. - [Troubleshooting](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/TROUBLESHOOTING.md) — Common issues when integrating @gravity-ui/aikit. - [Using AIKit with AI Agents (Claude Code / Cursor)](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/guides/AI_AGENTS.md) — When you install @gravity-ui/aikit in a downstream project, you can teach Claude Code and Cursor about it so they write correct code without you spelling out the API every time. ## Components - [atoms/ActionButton](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/ActionButton.md) — A button component with integrated tooltip functionality, combining Button and ActionTooltip from Gravity UI. - [atoms/Alert](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/Alert.md) — An alert message with an indicator of alert's type opportunity to pass a button - [atoms/ChatDate](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/ChatDate.md) — A ChatDate component displays formatted dates with time and locale support. - [atoms/ContextIndicator](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/ContextIndicator.md) — A circular progress indicator that visualizes context usage as a percentage (0-100%). - [atoms/ContextItem](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/ContextItem.md) — A label for rendering context - [atoms/DiffStat](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/DiffStat.md) — A compact component that displays diff statistics showing the number of added and deleted lines. - [atoms/Disclaimer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/Disclaimer.md) — A Disclaimer component displays informational or warning messages - [atoms/FileIcon](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/FileIcon.md) — Displays an icon representing a file based on its MIME type or file name extension. - [atoms/IntersectionContainer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/IntersectionContainer.md) — Wrapper component for Intersection Observer API. Used for automatic loading of previous messages when scrolling up in MessageList. - [atoms/Loader](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/Loader.md) — A Loader visualizes loading state - [atoms/MarkdownRenderer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/MarkdownRenderer.md) — A MarkdownRenderer component for rendering Yandex Flavored Markdown (YFM) content to HTML. - [atoms/MessageBalloon](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/MessageBalloon.md) — Visual wrapper for user's message - [atoms/Shimmer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/Shimmer.md) — A loading animation component that creates a shimmer effect over its children. - [atoms/SubmitButton](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/SubmitButton.md) — A submit button component with state management through props and send/cancel icon switching. - [atoms/ToolIndicator](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/atoms/ToolIndicator.md) — A status indicator component that displays different icons based on the tool execution status. Shows a loader for loading state. - [molecules/ActionPopup](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/ActionPopup.md) — Universal anchored popup container for displaying content near action buttons. - [molecules/BaseMessage](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/BaseMessage.md) — Base wrapper for message with support for rendering action buttons - [molecules/ButtonGroup](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/ButtonGroup.md) — Wrapper for buttons group - [molecules/FeedbackForm](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/FeedbackForm.md) — Reusable feedback form component with reason selection and comment field. - [molecules/FileDropZone](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/FileDropZone.md) — A drag-and-drop area with a hidden file input. No external dependencies — uses native HTML5 DnD. - [molecules/FileItem](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/FileItem.md) — Displays a single file row with icon, name, optional size, upload status indicator, and remove button. - [molecules/InputContext](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/InputContext.md) — React context provider for prompt input attachments: queued files, removable chips in the prompt header, and an attachment picker slot. Pairs with useInputContext() for consumers inside the provider tree. - [molecules/PromptInputBody](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/PromptInputBody.md) — A body component for prompt input that displays a textarea with auto-growing capabilities or custom content. - [molecules/PromptInputFooter](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/PromptInputFooter.md) — A footer component for prompt input that displays action icons (settings, attachment, microphone) and a submit button. - [molecules/PromptInputHeader](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/PromptInputHeader.md) — A header component for prompt input that displays context items, context indicator, or custom content. - [molecules/PromptInputPanel](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/PromptInputPanel.md) — A simple panel container component that displays custom content. - [molecules/RatingBlock](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/RatingBlock.md) — Universal rating block with title and star rating. - [molecules/StarRating](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/StarRating.md) — A star rating component for displaying and collecting user ratings from 1 to 5 stars. - [molecules/Suggestions](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/Suggestions.md) — A Suggestions component displays a group of clickable suggestion buttons arranged in either horizontal (grid) or vertical (list) layout. - [molecules/Tabs](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/Tabs.md) — Tabs component for switching between sections with optional delete functionality. Built on top of Gravity UI's Label component. - [molecules/ToolFooter](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/ToolFooter.md) — Footer component for tool messages with action buttons and status message - [molecules/ToolHeader](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/ToolHeader.md) — Header component for tool messages with icon, name, actions, and status indicators - [molecules/ToolStatus](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/molecules/ToolStatus.md) — Component for displaying tool status with indicators and localized text - [organisms/AssistantMessage](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/AssistantMessage.md) — Component for rendering assistant messages with support for multiple message parts and custom renderers. Built on top of BaseMessage component with assistant variant styling. - [organisms/AttachmentPicker](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/AttachmentPicker.md) — A paperclip button that opens a file upload dialog. - [organisms/FileUploadDialog](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/FileUploadDialog.md) — A dialog with a drag-and-drop zone and a list of queued/uploaded files. Pure UI — upload logic is wired externally via useFileUploadStore. - [organisms/Header](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/Header.md) — Header component for displaying chat header with navigation and actions. - [organisms/MessageList](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/MessageList.md) — Component for displaying a list of messages. Supports custom message renderers through MessageRendererRegistry. - [organisms/PromptInput](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/PromptInput.md) — A flexible input component for chat interfaces with support for simple and full views, expandable panels, attachments, suggestions, and more. - [organisms/ThinkingMessage](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/ThinkingMessage.md) — A message component that displays AI thinking process with collapsible content and a status indicator. - [organisms/ToolMessage](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/ToolMessage.md) — Complete tool message component with automatic expand/collapse functionality and status-based behavior - [organisms/UserMessage](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/organisms/UserMessage.md) — Component for rendering a user message in a chat interface. - [pages/AIStudioChat](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/pages/AIStudioChat.md) — A ready-to-use chat component with built-in OpenAI streaming support. Wraps ChatContainer and manages all internal state — requires only an API URL to start working. - [pages/ChatContainer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/pages/ChatContainer.md) — A fully assembled chat component - the main exportable component of the library that integrates Header, ChatContent, and History. - [templates/ChatContent](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/templates/ChatContent.md) — Main chat content container with view switching between empty state and message list. - [templates/EmptyContainer](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/templates/EmptyContainer.md) — A template component for displaying a welcome screen with image, title, description, and suggestions. - [templates/History](https://unpkg.com/@gravity-ui/aikit@2.14.0/build/docs/components/templates/History.md) — A comprehensive chat history component that displays a list of chats in a popup with integrated search, grouping, and action capabilities. --- > Docs for `@gravity-ui/aikit@2.14.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.12.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.12.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.11.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.11.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.10.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.10.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.9.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.9.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.8.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.8.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.7.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.7.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@2.6.0` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@2.6.0`. Versioned at: `https://gravity-ui.com/llms/aikit/2.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/aikit@1.17.1` # AIKit > A React component library for building AI chat interfaces, organized by Atomic Design (atoms → molecules → organisms → templates → pages) and SDK-agnostic — reach for it to assemble a chat UI (message lists, prompt input, tool calls, attachments) instead of composing those primitives out of `@gravity-ui/uikit` by hand. > > **npm:** `@gravity-ui/aikit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/aikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `react-dom` | `^18.0.0 || ^19.0.0` | | `highlight.js` | `^11.11.1` | | `@gravity-ui/i18n` | `^1.8.0` | | `@gravity-ui/icons` | `^2.16.0` | | `@gravity-ui/uikit` | `^7.25.0` | | `@diplodoc/transform` | `^4.63.3` | ## Usage ```typescript import { ChatContainer } from '@gravity-ui/aikit'; import type { ChatType, TChatMessage } from '@gravity-ui/aikit'; function App() { const [messages, setMessages] = useState([]); const [chats, setChats] = useState([]); const [activeChat, setActiveChat] = useState(null); return ( { // Your sending logic console.log('Message:', data.content); }} onSelectChat={setActiveChat} onCreateChat={() => { // Create new chat }} onDeleteChat={(chat) => { // Delete chat }} /> ); } ``` ### When to use - Building an AI/LLM chat UI (assistant/user/tool messages, prompt input with suggestions, attachment uploads, thinking states). - Wanting ready-made chat layouts (`ChatContainer`, `MessageList`, `PromptInput`) plus hooks to customize behavior. - Embedding into the Gravity UI ecosystem with shared theming via CSS variables. ### When not to use - For general-purpose UI primitives (buttons, inputs, modals), use [`@gravity-ui/uikit`](https://gravity-ui.com/uikit) directly — AIKit builds on top of it for chat-specific needs. - To render rich markdown in messages, AIKit's `MarkdownRenderer` wraps [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor); for standalone markdown rendering use that package directly. - For a single chat bubble without chat orchestration, a uikit `MarkdownRenderer`/text block is lighter than the full AIKit message pipeline. ### Common pitfalls - **Hallucinating an AI SDK import** — AIKit is SDK-agnostic; it provides components/hooks, not an LLM client. Bring your own data source and feed messages via props. - **Reaching for `` / ``** — the page-level export is `ChatContainer` (and `AIStudioChat`); there is no component literally named `Chat`. - **Skipping message-type registration for custom types** — custom message kinds must be registered in the message type system, or they render as unknown. - **Editing base components instead of using hooks** — the two-level design expects you to customize via hooks/composition; overriding internals directly breaks upgrades. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/aikit/main/README.md) - [Storybook](https://preview.gravity-ui.com/aikit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/aikit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/aikit) --- > Docs for `@gravity-ui/aikit@1.17.1`. Versioned at: `https://gravity-ui.com/llms/aikit/1.17.1/llms.txt` (exact), `https://gravity-ui.com/llms/aikit/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/aikit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.57.3` # @gravity-ui/charts documentation Documentation for the **1.57.3** version of `@gravity-ui/charts`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/charts/dist/docs/`). ## For AI agents A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/get-started.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/tooltip.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/legend.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/html.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/value-formatting.md) - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/data-labels.md) - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/axis-types.md) ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/uikit` | `^7.0.0` | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (

); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ## Guides - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/axis-types.md) — Choosing the correct axis type is crucial for accurate data representation. This guide covers available axis types and their applications. - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/data-labels.md) - [Development](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/development.md) - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/get-started.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/html.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/legend.md) - [Overview](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/overview.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/tooltip.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.3/dist/docs/guides/value-formatting.md) — Chart values can appear in several places: tooltip rows, data labels rendered on the shapes themselves, axis tick labels, and totals. All of these accept the same ValueFormat shape, so you configure formatting once and apply it consistently across the chart. --- > Docs for `@gravity-ui/charts@1.57.3`. Versioned at: `https://gravity-ui.com/llms/charts/1.57.3/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.57.2` # @gravity-ui/charts documentation Documentation for the **1.57.2** version of `@gravity-ui/charts`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/charts/dist/docs/`). ## For AI agents A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/get-started.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/tooltip.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/legend.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/html.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/value-formatting.md) - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/data-labels.md) - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/axis-types.md) ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ## Guides - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/axis-types.md) — Choosing the correct axis type is crucial for accurate data representation. This guide covers available axis types and their applications. - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/data-labels.md) - [Development](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/development.md) - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/get-started.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/html.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/legend.md) - [Overview](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/overview.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/tooltip.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.2/dist/docs/guides/value-formatting.md) — Chart values can appear in several places: tooltip rows, data labels rendered on the shapes themselves, axis tick labels, and totals. All of these accept the same ValueFormat shape, so you configure formatting once and apply it consistently across the chart. --- > Docs for `@gravity-ui/charts@1.57.2`. Versioned at: `https://gravity-ui.com/llms/charts/1.57.2/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.57.1` # @gravity-ui/charts documentation Documentation for the **1.57.1** version of `@gravity-ui/charts`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/charts/dist/docs/`). ## For AI agents A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/get-started.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/tooltip.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/legend.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/html.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/value-formatting.md) - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/data-labels.md) - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/axis-types.md) ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ## Guides - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/axis-types.md) — Choosing the correct axis type is crucial for accurate data representation. This guide covers available axis types and their applications. - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/data-labels.md) - [Development](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/development.md) - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/get-started.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/html.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/legend.md) - [Overview](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/overview.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/tooltip.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.1/dist/docs/guides/value-formatting.md) — Chart values can appear in several places: tooltip rows, data labels rendered on the shapes themselves, axis tick labels, and totals. All of these accept the same ValueFormat shape, so you configure formatting once and apply it consistently across the chart. --- > Docs for `@gravity-ui/charts@1.57.1`. Versioned at: `https://gravity-ui.com/llms/charts/1.57.1/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.57.0` # @gravity-ui/charts documentation Documentation for the **1.57.0** version of `@gravity-ui/charts`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/charts/dist/docs/`). ## For AI agents A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/get-started.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/tooltip.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/legend.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/html.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/value-formatting.md) - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/data-labels.md) - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/axis-types.md) ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ## Guides - [Axis Types](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/axis-types.md) — Choosing the correct axis type is crucial for accurate data representation. This guide covers available axis types and their applications. - [Data Labels](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/data-labels.md) - [Development](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/development.md) - [Get started](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/get-started.md) - [HTML Content](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/html.md) - [Legend](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/legend.md) - [Overview](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/overview.md) - [Theming](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/theming.md) - [Tooltip](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/tooltip.md) - [Value Formatting](https://unpkg.com/@gravity-ui/charts@1.57.0/dist/docs/guides/value-formatting.md) — Chart values can appear in several places: tooltip rows, data labels rendered on the shapes themselves, axis tick labels, and totals. All of these accept the same ValueFormat shape, so you configure formatting once and apply it consistently across the chart. --- > Docs for `@gravity-ui/charts@1.57.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.57.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.56.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.56.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.56.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.55.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.55.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.55.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.54.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.54.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.54.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.53.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.53.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.53.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.52.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.52.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.52.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.51.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.51.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.51.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.50.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.50.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.50.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.49.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.49.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.49.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@1.48.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@1.48.0`. Versioned at: `https://gravity-ui.com/llms/charts/1.48.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/charts@0.12.0` # Charts > A declarative React charting library for Gravity UI apps — render line, area, bar, pie, scatter, treemap, and other charts from a single `data` config, themed to match the rest of the app. > > **npm:** `@gravity-ui/charts` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/uikit @gravity-ui/charts ``` `@gravity-ui/uikit` is a required peer dependency — it provides the theming and styles the charts rely on. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage Import the `@gravity-ui/uikit` styles once in your entry point, wrap your app in `ThemeProvider`, and render a `Chart` inside a container with an explicit height: ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import {Chart} from '@gravity-ui/charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; const data = { series: { data: [ { type: 'line', name: 'Temperature', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `Chart` adapts to its parent's size, so the wrapping element must have a height. ### When to use - Standard business charts: `line`, `area`, `bar-x`/`bar-y`, `pie`, `scatter`, `treemap`, `waterfall`, `sankey`, `radar`, `heatmap`, `funnel`, `x-range`. - Visualizations that must follow Gravity UI theming (light/dark) and share tokens with a `@gravity-ui/uikit` app. - Rendering a chart from declarative data rather than drawing imperatively. ### When not to use - Projects still on `@gravity-ui/chartkit` — that is the older adapter-based wrapper (YAGR/Highcharts/D3); this package is the modern standalone renderer and is not a drop-in replacement. - Plain tabular data — use [`@gravity-ui/table`](https://github.com/gravity-ui/table). - Non-React or server-only rendering — `Chart` renders React SVG and needs the DOM. ### Common pitfalls - **The component is `Chart`, not `ChartKit`.** Import `{Chart}` from `@gravity-ui/charts`; `ChartKit` belongs to the separate legacy `@gravity-ui/chartkit` package. - **The data prop is `data`, shaped `{series: {data: [...]}}`.** Each entry in `series.data` is one series with its own `type` and `data` array — there is no top-level array of series. - **Nothing renders without a sized container.** `Chart` fills its parent, so give the wrapper an explicit height. - **Requires uikit setup.** Wrap in `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` is a required peer dependency. ### Useful docs - [Get started](./docs/diplodoc/pages/get-started.md) - [Theming](./docs/diplodoc/pages/guides/theming.md) - [Tooltip](./docs/diplodoc/pages/guides/tooltip.md) - [Legend](./docs/diplodoc/pages/guides/legend.md) - [HTML Content](./docs/diplodoc/pages/guides/html.md) - [Value Formatting](./docs/diplodoc/pages/guides/value-formatting.md) - [Data Labels](./docs/diplodoc/pages/guides/data-labels.md) - [Axis Types](./docs/diplodoc/pages/guides/axes/axis-types.md) - [Axis Labels](./docs/diplodoc/pages/guides/axes/axis-labels.md) ## Links - [README](https://raw.githubusercontent.com/gravity-ui/charts/main/README.md) - [Storybook](https://preview.gravity-ui.com/charts/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/charts/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/charts) --- > Docs for `@gravity-ui/charts@0.12.0`. Versioned at: `https://gravity-ui.com/llms/charts/0.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/charts/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/charts/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.11.3` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.11.3`. Versioned at: `https://gravity-ui.com/llms/graph/1.11.3/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.11.2` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.11.2`. Versioned at: `https://gravity-ui.com/llms/graph/1.11.2/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.11.1` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.11.1`. Versioned at: `https://gravity-ui.com/llms/graph/1.11.1/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.11.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.11.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.10.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.10.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.9.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.9.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.8.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.8.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.7.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.7.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.6.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.6.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.5.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.5.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.4.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.4.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.3.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.3.0`. Versioned at: `https://gravity-ui.com/llms/graph/1.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@1.2.1` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@1.2.1`. Versioned at: `https://gravity-ui.com/llms/graph/1.2.1/llms.txt` (exact), `https://gravity-ui.com/llms/graph/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/graph@0.5.0` # Graph > A hybrid Canvas/React graph editor for node-based diagrams — reach for it to build flowcharts, node editors, or large interactive diagrams where Canvas gives performance at low zoom and React components give rich interactivity when zoomed in. > > **npm:** `@gravity-ui/graph` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/graph ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | ## Usage ### React Example [Detailed React Components Documentation](docs/react/usage.md) ```typescript import React, { useEffect } from "react"; import type { Graph, TBlock } from "@gravity-ui/graph"; import { EAnchorType, GraphState } from "@gravity-ui/graph"; import { GraphCanvas, GraphBlock, useGraph } from "@gravity-ui/graph/react"; const config = {}; export function GraphEditor() { const { graph, setEntities, start } = useGraph(config); useEffect(() => { setEntities({ blocks: [ { is: "block-action", id: "action_1", x: -100, y: -450, width: 126, height: 126, selected: true, name: "Block #1", anchors: [ { id: "out1", blockId: "action_1", type: EAnchorType.OUT, index: 0, }, ], }, { id: "action_2", is: "block-action", x: 253, y: 176, width: 126, height: 126, selected: false, name: "Block #2", anchors: [ { id: "in1", blockId: "action_2", type: EAnchorType.IN, index: 0, }, ], }, ], connections: [ { sourceBlockId: "action_1", sourceAnchorId: "out1", targetBlockId: "action_2", targetAnchorId: "in1", }, ], }); }, [setEntities]); const renderBlockFn = (graph: Graph, block: TBlock) => { return ( {block.id} ); }; return ( { if (state === GraphState.ATTACHED) { start(); graph.zoomTo("center", { padding: 300 }); } }} /> ); } ``` ### Vanilla JavaScript Example ```javascript import { Graph } from "@gravity-ui/graph"; // Create container element const container = document.createElement('div'); container.style.width = '100vw'; container.style.height = '100vh'; container.style.overflow = 'hidden'; document.body.appendChild(container); // Initialize graph with configuration const graph = new Graph({ configurationName: "example", blocks: [], connections: [], settings: { canDragCamera: true, canZoomCamera: true, useBezierConnections: true, showConnectionArrows: true } }, container); // Add blocks and connections graph.setEntities({ blocks: [ { is: "block-action", id: "block1", x: 100, y: 100, width: 120, height: 120, name: "Block #1", anchors: [ { id: "out1", blockId: "block1", type: EAnchorType.OUT, index: 0 } ] }, { is: "block-action", id: "block2", x: 300, y: 300, width: 120, height: 120, name: "Block #2", anchors: [ { id: "in1", blockId: "block2", type: EAnchorType.IN, index: 0 } ] } ], connections: [ { sourceBlockId: "block1", sourceAnchorId: "out1", targetBlockId: "block2", targetAnchorId: "in1" } ] }); // Start rendering graph.start(); // Center the view graph.zoomTo("center", { padding: 100 }); ``` ### When to use - Node-based editors (flowcharts, pipelines, visual builders) with hundreds/thousands of nodes and connections. - Mixed rendering: Canvas for the full-graph overview, React components for the blocks visible in the viewport at high zoom. - Vanilla JS or React consumers — the core `Graph` class is framework-agnostic; `@gravity-ui/graph/react` provides the React bindings. ### When not to use - To plot numeric data series (line/bar/scatter charts), use [`@gravity-ui/charts`](https://gravity-ui.com/charts) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) — graph is a node/edge diagram editor, not a data chart. - For a static, non-editable diagram with few nodes, an SVG or a simpler diagram lib may suffice without the Canvas/React viewport machinery. ### Common pitfalls - **Hallucinated import `GraphEditor`** — the React components are `GraphCanvas`, `GraphBlock`, and the `useGraph` hook, imported from `@gravity-ui/graph/react`; the core class is `Graph` from `@gravity-ui/graph`. - **Calling graph methods before `ATTACHED` state** — call `start()`/`zoomTo(...)` inside the `onStateChanged` callback when `state === GraphState.ATTACHED`, not on mount. - **Forgetting `setEntities`** — `useGraph` returns `graph`, `setEntities`, `start`; data only appears after `setEntities({blocks, connections})`. - **Mixing anchor types** — connections must reference existing anchor ids with matching `EAnchorType` (`IN`/`OUT`) on the source and target blocks. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/graph/main/README.md) - [Storybook](https://preview.gravity-ui.com/graph/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/graph/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/graph) --- > Docs for `@gravity-ui/graph@0.5.0`. Versioned at: `https://gravity-ui.com/llms/graph/0.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/graph/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/graph/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.21.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.21.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.21.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.20.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.20.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.20.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.19.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.19.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.19.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.18.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.18.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.18.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.17.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.17.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.17.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.16.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.16.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.15.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.15.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.14.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.14.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.13.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.13.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@2.12.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `*` | ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@2.12.0`. Versioned at: `https://gravity-ui.com/llms/icons/2.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/icons@1.1.0` # Icons > The official SVG icon set for Gravity UI, shipped as both React components and raw `.svg` files for use with `@gravity-ui/uikit`'s `Icon` renderer. > > **npm:** `@gravity-ui/icons` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/icons ``` ## Usage ### React ```js import Cloud from '@gravity-ui/icons/Cloud'; ``` or ```js import {Cloud} from '@gravity-ui/icons'; ``` ### SVG > You might need an appropriate loader for this ```js import cloudIcon from '@gravity-ui/icons/svgs/cloud.svg'; ``` ### When to use - You need an icon inside a Gravity UI app and want a consistent, ready-made set. - Rendering an icon via uikit: import the icon component here and pass it to uikit's `Icon` through its `data` prop. - You need the raw `.svg` asset (e.g. for CSS `background-image` or a build-time SVG loader) rather than a React component. ### When not to use - Rendering the icon on screen — this package only provides the glyphs; the actual renderer (sizing, color, a11y) is the `Icon` component from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - You need a custom or brand icon that is not in the set — import your own SVG and pass it to uikit's `Icon`; do not expect it to live here. ### Common pitfalls - **Icons are passed as data, not by name.** Do `import {Gear} from '@gravity-ui/icons'; ` — there is no `` API, and this package exports no `` component of its own. - **Import path matters for tree-shaking.** `import Cloud from '@gravity-ui/icons/Cloud'` pulls a single icon; `import {Cloud} from '@gravity-ui/icons'` works too but relies on the bundler to tree-shake the barrel. - **SVG imports need a loader.** `import icon from '@gravity-ui/icons/svgs/cloud.svg'` only works if your bundler is configured to handle `.svg` files. - **Size and color come from the renderer.** Set `size` on uikit's `Icon` and control color with `color`/CSS `currentColor`; the SVGs themselves carry no fixed color. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/icons/main/README.md) - [Storybook](https://preview.gravity-ui.com/icons/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/icons/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/icons) --- > Docs for `@gravity-ui/icons@1.1.0`. Versioned at: `https://gravity-ui.com/llms/icons/1.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/icons/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/icons/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/illustrations@2.1.1` # Illustrations > A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons. > > **npm:** `@gravity-ui/illustrations` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/illustrations ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### React #### Preparation Setup illustrations theme. Execute any of the following steps: ##### Defining css-tokens with own colors pallete Define following css-tokens in app: ```scss --gil-color-object-base: rgb(255, 190, 92); --gil-color-object-accent-heavy: rgb(211, 101, 7); --gil-color-object-hightlight: rgb(255, 216, 157); --gil-color-shadow-over-object: rgb(211, 158, 80); --gil-color-background-lines: rgb(140, 140, 140); --gil-color-background-shapes: rgb(242, 242, 242); --gil-color-object-accent-light: rgb(255, 255, 255); --gil-color-object-danger: rgb(255, 0, 61); ``` ##### Using mixins with default gravity-theme in scss Use the following mixins for styling illustrations in different themes ```scss @import '@gravity-ui/illustrations/styles/theme.scss'; .g-root { &_theme_light { @include g-illustrations-colors-light; } &_theme_light-hc { @include g-illustrations-colors-light-hc; } &_theme_dark { @include g-illustrations-colors-dark; } &_theme_dark-hc { @include g-illustrations-colors-dark-hc; } } ``` ##### Alternative for projects with pre-installed gravity theme Alternatively, if `@gravity-ui/uikit` is already installed in the project and default theme is used, you can just import `styles.scss` to the root file with styles in your project: ```scss // existing gravity styles definition import '@gravity-ui/uikit/styles/styles.css'; // just add one more import below import '@gravity-ui/illustrations/styles/styles.scss'; ``` #### Components usage ```js import NotFound from '@gravity-ui/illustrations/NotFound'; ``` or ```js import {NotFound} from '@gravity-ui/illustrations'; ``` ### SVG > You might need an appropriate loader for this ```js import notFound from '@gravity-ui/illustrations/svgs/not-found-light.svg'; ``` ### Development For updating illustrations according to new design, change the content of svg-s in light theme (`/svgs/-light.svg` files) and then run command: ```shell npm run generate ``` ### When to use - Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control. - Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables. - Importing artwork as React components (default) or as raw `.svg` files. ### When not to use - For functional UI iconography (chevrons, checks, buttons), use [`@gravity-ui/icons`](https://gravity-ui.com/icons) — illustrations are decorative artwork, not UI glyphs. - For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package. ### Common pitfalls - **Rendering without a theme import** — illustrations appear uncolored unless you import `@gravity-ui/illustrations/styles/styles.scss` (or define the `--gil-color-*` CSS tokens). - **Hallucinated default export names** — illustration components are PascalCase named exports (e.g. `NotFound`), imported from the package root or per-file (`@gravity-ui/illustrations/NotFound`). - **Importing `.svg` directly in a non-configured bundler** — raw SVG imports need an appropriate loader; prefer the React component export to avoid bundler setup. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/illustrations/main/README.md) - [Storybook](https://preview.gravity-ui.com/illustrations/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/illustrations/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/illustrations) --- > Docs for `@gravity-ui/illustrations@2.1.1`. Versioned at: `https://gravity-ui.com/llms/illustrations/2.1.1/llms.txt` (exact), `https://gravity-ui.com/llms/illustrations/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/illustrations/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/illustrations@2.1.0` # Illustrations > A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons. > > **npm:** `@gravity-ui/illustrations` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/illustrations ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ### React #### Preparation Setup illustrations theme. Execute any of the following steps: ##### Defining css-tokens with own colors pallete Define following css-tokens in app: ```scss --gil-color-object-base: rgb(255, 190, 92); --gil-color-object-accent-heavy: rgb(211, 101, 7); --gil-color-object-hightlight: rgb(255, 216, 157); --gil-color-shadow-over-object: rgb(211, 158, 80); --gil-color-background-lines: rgb(140, 140, 140); --gil-color-background-shapes: rgb(242, 242, 242); --gil-color-object-accent-light: rgb(255, 255, 255); --gil-color-object-danger: rgb(255, 0, 61); ``` ##### Using mixins with default gravity-theme in scss Use the following mixins for styling illustrations in different themes ```scss @import '@gravity-ui/illustrations/styles/theme.scss'; .g-root { &_theme_light { @include g-illustrations-colors-light; } &_theme_light-hc { @include g-illustrations-colors-light-hc; } &_theme_dark { @include g-illustrations-colors-dark; } &_theme_dark-hc { @include g-illustrations-colors-dark-hc; } } ``` ##### Alternative for projects with pre-installed gravity theme Alternatively, if `@gravity-ui/uikit` is already installed in the project and default theme is used, you can just import `styles.scss` to the root file with styles in your project: ```scss // existing gravity styles definition import '@gravity-ui/uikit/styles/styles.css'; // just add one more import below import '@gravity-ui/illustrations/styles/styles.scss'; ``` #### Components usage ```js import NotFound from '@gravity-ui/illustrations/NotFound'; ``` or ```js import {NotFound} from '@gravity-ui/illustrations'; ``` ### SVG > You might need an appropriate loader for this ```js import notFound from '@gravity-ui/illustrations/svgs/not-found-light.svg'; ``` ### Development For updating illustrations according to new design, change the content of svg-s in light theme (`/svgs/-light.svg` files) and then run command: ```shell npm run generate ``` ### When to use - Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control. - Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables. - Importing artwork as React components (default) or as raw `.svg` files. ### When not to use - For functional UI iconography (chevrons, checks, buttons), use [`@gravity-ui/icons`](https://gravity-ui.com/icons) — illustrations are decorative artwork, not UI glyphs. - For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package. ### Common pitfalls - **Rendering without a theme import** — illustrations appear uncolored unless you import `@gravity-ui/illustrations/styles/styles.scss` (or define the `--gil-color-*` CSS tokens). - **Hallucinated default export names** — illustration components are PascalCase named exports (e.g. `NotFound`), imported from the package root or per-file (`@gravity-ui/illustrations/NotFound`). - **Importing `.svg` directly in a non-configured bundler** — raw SVG imports need an appropriate loader; prefer the React component export to avoid bundler setup. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/illustrations/main/README.md) - [Storybook](https://preview.gravity-ui.com/illustrations/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/illustrations/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/illustrations) --- > Docs for `@gravity-ui/illustrations@2.1.0`. Versioned at: `https://gravity-ui.com/llms/illustrations/2.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/illustrations/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/illustrations/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/illustrations@2.0.0` # Illustrations > A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons. > > **npm:** `@gravity-ui/illustrations` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/illustrations ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.2.0` | | `react-dom` | `^18.2.0` | ## Usage ### React #### Preparation Setup illustrations theme. Execute any of the following steps: ##### Defining css-tokens with own colors pallete Define following css-tokens in app: ```scss --gil-color-object-base: rgb(255, 190, 92); --gil-color-object-accent-heavy: rgb(211, 101, 7); --gil-color-object-hightlight: rgb(255, 216, 157); --gil-color-shadow-over-object: rgb(211, 158, 80); --gil-color-background-lines: rgb(140, 140, 140); --gil-color-background-shapes: rgb(242, 242, 242); --gil-color-object-accent-light: rgb(255, 255, 255); --gil-color-object-danger: rgb(255, 0, 61); ``` ##### Using mixins with default gravity-theme in scss Use the following mixins for styling illustrations in different themes ```scss @import '@gravity-ui/illustrations/styles/theme.scss'; .g-root { &_theme_light { @include g-illustrations-colors-light; } &_theme_light-hc { @include g-illustrations-colors-light-hc; } &_theme_dark { @include g-illustrations-colors-dark; } &_theme_dark-hc { @include g-illustrations-colors-dark-hc; } } ``` ##### Alternative for projects with pre-installed gravity theme Alternatively, if `@gravity-ui/uikit` is already installed in the project and default theme is used, you can just import `styles.scss` to the root file with styles in your project: ```scss // existing gravity styles definition import '@gravity-ui/uikit/styles/styles.css'; // just add one more import below import '@gravity-ui/illustrations/styles/styles.scss'; ``` #### Components usage ```js import NotFound from '@gravity-ui/illustrations/NotFound'; ``` or ```js import {NotFound} from '@gravity-ui/illustrations'; ``` ### SVG > You might need an appropriate loader for this ```js import notFound from '@gravity-ui/illustrations/svgs/not-found-light.svg'; ``` ### Development For updating illustrations according to new design, change the content of svg-s in light theme (`/svgs/-light.svg` files) and then run command: ```shell npm run generate ``` ### When to use - Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control. - Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables. - Importing artwork as React components (default) or as raw `.svg` files. ### When not to use - For functional UI iconography (chevrons, checks, buttons), use [`@gravity-ui/icons`](https://gravity-ui.com/icons) — illustrations are decorative artwork, not UI glyphs. - For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package. ### Common pitfalls - **Rendering without a theme import** — illustrations appear uncolored unless you import `@gravity-ui/illustrations/styles/styles.scss` (or define the `--gil-color-*` CSS tokens). - **Hallucinated default export names** — illustration components are PascalCase named exports (e.g. `NotFound`), imported from the package root or per-file (`@gravity-ui/illustrations/NotFound`). - **Importing `.svg` directly in a non-configured bundler** — raw SVG imports need an appropriate loader; prefer the React component export to avoid bundler setup. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/illustrations/main/README.md) - [Storybook](https://preview.gravity-ui.com/illustrations/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/illustrations/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/illustrations) --- > Docs for `@gravity-ui/illustrations@2.0.0`. Versioned at: `https://gravity-ui.com/llms/illustrations/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/illustrations/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/illustrations/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/illustrations@1.0.0` # Illustrations > A themed set of flat SVG illustrations (empty states, errors, not-found, etc.) for Gravity UI apps — reach for it when you need ready-made, theme-aware placeholder/empty-state artwork instead of drawing your own or using bare icons. > > **npm:** `@gravity-ui/illustrations` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/illustrations ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.2.0` | | `react-dom` | `^18.2.0` | ## Usage ### React #### Preparation Setup illustrations theme. Execute any of the following steps: ##### Defining css-tokens with own colors pallete Define following css-tokens in app: ```scss --gil-color-object-base: rgb(255, 190, 92); --gil-color-object-accent-heavy: rgb(211, 101, 7); --gil-color-object-hightlight: rgb(255, 216, 157); --gil-color-shadow-over-object: rgb(211, 158, 80); --gil-color-background-lines: rgb(140, 140, 140); --gil-color-background-shapes: rgb(242, 242, 242); --gil-color-object-accent-light: rgb(255, 255, 255); --gil-color-object-danger: rgb(255, 0, 61); ``` ##### Using mixins with default gravity-theme in scss Use the following mixins for styling illustrations in different themes ```scss @import '@gravity-ui/illustrations/styles/theme.scss'; .g-root { &_theme_light { @include g-illustrations-colors-light; } &_theme_light-hc { @include g-illustrations-colors-light-hc; } &_theme_dark { @include g-illustrations-colors-dark; } &_theme_dark-hc { @include g-illustrations-colors-dark-hc; } } ``` ##### Alternative for projects with pre-installed gravity theme Alternatively, if `@gravity-ui/uikit` is already installed in the project and default theme is used, you can just import `styles.scss` to the root file with styles in your project: ```scss // existing gravity styles definition import '@gravity-ui/uikit/styles/styles.css'; // just add one more import below import '@gravity-ui/illustrations/styles/styles.scss'; ``` #### Components usage ```js import NotFound from '@gravity-ui/illustrations/NotFound'; ``` or ```js import {NotFound} from '@gravity-ui/illustrations'; ``` ### SVG > You might need an appropriate loader for this ```js import notFound from '@gravity-ui/illustrations/svgs/not-found-light.svg'; ``` ### Development For updating illustrations according to new design, change the content of svg-s in light theme (`/svgs/-light.svg` files) and then run command: ```shell npm run generate ``` ### When to use - Empty states, 404/error pages, or onboarding placeholders that need a consistent illustration, not a functional UI control. - Themeable artwork — the SVGs respond to Gravity theme tokens (light/dark, high-contrast) via SCSS mixins or CSS variables. - Importing artwork as React components (default) or as raw `.svg` files. ### When not to use - For functional UI iconography (chevrons, checks, buttons), use [`@gravity-ui/icons`](https://gravity-ui.com/icons) — illustrations are decorative artwork, not UI glyphs. - For a single one-off illustration you already have as an asset, import that asset directly rather than pulling in this package. ### Common pitfalls - **Rendering without a theme import** — illustrations appear uncolored unless you import `@gravity-ui/illustrations/styles/styles.scss` (or define the `--gil-color-*` CSS tokens). - **Hallucinated default export names** — illustration components are PascalCase named exports (e.g. `NotFound`), imported from the package root or per-file (`@gravity-ui/illustrations/NotFound`). - **Importing `.svg` directly in a non-configured bundler** — raw SVG imports need an appropriate loader; prefer the React component export to avoid bundler setup. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/illustrations/main/README.md) - [Storybook](https://preview.gravity-ui.com/illustrations/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/illustrations/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/illustrations) --- > Docs for `@gravity-ui/illustrations@1.0.0`. Versioned at: `https://gravity-ui.com/llms/illustrations/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/illustrations/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/illustrations/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.20.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/uikit` | `^7.0.0` | | `final-form` | `^4.20.2` | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-final-form` | `^6.5.3` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.20.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.20.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.19.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.19.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.19.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.18.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.18.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.18.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.17.1` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.17.1`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.17.1/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.16.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.16.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.15.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.15.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.14.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.14.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.13.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.13.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.12.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.12.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@5.11.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-is` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@5.11.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/5.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dynamic-forms@4.17.0` # Dynamic Forms > Library for rendering neat and functional react forms described by JSON schema > > **npm:** `@gravity-ui/dynamic-forms` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/dynamic-forms ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-is` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `final-form` | `^4.20.2` | | `react-final-form` | `^6.5.3` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```jsx import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms'; // To embed in a final-form ; import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms'; // To get an overview of the values ; ``` ### I18N Certain components include text tokens (words and phrases) that are available in two languages: `en` (the default) and `ru`. To set the language, use the `configure` function: ```js // index.js import {configure, Lang} from '@gravity-ui/dynamic-forms'; configure({lang: Lang.Ru}); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/README.md) - [Storybook](https://preview.gravity-ui.com/dynamic-forms/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dynamic-forms/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dynamic-forms) --- > Docs for `@gravity-ui/dynamic-forms@4.17.0`. Versioned at: `https://gravity-ui.com/llms/dynamic-forms/4.17.0/llms.txt` (exact), `https://gravity-ui.com/llms/dynamic-forms/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/dynamic-forms/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.16.0` # @gravity-ui/page-constructor documentation Documentation for the **8.16.0** version of `@gravity-ui/page-constructor`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/page-constructor/build/docs/`). ## For AI agents A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@diplodoc/transform` | `^4.28.2` | | `@gravity-ui/uikit` | `^7.1.1` | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ## Guides - [Data preparation](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/guides/data-preparation.md) — This chapter provides documentaion for server utilities for transforming content, including Yandex Flavored Markdown (YFM) to HTML conversion and text processing. Key features include: - [Подготовка данных](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/guides/data-preparation-ru.md) — Документацию по серверным утилитам для преобразования контента, включая конвертацию Yandex Flavored Markdown (YFM) в HTML и обработку текста. Основные возможности: ## Blocks - [Banner](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Banner.md) — Renders a compact promotional card with a title, subtitle, an optional background image or color, and a single call-to-action button. Use it to highlight a feature, announce a release, or drive traffic to a landing page from anywhere in the page flow. - [CardLayout](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/CardLayout.md) — Renders a responsive grid of arbitrary cards (children) with an optional header and a decorative background image. Use it whenever you need to lay out a homogeneous set of cards — basic, image, background, price, or layout-item — in a row that adapts to the viewport. - [Companies](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Companies.md) — Renders a heading with a logo strip — a set of responsive images (desktop / tablet / mobile) shown beneath an optional title and description. Use it for "trusted by" or "powered by" logo rows that must adapt per device and theme. - [ContentLayout](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/ContentLayout.md) — Renders a single-column content section (title, body text, optional list, links, and buttons) paired with an optional list of downloadable files and a background. Use it for documentation-style sections, terms, descriptions, or anywhere a focused block of text with file attachments is needed. - [ExtendedFeatures](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/ExtendedFeatures.md) — Renders a responsive grid of feature cards, each with an icon, title, text, an optional label (New / Preview), and an optional link. Use it to present a list of product features, capabilities, or benefits in a compact, icon-driven layout. - [FilterBlock](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/FilterBlock.md) — Renders a set of cards grouped by tags, with a row of toggle buttons that lets the visitor filter the visible cards by tag. Use it to present a catalog of cards (articles, features, products) that the user can narrow down without leaving the page. - [FoldableList](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/FoldableList.md) — Renders a two-column block: a content panel on the left (title, text, links, buttons) and a list of collapsible items on the right, each with its own title, YFM text, and optional link. Use it for FAQ-style or specification pages where each row expands to reveal more detail. - [Footer](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Footer.md) — A configurable page footer assembled from optional floors: navigation columns, contacts (social icons), disclaimer, copyright (legal links, language switcher, logo), and an attribution strip. - [Form](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Form.md) — A two-column block that renders a third-party form (Yandex Forms or HubSpot) alongside optional YFM text content, with a configurable layout direction and background. - [Header](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Header.md) — Renders a full-width page header with a title, optional overtitle/description, call-to-action buttons, breadcrumbs, and an optional media asset (image, video, or video iframe) positioned to the right or centered. Use it as the primary hero/landing block at the top of a page. - [HeaderSlider](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/HeaderSlider.md) — Renders a carousel of full-bleed header-block slides — each slide carries its own title, description, buttons, and background media. Use it when the top of the page needs to rotate multiple equally important campaigns or announcements instead of a single hero. - [Hero](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Hero.md) — Renders a modern, content-driven hero block: an overtitle, a rich content column (title, body text, list, links, buttons) and a media column (image/video/iframe) that adapts to its intrinsic aspect ratio. Use it as the primary landing block when you want more layout flexibility than the classic Header provides. - [Icons](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Icons.md) — Renders a responsive grid of small icon items, each consisting of an image and a caption. Items can optionally be wrapped in links, turning the grid into a navigable set of icon links. - [Info](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Info.md) — Renders a two-column information section: a left content column and a right content column, each with its own title, text, lists, buttons, and links, placed inside an optional themed background container. - [Map](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Map.md) — A media-and-content block that embeds an interactive Yandex Map inside a card, paired with an optional title, description, links, and buttons. - [Media](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Media.md) — Renders a two-column layout that pairs a content column (title, body, list, links, button) with a media column (image, video, YouTube, iframe, or DataLens embed). Use it for feature or explainer sections where text and a rich media asset need to sit side by side. - [PromoFeaturesBlock](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/PromoFeaturesBlock.md) — Renders a masonry layout of promotional feature cards, each pairing a title, YFM text, and an optional media asset, displayed against a full-width background. Use it for marketing sections that showcase several value propositions with rich imagery in a non-uniform grid. - [Questions](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Questions.md) — Renders an FAQ block: a left content panel (title, text, links, buttons) and a list of expandable question/answer rows on the right. Automatically emits FAQPage JSON-LD microdata so search engines can index the answers as rich results. - [Share](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Share.md) — Renders a row of social-network share buttons that share the current page URL. - [Slider](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Slider.md) — A carousel block that renders any number of child cards as swipeable slides, with optional title, description, dots, arrows, autoplay, and per-breakpoint slide counts. Built on top of Swiper. - [SliderOld](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/SliderOld.md) - [Table](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Table.md) — Renders a title followed by a comparison-style table whose cells are plain strings or numbers. A legend column can be marked with disk or tick markers, and an optional legend list explains the marked columns. - [Tabs](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/blocks/Tabs.md) — Renders a set of tab buttons that switch between rich content panels. Each tab panel pairs a content column (title, text, lists, buttons, links) with an optional media column (image, video, YouTube, iframe, DataLens), with control over column order, sizing, and border treatment. ## Sub-blocks - [BackgroundCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/BackgroundCard.md) — A card that renders text content (title, text, links, buttons, or a content list) over a decorative background image or solid color. Useful for promotional cards inside a card layout. - [BannerCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/BannerCard.md) — A compact banner card with a title, optional subtitle, a single call-to-action button, and a decorative background image. Designed to draw attention inside a card layout. - [BasicCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/BasicCard.md) — A general-purpose card with an optional icon (image or Gravity UI icon) and text content (title, text, links, buttons, or a content list). The simplest and most versatile card. - [Content](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/Content.md) — A text content block rendering a title, body text, additional info, links, buttons, and/or an icon content list. Used on its own as the textual portion of a content layout. - [Divider](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/Divider.md) — A spacing/separator element that adds vertical space between sibling items, optionally drawing a horizontal line. Useful for tuning rhythm inside a layout. - [HubspotForm](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/HubspotForm.md) — Embeds a HubSpot form inside a page. Loads the HubSpot scripts on demand and renders the form into a container; emits analytics events on submit and supports default field values and form event handlers. - [ImageCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/ImageCard.md) — A card pairing a foreground image with text content (title, text, links, buttons, or a content list). The image and content can be ordered in either direction. - [LayoutItem](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/LayoutItem.md) — Renders a two-part card: a media area (image, video, YouTube, etc.) stacked above a text content area with optional title, body, buttons, links, list, and meta info. Used as the primary content unit inside card-grid blocks. - [MediaCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/MediaCard.md) — Wraps a single media element (image, image slider, video, YouTube, iframe, or DataLens) inside a card with an optional border. Pure media card — no text content. - [PriceCard](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/PriceCard.md) — Renders a pricing card: a title, a price (with optional period and details), a description, a checklist of features, and optional buttons and links. Typically placed in a grid to compare plans. - [PriceDetailed](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/PriceDetailed.md) - [Quote](https://unpkg.com/@gravity-ui/page-constructor@8.16.0/build/docs/sub-blocks/Quote.md) — Renders a customer testimonial / quote card: a logo, the quote body, an optional author (name + avatar + description), and an optional CTA button. Paired with a large image on the side. --- > Docs for `@gravity-ui/page-constructor@8.16.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.15.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.15.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.14.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.14.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.13.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.13.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.12.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.12.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.11.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.11.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.10.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.10.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.9.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.9.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.8.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.8.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@8.7.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@8.7.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/8.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor@7.25.0` # Page constructor > A library for rendering whole web pages or page sections from declarative JSON/YAML config, using a set of ready-made, orderable blocks — reach for it to build marketing/landing pages, not general application UI. > > **npm:** `@gravity-ui/page-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/page-constructor ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.28.2` | ## Usage First, we need a React project and some kind of server. For example, you can create a React project using Vite and an Express server, or you can create Next.js application - it will have a client and server side at once. Install the required dependencies: ```shell npm install @gravity-ui/page-constructor @diplodoc/transform @gravity-ui/uikit ``` Insert the `Page Constructor` to the page. To work correctly, it must be wrapped in a `PageConstructorProvider`: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; const App = () => { const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; return ( ); }; export default App; ``` This was the simplest example of a connection. In order for YFM markup to work, you need to process content on the server and receive it on the client. If your server is a separate application, then you need to install page-constructor: ```shell npm install @gravity-ui/page-constructor ``` To process YFM in all base blocks, call the `contentTransformer` and pass the content and options there: ```ts const express = require('express'); const app = express(); const {contentTransformer} = require('@gravity-ui/page-constructor/server'); const content = { blocks: [ { type: 'header-block', title: 'Hello world', background: {color: '#f0f0f0'}, description: '**Congratulations!** Have you built a [page-constructor](https://github.com/gravity-ui/page-constructor) into your website', }, ], }; app.get('/content', (req, res) => { res.send({content: contentTransformer({content, options: {lang: 'en'}})}); }); app.listen(3000); ``` On the client, add an endpoint call to receive content: ```tsx import {PageConstructor, PageConstructorProvider} from '@gravity-ui/page-constructor'; import '@gravity-ui/page-constructor/styles/styles.scss'; import {useEffect, useState} from 'react'; const App = () => { const [content, setContent] = useState(); useEffect(() => { (async () => { const response = await fetch('http://localhost:3000/content').then((r) => r.json()); setContent(response.content); })(); }, []); return ( ); }; export default App; ``` ### Ready-made template To start a new project, you can use the [ready-made template on Next.js ](https://github.com/gravity-ui/page-constructor-website-template) which we have prepared. ### Static site builder [Page Constructor Builder](https://github.com/gravity-ui/page-constructor-builder) - command-line utility for building static pages from YAML configurations using the @gravity-ui/page-constructor ### When to use - Data-driven pages: render a `content` config of typed blocks with `PageConstructor` wrapped in `PageConstructorProvider`. - Marketing, landing, and documentation pages assembled from prebuilt blocks (headers, media, cards, etc.). - Server-side YFM processing of block text via the `@gravity-ui/page-constructor/server` utilities (`contentTransformer`, `fullTransform`). - Reusing just the responsive grid (`Grid`/`Row`/`Col`) or `Navigation` component standalone. ### When not to use - General application UI (buttons, forms, modals) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Editing Markdown/YFM content — use [`@gravity-ui/markdown-editor`](https://github.com/gravity-ui/markdown-editor). - App navigation shells (aside header) — use [`@gravity-ui/navigation`](https://github.com/gravity-ui/navigation); this package's `Navigation` is a page-level top nav. ### Common pitfalls - **`PageConstructor` must be wrapped in `PageConstructorProvider`.** Rendering it bare breaks context (locale, theme, SSR, analytics). - **The content prop is `content`, shaped `{blocks: [...]}`.** Each block object needs a `type` matching a known block plus its data fields; there is no `data`/`config` prop. - **YFM in block text needs server processing.** Markdown-like fields render as plain text unless you run content through `contentTransformer`/`fullTransform` from `@gravity-ui/page-constructor/server`; `@diplodoc/transform` is a required peer dependency. - **Import the SCSS styles.** Add `@gravity-ui/page-constructor/styles/styles.scss` (SCSS, not CSS); custom blocks import the same file to reuse mixins/variables. - **Vite needs `vite-plugin-dynamic-import`.** Dynamic block imports fail under Vite without it. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/README.md) - [Storybook](https://preview.gravity-ui.com/page-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor) --- > Docs for `@gravity-ui/page-constructor@7.25.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor/7.25.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/page-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@11.0.1` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@11.0.1`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/11.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/11/llms.txt` (latest of major 11), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@11.0.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@11.0.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/11.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/11/llms.txt` (latest of major 11), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@10.1.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@10.1.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/10.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@10.0.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@10.0.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/10.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@9.1.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@9.1.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/9.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@9.0.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^8.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@9.0.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/9.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@8.5.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^7.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@8.5.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/8.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@8.4.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^7.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@8.4.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/8.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@8.3.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^7.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@8.3.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/8.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@8.2.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^7.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@8.2.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/8.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/blog-constructor@8.1.0` # Blog Constructor > A library based on the Page constructor library for creating blog-like services. > > **npm:** `@gravity-ui/blog-constructor` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/blog-constructor ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `@diplodoc/transform` | `^4.10.7` | | `@gravity-ui/page-constructor` | `^7.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/README.md) - [Storybook](https://preview.yandexcloud.dev/blog-constructor/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/blog-constructor/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/blog-constructor) --- > Docs for `@gravity-ui/blog-constructor@8.1.0`. Versioned at: `https://gravity-ui.com/llms/blog-constructor/8.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/blog-constructor/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/blog-constructor/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@8.0.1` # @gravity-ui/chartkit documentation Documentation for the **8.0.1** version of `@gravity-ui/chartkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/chartkit/build/docs/`). ## For AI agents A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/uikit` | `^7.0.0` | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ## Guides - [Testing Guide](https://unpkg.com/@gravity-ui/chartkit@8.0.1/build/docs/guides/testing.md) --- > Docs for `@gravity-ui/chartkit@8.0.1`. Versioned at: `https://gravity-ui.com/llms/chartkit/8.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@8.0.0` # @gravity-ui/chartkit documentation Documentation for the **8.0.0** version of `@gravity-ui/chartkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/chartkit/build/docs/`). ## For AI agents A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ## Guides - [Testing Guide](https://unpkg.com/@gravity-ui/chartkit@8.0.0/build/docs/guides/testing.md) --- > Docs for `@gravity-ui/chartkit@8.0.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/8.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.62.1` # @gravity-ui/chartkit documentation Documentation for the **7.62.1** version of `@gravity-ui/chartkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/chartkit/build/docs/`). ## For AI agents A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ## Guides - [Testing Guide](https://unpkg.com/@gravity-ui/chartkit@7.62.1/build/docs/guides/testing.md) --- > Docs for `@gravity-ui/chartkit@7.62.1`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.62.1/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.62.0` # @gravity-ui/chartkit documentation Documentation for the **7.62.0** version of `@gravity-ui/chartkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/chartkit/build/docs/`). ## For AI agents A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ## Guides - [Testing Guide](https://unpkg.com/@gravity-ui/chartkit@7.62.0/build/docs/guides/testing.md) --- > Docs for `@gravity-ui/chartkit@7.62.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.62.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.61.0` # @gravity-ui/chartkit documentation Documentation for the **7.61.0** version of `@gravity-ui/chartkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/chartkit/build/docs/`). ## For AI agents A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ## Guides - [Testing Guide](https://unpkg.com/@gravity-ui/chartkit@7.61.0/build/docs/guides/testing.md) --- > Docs for `@gravity-ui/chartkit@7.61.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.61.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.60.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.60.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.60.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.59.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.59.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.59.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.58.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.58.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.58.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.57.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.57.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.57.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.56.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.56.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.56.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.55.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.55.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.55.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/chartkit@7.54.0` # ChartKit > A plugin-dispatching React component that renders charts from multiple Gravity UI charting libraries through one `` API — reach for it when you need a single lazy-loading entry point for mixed chart types, instead of importing each chart library directly. > > **npm:** `@gravity-ui/chartkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install @gravity-ui/chartkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### Requirements - React 16, 17, or 18 - `[@gravity-ui/uikit](https://github.com/gravity-ui/uikit)` — required peer dependency (provides theming and UI primitives) ### Styles Import the styles from `@gravity-ui/uikit` in your entry point: ```tsx import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; ``` For full setup details see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles). ### Basic usage ChartKit uses a global plugin registry. Call `settings.set` once at your app entry point to register the plugins you need. When `` renders, it looks up the matching plugin — if none is found, an error is thrown. Each plugin's renderer is a `React.lazy` component, so its code is fetched only when ChartKit first appears in the UI. You can register multiple plugins at once: ```ts settings.set({plugins: [GravityChartsPlugin, YagrPlugin]}); ``` Or call `settings.set` multiple times — it merges the plugin list rather than replacing it. **Basic example:** ```tsx import {ThemeProvider} from '@gravity-ui/uikit'; import ChartKit, {settings} from '@gravity-ui/chartkit'; import {GravityChartsPlugin} from '@gravity-ui/chartkit/gravity-charts'; import '@gravity-ui/uikit/styles/fonts.css'; import '@gravity-ui/uikit/styles/styles.css'; settings.set({plugins: [GravityChartsPlugin]}); const data = { series: { data: [ { type: 'line', name: 'Series', data: [ {x: 0, y: 10}, {x: 1, y: 25}, {x: 2, y: 18}, {x: 3, y: 30}, ], }, ], }, }; export default function App() { return (
); } ``` `ChartKit` adapts to its parent's size — make sure the container has an explicit height. ### When to use - Rendering more than one charting engine (e.g. `gravity-charts` + `yagr`) behind one consistent component. - Lazy-loading chart bundles — each plugin's renderer is `React.lazy`, so a library's code is only fetched when its chart type is actually shown. - Bundling charts into a Gravity UI app that wants mobile-friendly tooltips and unified theming out of the box. ### When not to use - For a single chart type only, import [`@gravity-ui/charts`](https://github.com/gravity-ui/charts) (general) or [`@gravity-ui/yagr`](https://github.com/gravity-ui/yagr) (high-performance time-series) directly — the plugin registry is overhead for one engine. - To compose a dashboard grid of widgets, use [`@gravity-ui/dashkit`](https://github.com/gravity-ui/dashkit) — ChartKit renders a chart; DashKit arranges many widgets. ### Common pitfalls - **Rendering `` before `settings.set({plugins: [...]})`** — the global plugin registry must be populated at app entry; an unregistered `type` throws at render time. - **Hallucinated prop `chartType` / `library`** — the dispatch prop is `type` (e.g. `type="gravity-charts"`), and the data is `data`. - **Forgetting a container height** — `ChartKit` fills its parent; without an explicit height on the wrapper, the chart collapses to zero. - **Expecting plugins to be bundled** — plugin renderers (`@gravity-ui/chartkit/gravity-charts`, `.../yagr`) are lazy; the first render of a type fetches its bundle. - **Missing the uikit styles import** — theming depends on `@gravity-ui/uikit/styles/styles.css`; without it, charts render unstyled. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/chartkit/main/README.md) - [Storybook](https://preview.gravity-ui.com/chartkit/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/chartkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/chartkit) --- > Docs for `@gravity-ui/chartkit@7.54.0`. Versioned at: `https://gravity-ui.com/llms/chartkit/7.54.0/llms.txt` (exact), `https://gravity-ui.com/llms/chartkit/7/llms.txt` (latest of major 7), `https://gravity-ui.com/llms/chartkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.20.1` # @gravity-ui/table documentation Documentation for the **1.20.1** version of `@gravity-ui/table`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/table/build/docs/`). ## For AI agents A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render ``.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@dnd-kit/core` | `^6.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | | `lodash` | `^4.17.0` | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ## Guides - [Migration Guide: From Table (@gravity-ui/uikit) to Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.20.1/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table.md) - [Руководство по миграции с Table (@gravity-ui/uikit) на Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.20.1/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table-ru.md) ## Components - [BaseTable](https://unpkg.com/@gravity-ui/table@1.20.1/build/docs/components/BaseTable.md) — The unstyled, low-level table renderer — renders a useTable instance as raw
markup without Gravity UI styling, for full visual control. ## Hooks - [useColumnsAutoSize](https://unpkg.com/@gravity-ui/table@1.20.1/build/docs/hooks/useColumnsAutoSize.md) — A React hook that automatically calculates column widths based on measured content, supporting primitives and React nodes, accessorKey/accessorFn columns, custom cell renderers, and respect for predefined or user-resized widths. --- > Docs for `@gravity-ui/table@1.20.1`. Versioned at: `https://gravity-ui.com/llms/table/1.20.1/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.20.0` # @gravity-ui/table documentation Documentation for the **1.20.0** version of `@gravity-ui/table`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/table/build/docs/`). ## For AI agents A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ## Guides - [Migration Guide: From Table (@gravity-ui/uikit) to Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.20.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table.md) - [Руководство по миграции с Table (@gravity-ui/uikit) на Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.20.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table-ru.md) ## Components - [BaseTable](https://unpkg.com/@gravity-ui/table@1.20.0/build/docs/components/BaseTable.md) — The unstyled, low-level table renderer — renders a useTable instance as raw
markup without Gravity UI styling, for full visual control. ## Hooks - [useColumnsAutoSize](https://unpkg.com/@gravity-ui/table@1.20.0/build/docs/hooks/useColumnsAutoSize.md) — A React hook that automatically calculates column widths based on measured content, supporting primitives and React nodes, accessorKey/accessorFn columns, custom cell renderers, and respect for predefined or user-resized widths. --- > Docs for `@gravity-ui/table@1.20.0`. Versioned at: `https://gravity-ui.com/llms/table/1.20.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.19.0` # @gravity-ui/table documentation Documentation for the **1.19.0** version of `@gravity-ui/table`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/table/build/docs/`). ## For AI agents A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ## Guides - [Migration Guide: From Table (@gravity-ui/uikit) to Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.19.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table.md) - [Руководство по миграции с Table (@gravity-ui/uikit) на Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.19.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table-ru.md) ## Components - [BaseTable](https://unpkg.com/@gravity-ui/table@1.19.0/build/docs/components/BaseTable.md) — The unstyled, low-level table renderer — renders a useTable instance as raw
markup without Gravity UI styling, for full visual control. ## Hooks - [useColumnsAutoSize](https://unpkg.com/@gravity-ui/table@1.19.0/build/docs/hooks/useColumnsAutoSize.md) — A React hook that automatically calculates column widths based on measured content, supporting primitives and React nodes, accessorKey/accessorFn columns, custom cell renderers, and respect for predefined or user-resized widths. --- > Docs for `@gravity-ui/table@1.19.0`. Versioned at: `https://gravity-ui.com/llms/table/1.19.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.18.0` # @gravity-ui/table documentation Documentation for the **1.18.0** version of `@gravity-ui/table`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/table/build/docs/`). ## For AI agents A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ## Guides - [Migration Guide: From Table (@gravity-ui/uikit) to Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.18.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table.md) - [Руководство по миграции с Table (@gravity-ui/uikit) на Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.18.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table-ru.md) ## Components - [BaseTable](https://unpkg.com/@gravity-ui/table@1.18.0/build/docs/components/BaseTable.md) — The unstyled, low-level table renderer — renders a useTable instance as raw
markup without Gravity UI styling, for full visual control. ## Hooks - [useColumnsAutoSize](https://unpkg.com/@gravity-ui/table@1.18.0/build/docs/hooks/useColumnsAutoSize.md) — A React hook that automatically calculates column widths based on measured content, supporting primitives and React nodes, accessorKey/accessorFn columns, custom cell renderers, and respect for predefined or user-resized widths. --- > Docs for `@gravity-ui/table@1.18.0`. Versioned at: `https://gravity-ui.com/llms/table/1.18.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.17.0` # @gravity-ui/table documentation Documentation for the **1.17.0** version of `@gravity-ui/table`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/table/build/docs/`). ## For AI agents A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ## Guides - [Migration Guide: From Table (@gravity-ui/uikit) to Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.17.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table.md) - [Руководство по миграции с Table (@gravity-ui/uikit) на Table (@gravity-ui/table)](https://unpkg.com/@gravity-ui/table@1.17.0/build/docs/guides/migration-from-uikit-table/migration-from-uikit-table-ru.md) ## Components - [BaseTable](https://unpkg.com/@gravity-ui/table@1.17.0/build/docs/components/BaseTable.md) — The unstyled, low-level table renderer — renders a useTable instance as raw
markup without Gravity UI styling, for full visual control. ## Hooks - [useColumnsAutoSize](https://unpkg.com/@gravity-ui/table@1.17.0/build/docs/hooks/useColumnsAutoSize.md) — A React hook that automatically calculates column widths based on measured content, supporting primitives and React nodes, accessorKey/accessorFn columns, custom cell renderers, and respect for predefined or user-resized widths. --- > Docs for `@gravity-ui/table@1.17.0`. Versioned at: `https://gravity-ui.com/llms/table/1.17.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.16.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.16.0`. Versioned at: `https://gravity-ui.com/llms/table/1.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.15.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.15.0`. Versioned at: `https://gravity-ui.com/llms/table/1.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.13.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.13.0`. Versioned at: `https://gravity-ui.com/llms/table/1.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.12.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `lodash` | `^4.17.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.12.0`. Versioned at: `https://gravity-ui.com/llms/table/1.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.11.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.11.0`. Versioned at: `https://gravity-ui.com/llms/table/1.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@1.10.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@dnd-kit/sortable` | `^8.0.0 || ^9.0.0 || ^10.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0 || ^7.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@1.10.0`. Versioned at: `https://gravity-ui.com/llms/table/1.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/table@0.9.0` # Table > A headless, TanStack-Table-powered data grid for Gravity UI apps — reach for it for sortable, selectable, groupable, reorderable, and virtualized tables instead of composing raw markup on top of uikit's basic `Table`. > > **npm:** `@gravity-ui/table` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save @gravity-ui/table ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0` | | `@dnd-kit/core` | `^6.0.0` | | `@dnd-kit/sortable` | `^8.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```tsx import React from 'react'; import {Table, useTable} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Person[] = [ {id: 'name', name: 'John', age: 23}, {id: 'age', name: 'Michael', age: 27}, ]; const BasicExample = () => { const table = useTable({ columns, data, }); return
; }; ``` ### Components There are two Table components that you can use: - `BaseTable` - a component with basic styles only; - `Table` - a component with Gravity UI based styles. #### Row selection ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {RowSelectionState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowSelectionExample = () => { const [rowSelection, setRowSelection] = React.useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 #### Custom Ranged Selection Column The `useToggleRangeSelectionHandler` hook returns a change handler that listens for Shift+click events and performs ranged row selection. It needs to be passed a `CellContext` instance in order to have access to the table's and row's internal states. ```tsx import React, {type ChangeEvent, useCallback, useState} from 'react'; import {Table, useToggleRangeSelectionHandler, useTable} from '@gravity-ui/table'; import type {CellContext, ColumnDef, RowSelectionState} from '@gravity-ui/table/tanstack'; import {Checkbox, type CheckboxProps} from '@gravity-ui/uikit'; type CustomRangedSelectionCheckboxProps = Omit & { cellContext: CellContext; }; const CustomRangedSelectionCheckbox = ({ className, cellContext, ...restProps }: CustomRangedSelectionCheckboxProps) => { const rowToggleRangedSelectionHandler = useToggleRangeSelectionHandler(cellContext); const handleChange = useCallback( (event: ChangeEvent): void => { rowToggleRangedSelectionHandler(event); }, [rowToggleRangedSelectionHandler], ); return ; }; const customSelectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), size: 41, maxSize: 41, minSize: 41, enableResizing: false, enableSorting: false, }; const columns: ColumnDef[] = [ customSelectionColumn as ColumnDef, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const RowRangedSelectionExample = () => { const [rowSelection, setRowSelection] = useState({}); const table = useTable({ columns, data, enableRowSelection: true, enableMultiRowSelection: true, onRowSelectionChange: setRowSelection, state: { rowSelection, }, }); return
; }; ``` There is also a `RangedSelectionCheckbox` component, which internally uses the hook and accepts a `CellContext` instance as a prop. This component provides a shorthand for adding ranged selection functionality to custom selection columns. ```tsx import type {ColumnDef} from '@gravity-ui/table/tanstack'; import {RangedSelectionCheckbox, SelectionCheckbox} from '@gravity-ui/table'; export const selectionColumn: ColumnDef = { id: '_select', header: ({table}) => ( ), cell: (cellContext) => ( ), meta: { hideInSettings: true, }, size: 32, minSize: 32, }; ``` By default, the selection column generated with `selectionColumn` includes ranged selection functionality. ```tsx import {selectionColumn} from '@gravity-ui/table'; import type {ColumnDef} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ selectionColumn as ColumnDef, // ...other columns ]; ``` **Note**: If the table contains nested rows, range selection will not work. At the moment, this is considered undefined behavior. #### Sorting Learn about the column properties in the react-table [docs](https://tanstack.com/table/v8/docs/guide/sorting) ```tsx import type {SortingState} from '@gravity-ui/table/tanstack'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const SortingExample = () => { const [sorting, setSorting] = React.useState([]); // Your column MUST have accessorFn for sorting to be enabled const table = useTable({ columns, data, enableSorting: true, getRowId: (item) => item.id, onSortingChange: setSorting, state: { sorting, }, }); return
; }; ``` If you want to sort the elements manually pass `manualSorting` property: ```tsx const table = useTable({ // ... manualSorting: true, }); ``` #### Grouping ```tsx import type {ExpandedState, Row} from '@gravity-ui/table/tanstack'; interface Person { id: string; name: string; age: number; } interface PersonGroup { id: string; name: string; items: Person[]; } type Item = PersonGroup | Person; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 200}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const data: Item[] = [ { id: 'friends', name: 'Friends', items: [ {id: 'nick', name: 'Nick', age: 25}, {id: 'tom', name: 'Tom', age: 21}, ], }, { id: 'relatives', name: 'Relatives', items: [ {id: 'john', name: 'John', age: 23}, {id: 'michael', name: 'Michael', age: 27}, ], }, ]; const getGroupTitle = (row: Row) => row.getValue('name'); const GroupingExample = () => { const [expanded, setExpanded] = React.useState({}); const table = useTable({ columns, data, enableExpanding: true, getSubRows: (item) => ('items' in item ? item.items : undefined), onExpandedChange: setExpanded, state: { expanded, }, }); return
; }; ``` To use grouping with selection, use `useRowSelectionFixedHandler` hook. Without it parent row checkbox state will be wrong. https://github.com/TanStack/table/issues/4878 To enable nesting styles, pass `withNestingStyles = true` in the column configuration. Nesting indicators can be disabled by passing `showTreeDepthIndicators = false`. To add a control for expanding/collapsing rows, wrap the cell content with the `TreeExpandableCell` component or with your similar custom component: ```tsx import {TreeExpandableCell} from '@gravity-ui/table'; const columns: ColumnDef[] = [ { accessorKey: 'name', header: 'Name', size: 200, showTreeDepthIndicators: false, withNestingStyles: true, cell: ({row, info}) => ( {info.getValue()} ), }, // ...other columns ]; ``` #### Reordering ```tsx import type {ReorderingProviderProps} from '@gravity-ui/table'; import {dragHandleColumn, ReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, // ...other columns ]; const data: Person[] = [ /* ... */ ]; const ReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const handleReorder = React.useCallback< NonNullable['onReorder']> >( ({ draggedItemKey, targetItemKey, baseItemKey, baseNextItemKey, enableNesting, nextChild, pullFromParent, }) => { // ... }, [], ); return (
); }; ``` #### Reordering without a drag handle Set `dragWithoutHandle` to use the whole row as the drag activator and omit `dragHandleColumn` from the column definitions: ```tsx const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; return (
); ``` The pointer must move by 8 pixels before dragging starts, so regular row and control clicks keep working. To exclude a custom part of a row from starting a drag, call `preventDefault()` in its `onPointerDown` handler. #### Column reordering Wrap the table with `ColumnReorderingProvider` to enable drag-and-drop reordering of columns by their headers. ```tsx import {ColumnReorderingProvider} from '@gravity-ui/table'; const columns: ColumnDef[] = [ {accessorKey: 'name', header: 'Name', size: 100}, {accessorKey: 'age', header: 'Age', size: 100}, ]; const ColumnReorderingExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); return (
); }; ``` ### Row and column reordering together Nest `ColumnReorderingProvider` and `ReorderingProvider` to enable both drag axes at once. The order of providers does not matter — they share a single dnd-kit context internally. ```tsx import type {ColumnReorderingProviderProps, ReorderingProviderProps} from '@gravity-ui/table'; import {ColumnReorderingProvider, ReorderingProvider, dragHandleColumn} from '@gravity-ui/table'; const columns: ColumnDef[] = [ dragHandleColumn, {accessorKey: 'name', header: 'Name'}, {accessorKey: 'age', header: 'Age'}, ]; const CombinedReorderingExample = () => { const [data, setData] = React.useState(initialData); const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, getRowId: (item) => item.id, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); const handleRowReorder = React.useCallback< NonNullable['onReorder']> >(({draggedItemKey, baseItemKey}) => { // update data array }, []); const handleColumnReorder = React.useCallback< NonNullable['onReorder']> >(({columnOrder}) => { setColumnOrder(columnOrder); }, []); return (
); }; ``` If you control `columnOrder` yourself (e.g. to persist it), pass `onReorder` and apply the resulting order: ```tsx const [columnOrder, setColumnOrder] = React.useState([]); const table = useTable({ columns, data, state: {columnOrder}, onColumnOrderChange: setColumnOrder, }); return ( setColumnOrder(columnOrder)} >
); ``` CSS API: | CSS variable | Default | Description | | -------------------------------------------- | ----------------------------- | -------------------------------- | | `--gt-table-reordering-insertion-line-color` | `#4d8bff` | Color of the drop insertion line | | `--gt-table-reordering-insertion-line-width` | `2px` | Width of the drop insertion line | | `--gt-table-reordering-dragged-opacity` | `0.4` | Opacity of the dragged column | | `--gt-table-drag-overlay-background` | `#fff` | Drag preview background | | `--gt-table-drag-overlay-shadow` | `0 3px 12px rgba(0,0,0,0.15)` | Drag preview box-shadow | | `--gt-table-drag-overlay-border-radius` | `6px` | Drag preview border radius | To forbid reordering a specific column, set `enableColumnReordering: false` in its column definition. Placeholder (grouped) columns are not draggable. Use `activationDistance` (default `8`) to tune how far the pointer must move before a drag starts, which keeps header clicks (like sorting) working. Pinned columns can be reordered too, but only among themselves: a column can be moved within the left-pinned group, the right-pinned group, or the center (non-pinned) group — it never crosses a pin boundary by dragging. ```tsx { if (pinned) { setColumnPinning(columnPinning); } else { setColumnOrder(columnOrder); } }} >
``` While dragging: - a floating preview of the column (its header plus the first rows) follows the pointer in a drag overlay; - the dragged column becomes semi-transparent; - a blue insertion line is drawn where the column will be dropped; ```tsx } >
``` #### Virtualization Use if you want to use grid container as the scroll element (if you want to use window see window virtualization section). Be sure to set a fixed height on the container; otherwise, virtualization will not work. ```tsx import {useRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const VirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const containerRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, getScrollElement: () => containerRef.current, }); return (
); }; ``` If you use virtualization with reordering feature you also need to pass `rangeExtractor` option: ```tsx import {getVirtualRowRangeExtractor} from '@gravity-ui/table'; // ... const tableRef = React.useRef(null); const rowVirtualizer = useRowVirtualizer({ // ... rangeExtractor: getVirtualRowRangeExtractor(tableRef.current), }); return ( ); ``` #### Window virtualization Use if you want to use window as the scroll element ```tsx import {useWindowRowVirtualizer} from '@gravity-ui/table'; const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const WindowVirtualizationExample = () => { const table = useTable({ columns, data, getRowId: (item) => item.id, }); const bodyRef = React.useRef(null); const rowVirtualizer = useWindowRowVirtualizer({ count: table.getRowModel().rows.length, estimateSize: () => 20, overscan: 5, scrollMargin: bodyRef.current?.offsetTop ?? 0, }); return
; }; ``` #### Resizing ```tsx const columns: ColumnDef[] = [ /* ... */ ]; const data: Person[] = [ /* ... */ ]; const ResizingDemo = () => { const table = useTable({ columns, data, enableColumnResizing: true, columnResizeMode: 'onChange', }); return
; }; ``` #### Column settings ```tsx const columns: ColumnDef[] = [ // ...other columns { id: 'settings_column_id', header: ({table}) => , meta: { hideInSettings: false, // Optional. Allows to hide this column from settings popover titleInSettings: 'ReactNode', // Optional. Overrides header field for settings popover (if you need different content for header and settings popover) }, }, // or you can use function getSettingsColumn ]; const data: Person[] = [ /* ... */ ]; const TableSettingsDemo = () => { const [columnVisibility, onColumnVisibilityChange] = React.useState({ // for outside control and initial state column_id: false, // for hidding by default }); const [columnOrder, onColumnOrderChange] = React.useState([ /* leaf columns ids */ ]); // for outside control and initial state // Alternative variant to get state, callbacks, and set on setting apply callbacks - using useTableSettings hook: // const {state, callbacks} = useTableSettings({initialVisibility: {}, initialOrder: []}) const table = useTable({ columns, data, state: { columnVisibility, columnOrder, }, onColumnVisibilityChange, onColumnOrderChange, }); return
; }; ``` Learn more about the table and the column resizing properties in the react-table [docs](https://tanstack.com/table/v8/docs/api/features/column-sizing) ### When to use - Large datasets that need row or window virtualization (`useRowVirtualizer`, `useWindowRowVirtualizer`). - Column sorting, resizing, reordering (`ColumnReorderingProvider`), pinning, and per-user column settings (`TableSettings`). - Row selection (single/multi, ranged) and tree/grouped rows with expandable cells. ### When not to use - A simple, static table with a handful of rows and no advanced features — uikit's built-in `Table` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit) is lighter. - A non-tabular list — use `List` from [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Spreadsheet-style inline cell editing — this grid is read/display-focused, not an editable spreadsheet. ### Common pitfalls - **You build the table with `useTable`, then render `
`.** The main prop is `table` (the instance), not `data`/`columns` directly on `
`; pass `data` and `columns` to `useTable`. - **Types come from the `@gravity-ui/table/tanstack` subpath.** Import `ColumnDef`, `RowSelectionState`, `SortingState`, etc. from `@gravity-ui/table/tanstack`, not from the package root. - **Sorting needs an accessor.** A column must have `accessorKey`/`accessorFn` for sorting to work; set `enableSorting` and provide `getRowId`. - **React 19 + React Compiler can skip re-renders.** This is an upstream TanStack Table issue — add the `'use no memo'` directive to the component or memoize `data`. - **Range selection breaks with nested rows.** Ranged selection is undefined behavior when the table has grouped/nested rows; use `useRowSelectionFixedHandler` for correct parent-checkbox state with grouping. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/table/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/table/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/table) --- > Docs for `@gravity-ui/table@0.9.0`. Versioned at: `https://gravity-ui.com/llms/table/0.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/table/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/table/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.4.1` # @gravity-ui/dashkit documentation Documentation for the **10.4.1** version of `@gravity-ui/dashkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/dashkit/build/docs/`). ## 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | | `react` | `^16.8.0 || ^17 || ^18 || ^19` | | `react-dom` | `^16.8.0 || ^17 || ^18 || ^19` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` --- > Docs for `@gravity-ui/dashkit@10.4.1`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.4.1/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.4.0` # @gravity-ui/dashkit documentation Documentation for the **10.4.0** version of `@gravity-ui/dashkit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/dashkit/build/docs/`). ## 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18 || ^19` | | `react-dom` | `^16.8.0 || ^17 || ^18 || ^19` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` --- > Docs for `@gravity-ui/dashkit@10.4.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.3.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18 || ^19` | | `react-dom` | `^16.8.0 || ^17 || ^18 || ^19` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@10.3.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.2.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18 || ^19` | | `react-dom` | `^16.8.0 || ^17 || ^18 || ^19` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@10.2.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.1.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@10.1.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@10.0.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@10.0.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/10.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/10/llms.txt` (latest of major 10), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@9.3.2` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@9.3.2`. Versioned at: `https://gravity-ui.com/llms/dashkit/9.3.2/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@9.3.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@9.3.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/9.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@9.2.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@9.2.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/9.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@9.1.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@9.1.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/9.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@9.0.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/icons` | `^2.13.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@9.0.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/9.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/9/llms.txt` (latest of major 9), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dashkit@8.27.0` # DashKit > 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. > > **npm:** `@gravity-ui/dashkit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i @gravity-ui/dashkit @gravity-ui/uikit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.8.0 || ^17 || ^18` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ### DashKit configuration Before using `DashKit` as a react component, it must be configured. - set language ```js import {configure, Lang} from '@gravity-ui/uikit'; configure({lang: Lang.En}); ``` - DashKit.setSettings Used for global DashKit settings (such as margins between widgets, default widget sizes and widget overlay menu) ```js import {DashKit} from '@gravity-ui/dashkit'; DashKit.setSettings({ gridLayout: {margin: [8, 8]}, isMobile: true, // menu: [] as Array, }); ``` - DashKit.registerPlugins Registering and configuring plugins ```js import {DashKit} from '@gravity-ui/dashkit'; import {pluginTitle, pluginText} from '@gravity-ui/dashkit'; DashKit.registerPlugins( pluginTitle, pluginText.setSettings({ apiHandler({text}) { return api.getMarkdown(text); }, }), ); DashKit.registerPlugins({ type: 'custom', defaultLayout: { w: 10, h: 8, }, renderer: function CustomPlugin() { return
Custom widget with custom controls
; }, }); ``` ### Config ```ts export interface Config { salt: string; // to form a unique id counter: number; // to form a unique id, only increases items: ConfigItem[]; // initial widget states layout: ConfigLayout[]; // widget position on the grid https://github.com/react-grid-layout aliases: ConfigAliases; // aliases for parameters see #Params connections: ConfigConnection[]; // links between widgets see #Params } ``` Config example: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const config: DashKitProps['config'] = { salt: '0.46703554571365613', counter: 4, items: [ { id: 'tT', data: { size: 'm', text: 'Caption', showInTOC: true, }, type: 'title', namespace: 'default', orderId: 1, }, { id: 'Ea', data: { text: 'mode _editActive', _editActive: true, }, type: 'text', namespace: 'default', }, { id: 'zR', data: { text: '### Text', }, type: 'text', namespace: 'default', orderId: 0, }, { id: 'Dk', data: { foo: 'bar', }, type: 'custom', namespace: 'default', orderId: 5, }, ], layout: [ { h: 2, i: 'tT', w: 36, x: 0, y: 0, }, { h: 6, i: 'Ea', w: 12, x: 0, y: 2, }, { h: 6, i: 'zR', w: 12, x: 12, y: 2, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 8, }, ], aliases: {}, connections: [], }; ``` Add a new item to the config: ```ts const newLayout = updateLayout: [ { h: 6, i: 'Ea', w: 12, x: 0, y: 6, }, { h: 4, i: 'Dk', w: 8, x: 0, y: 12, }, ]; const newConfig = DashKit.setItem({ item: { data: { text: `Some text`, }, namespace: 'default', type: 'text', // Optional. If new item needed to be inserted in current layout with predefined dimensions layout: { // Current item inseterted before 'Ea' h: 6, w: 12, x: 0, y: 2, },, }, config: config, options: { // Optional. New layout values for existing items when new element is dropped from ActionPanel updateLayout: newLayout, }, }); ``` Change an existing item in the config: ```ts const newConfig = DashKit.setItem({ item: { id: 'tT', // item.id data: { size: 'm', text: `New caption`, }, namespace: 'default', type: 'title', }, config: config, }); ``` Delete an item from the config: ```ts import {DashKitProps} from '@gravity-ui/dashkit'; const oldItemsStateAndParams: DashKitProps['itemsStateAndParams'] = {}; const {config: newConfig, itemsStateAndParams} = DashKit.removeItem({ id: 'tT', // item.id config: config, itemsStateAndParams: this.state.itemsStateAndParams, }); ``` ### Params ```ts type Params = Record; ``` `DashKit` generates parameters according to the default parameters for widgets, links, and aliases. These parameters are required for the [ChartKit](https://github.com/gravity-ui/chartkit) library. Generation order: 1. `defaultGlobalParams` 2. Default widget parameters `item.default` 3. `globalParams` 4. Parameters from [itemsStateAndParams](#itemsStateAndParams) according to the queue. ### itemsStateAndParams Object that stores widget parameters and states as well as a parameter change queue. It has a `__meta__` field for storing queue and meta information. ```ts interface StateAndParamsMeta = { __meta__: { queue: {id: string}[]; // queue version: number; // current version itemsStateAndParams }; } ``` And also widget states and parameters: ```ts interface ItemsStateAndParamsBase { [itemId: string]: { state?: Record; params?: Params; }; } ``` ```ts type ItemsStateAndParams = StateAndParamsMeta & ItemsStateAndParamsBase; ``` ### Experimental DashKit events > Experimental: this API can change in minor releases. `DashKit` exposes an experimental instance event API. Use a component ref and subscribe with `dashkitRef.current?.on(eventName, handler)`. The method returns an unsubscribe callback. The first supported event is `change`. It is emitted when the layout changes, before `onChange` is called. The handler can read the full next and previous layouts, read layout patches, or call `preventDefault()` to stop the default `onChange` call. ```tsx import React from 'react'; import {DashKit} from '@gravity-ui/dashkit'; import type {DashKitChangeEvent} from '@gravity-ui/dashkit'; function Dashboard() { const dashkitRef = React.useRef(null); React.useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event: DashKitChangeEvent) => { console.log(event.patches); if (event.patches.length > 0) { event.preventDefault(); } }); return () => unsubscribe?.(); }, []); return ; } ``` ```ts type DashKitLayoutPatch = Pick & Partial>; type DashKitChangeEvent = { patches: DashKitLayoutPatch[]; layout: ConfigLayout[]; previousLayout: ConfigLayout[]; preventDefault: () => void; readonly defaultPrevented: boolean; }; ``` #### Event-driven layout updates If you use `preventDefault()` in the `change` event handler, you can now handle layout updates without re-initializing the config prop. DashKit maintains an internal baseline and computes patches incrementally: ```tsx function Dashboard() { const [config, setConfig] = useState(initialConfig); const dashkitRef = useRef(null); useEffect(() => { const unsubscribe = dashkitRef.current?.on('change', (event) => { event.preventDefault(); // Don't call onChange // Send only the incremental patches to your backend sendPatches(event.patches); // No need to call setConfig({ ...config, layout: event.layout }) // DashKit maintains the visual state internally }); return unsubscribe; }, []); return {}} />; } ``` **Important:** If you later update `config.layout` from props (e.g., from server sync), DashKit will reset its internal baseline to match the new prop. This ensures compatibility with both event-driven and controlled workflows. ### Menu You can specify custom DashKit widget overlay menu in edit mode ```ts type MenuItem = { id: string; // uniq id title?: string; // string title icon?: ReactNode; // node of icon iconSize?: number | string; // icon size in px as number or as string with units handler?: (item: ConfigItem) => void; // custom item action handler visible?: (item: ConfigItem) => boolean; // optional visibility handler for filtering menu items className?: string; // custom class property }; // use array of menu items in settings | null} /> [deprecated] // overlayMenuItems property has greater priority over setSettings menu DashKit.setSettings({menu: [] as Array}); ``` ### Draggable items from ActionPanel #### DashKitDnDWrapper ```ts type DraggedOverItem = { h: number; w: number; type: string; parent: string; i?: number; }; interface DashKitDnDWrapperProps { dragImageSrc?: string; onDragStart?: (dragProps: ItemDragProps) => void; onDragEnd?: () => void; onDropDragOver?: ( draggedItem: DraggedOverItem, sharedItem: DraggedOverItem | null, ) => void | boolean; } ``` - **dragImageSrc**: Drag image preview, by default used transparent 1px png base64 - **onDragStart**: Callback called when element is dragged from ActionPanel - **onDragEnd**: Callback called when element dropped or drag canceled ```ts type ItemDragProps = { type: string; // Plugin type layout?: { // Optional. Layout item size for preview and init w?: number; h?: number; }; extra?: any; // Custom user context }; ``` ```ts type ItemDropProps = { commit: () => void; // Callback should be called after all config operations are made dragProps: ItemDragProps; // Item drag props itemLayout: ConfigLayout; // Calculated item layout dimensions newLayout: ConfigLayout[]; // New layout after element is dropped }; ``` #### Example: ```jsx const overlayMenuItems = [ { id: 'chart', icon: , title: 'Chart', qa: 'chart', dragProps: { // ItemDragProps type: 'custom', // Registered plugin type }, } ] const onDrop = (dropProps: ItemDropProps) => { // ... add element to your config dropProps.commit(); } ``` ### CSS API | Name | Description | | :--------------------------------------------- | :-------------------- | | Action panel variables | | | `--dashkit-action-panel-color` | Background color | | `--dashkit-action-panel-border-color` | Border color | | `--dashkit-action-panel-border-radius` | Border radius | | Action panel item variables | | | `--dashkit-action-panel-item-color` | Backgroud color | | `--dashkit-action-panel-item-text-color` | Text color | | `--dashkit-action-panel-item-color-hover` | Hover backgroud color | | `--dashkit-action-panel-item-text-color-hover` | Hover text color | | Overlay variables | | | `--dashkit-overlay-border-color` | Border color | | `--dashkit-overlay-color` | Background color | | `--dashkit-overlay-opacity` | Opacity | | Grid item variables | | | `--dashkit-grid-item-edit-opacity` | Opacity | | `--dashkit-grid-item-border-radius` | Border radius | | Placeholder variables | | | `--dashkit-placeholder-color` | Background color | | `--dashkit-placeholder-opacity` | Opacity | #### Usage example ```css .custom-theme-wrapper { --dashkit-grid-item-edit-opacit: 1; --dashkit-overlay-color: var(--g-color-base-float); --dashkit-overlay-border-color: var(--g-color-base-float); --dashkit-overlay-opacity: 0.5; --dashkit-action-panel-border-color: var(--g-color-line-info); --dashkit-action-panel-color: var(--g-color-base-float-accent); --dashkit-action-panel-border-radius: var(--g-border-radius-xxl); } ``` ```tsx // .... const CustomThemeWrapper = (props: { dashkitProps: DashkitProps; actionPanelProps: ActionPanelProps; }) => { return (
); }; ``` ### 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 ``** — the export is `` (the drag-and-drop shell is `` wrapping `` + ``). - **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. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dashkit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dashkit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dashkit) --- > Docs for `@gravity-ui/dashkit@8.27.0`. Versioned at: `https://gravity-ui.com/llms/dashkit/8.27.0/llms.txt` (exact), `https://gravity-ui.com/llms/dashkit/8/llms.txt` (latest of major 8), `https://gravity-ui.com/llms/dashkit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@5.1.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@5.1.0`. Versioned at: `https://gravity-ui.com/llms/yagr/5.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@5.0.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@5.0.0`. Versioned at: `https://gravity-ui.com/llms/yagr/5.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.14.1` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.14.1`. Versioned at: `https://gravity-ui.com/llms/yagr/4.14.1/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.14.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.14.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.13.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.13.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.12.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.12.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.11.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.11.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.10.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.10.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.9.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.9.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.8.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.8.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/yagr@4.7.0` # Yagr > A high-performance canvas charts renderer, based on uPlot. > > **npm:** `@gravity-ui/yagr` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage ``` npm i @gravity-ui/yagr ``` ### NPM Module ```typescript import Yagr from '@gravity-ui/yagr'; new Yagr(document.body, { timeline: [1, 2, 3, 4, 5], series: [ { data: [1, 2, 3, 4, 5], color: 'red', }, { data: [2, 3, 1, 4, 5], color: 'green', }, ], }); ``` ### Script Tag ```html ``` ### Examples Need something specific? Yagr presents some useful examples in the [demo/examples](./demo/examples/) folder. How to start them with current version: 1. Clone the repository. 2. Install dependencies `npm i`. 3. Run `npm run build`. 4. Run `npx http-server .`. 5. Open examples in browser according to the http-server output. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/yagr/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/yagr/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/yagr) --- > Docs for `@gravity-ui/yagr@4.7.0`. Versioned at: `https://gravity-ui.com/llms/yagr/4.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/yagr/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/yagr/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.17.0` # @gravity-ui/nodekit documentation Documentation for the **2.17.0** version of `@gravity-ui/nodekit`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/nodekit/dist/docs/`). ## For AI agents A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ## Guides - [NodeKit: AppError](https://unpkg.com/@gravity-ui/nodekit@2.17.0/dist/docs/guides/app-error.md) — It's often happens in applications that you want to attach some information to the error that you're throwing. Sometimes this can lead to the situation when application throws not error but object — which is a bad way to deal with this since you're losing a stacktrace. - [NodeKit: Configuration](https://unpkg.com/@gravity-ui/nodekit@2.17.0/dist/docs/guides/configuration.md) — Configuration defines how both NodeKit and your application should work. There are a few ways to define configuration and a few ways to access it. - [NodeKit: Contexts](https://unpkg.com/@gravity-ui/nodekit@2.17.0/dist/docs/guides/contexts.md) — NodeKit Context is a class that carries app configuration and set of context-dependent utilities for logging, tracing, sending metrics and stats and so on. - [NodeKit: utils](https://unpkg.com/@gravity-ui/nodekit@2.17.0/dist/docs/guides/utils.md) — NodeKit is bundled with a few utility helpers that can be helpful. - [telemetry](https://unpkg.com/@gravity-ui/nodekit@2.17.0/dist/docs/guides/telemetry.md) --- > Docs for `@gravity-ui/nodekit@2.17.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.17.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.16.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.16.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.16.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.15.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.15.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.15.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.14.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.14.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.14.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.13.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.13.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.13.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.12.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.12.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.11.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.11.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.10.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.10.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.9.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.9.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@2.8.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@2.8.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/2.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/nodekit@1.7.0` # NodeKit > A foundational Node.js toolkit (logging, telemetry, typed errors, config, request contexts) shared across Gravity UI backends — reach for it to get a consistent app spine before adding any HTTP layer, instead of assembling logging/error/config plumbing yourself. > > **npm:** `@gravity-ui/nodekit` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install --save @gravity-ui/nodekit ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.7.7` | ## Usage Add dependency to your project: ```bash npm install --save @gravity-ui/nodekit ``` And then import and init NodeKit in your application: ```typescript import {NodeKit} from '@gravity-ui/nodekit'; const nodeKit = new NodeKit(); nodekit.ctx.log('App is ready'); ``` ### When to use - Any Node.js service/script that wants shared logging, telemetry (tracing), and a typed `AppError`. - Providing request-scoped context (logs/traces) across async boundaries. - Centralizing configuration so multiple services in the same ecosystem behave consistently. ### When not to use - To expose HTTP routes, middleware, or a server, use [`@gravity-ui/expresskit`](https://github.com/gravity-ui/expresskit) — it builds on top of NodeKit and adds the Express/HTTP layer. - For a standalone, single-file script with no logging/telemetry needs, plain Node APIs are lighter than the full NodeKit context system. ### Common pitfalls - **Hallucinating `import {Logger}` / `logger`** — logging is reached through the NodeKit context: `new NodeKit()` then `nodekit.ctx.log(...)`, not a standalone logger export. - **Instantiating NodeKit repeatedly** — create one `NodeKit` instance per app and share its `ctx`; creating many instances fragments logging/telemetry config. - **Throwing plain `Error`** — use the bundled `AppError` (see `docs/app-error.md`) so error codes and telemetry are captured consistently. - **Skipping config initialization** — NodeKit reads configuration on construction; review `docs/configuration.md` before assuming defaults. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/nodekit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/nodekit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/nodekit) --- > Docs for `@gravity-ui/nodekit@1.7.0`. Versioned at: `https://gravity-ui.com/llms/nodekit/1.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/nodekit/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/nodekit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@3.1.3` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@3.1.3`. Versioned at: `https://gravity-ui.com/llms/expresskit/3.1.3/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@3.1.2` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@3.1.2`. Versioned at: `https://gravity-ui.com/llms/expresskit/3.1.2/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@3.1.1` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@3.1.1`. Versioned at: `https://gravity-ui.com/llms/expresskit/3.1.1/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@3.1.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@3.1.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/3.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@3.0.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@3.0.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.11.1` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.11.1`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.11.1/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.11.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.11.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.10.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.10.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.9.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.9.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.8.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.8.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.7.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.7.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.6.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.6.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.5.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.5.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/expresskit@2.4.0` # ExpressKit > Lightweight express.js wrapper that integrates with NodeKit. > > **npm:** `@gravity-ui/expresskit` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/nodekit` | `^1.6.0 || ^2.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/expresskit/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/expresskit/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/expresskit) --- > Docs for `@gravity-ui/expresskit@2.4.0`. Versioned at: `https://gravity-ui.com/llms/expresskit/2.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/expresskit/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/expresskit/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.5.1` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.5.1`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.5.1/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.5.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.5.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.4.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.4.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.3.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.3.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.2.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.2.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.1.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.1.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@2.0.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@2.0.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@1.8.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@1.8.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/1.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@1.7.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@1.7.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/1.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@1.6.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@1.6.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/1.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/app-layout@1.5.0` # App Layout > HTML layout generator used in our SPA applications. > > **npm:** `@gravity-ui/app-layout` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/app-layout ``` ## Usage With `express`: ```js import express from 'express'; import {createRenderFunction} from '@gravity-ui/app-layout'; const app = express(); const renderLayout = createRenderFunction(); app.get('/', function (req, res) { res.send( renderLayout({ // RenderParams title: 'Home page', bodyContent: { root: 'Hello world!', }, }), ); }); app.listen(3000); ``` where ```typescript interface RenderParams { // Any json compatible data, will be set to window.__DATA__ on the page data?: Data; // favicon icon?: Icon; // nonce to be set on the appropriate tags nonce?: string; // base tag attributes base?: Base; // common options // Page title title: string; // language of page, will be set to html tag lang?: string; isMobile?: boolean; // html attributes htmlAttributes?: string; // header tag content // meta tags meta?: Meta[]; // link tags links?: Link[]; // script tags scripts?: Script[]; // style tags styleSheets?: Stylesheet[]; // script tags with inlined code inlineScripts?: string[]; // style tags with inlined styles inlineStyleSheets?: string[]; // content of body tag bodyContent?: { // class name for body tag className?: string; // body attributes attributes?: string; // body content before div tag with id root beforeRoot?: string; // innerHtml content of div tag with id root root?: string; // body content after div tag with id root afterRoot?: string; }; // plugins options pluginsOptions?: Partial>; } ``` ### Base Describes `base` tag: ```typescript interface Base { href?: string; target?: HTMLBaseElement['target']; } ``` Example: ```js renderLayout({ title: 'Home page', base: {target: '_top'}, }); ``` Will be rendered as: ```html ``` ### Meta Describes `meta` tag: ```typescript interface Meta { name: string; content: string; } ``` Example: ```js const meta = [ {name: 'description', content: 'some text'}, {name: 'robots', content: 'noindex'}, {name: 'og:title', content: 'Some title'}, ]; ``` Will be rendered as: ```html ``` ### Icon Describes page favicon: ```typescript interface Icon { type?: string; sizes?: string; href?: string; } ``` Default value is: ```js const icon = { type: 'image/png', sizes: '16x16', href: '/favicon.png', }; ``` ### Links Describes `link` tag: ```typescript interface Link { as?: string; href: string; rel?: string; type?: string; sizes?: string; title?: HTMLLinkElement['title']; crossOrigin?: '' | 'anonymous' | 'use-credentials'; } ``` Example: ```js const link = { href: 'myFont.woff2', rel: 'preload', as: 'font', type: 'font/woff2', crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` ### Scripts Describes link to script with preload: ```typescript interface Script { src: string; defer?: boolean; async?: boolean; crossOrigin?: '' | 'anonymous' | 'use-credentials'; type?: 'importmap' | 'module' | string; } ``` Example: ```js const script = { src: 'url/to/script', defer: true, async: false, crossOrigin: 'anonymous', }; ``` will be rendered as: ```html ``` #### Style sheets Describe link to styles: ```typescript interface Stylesheet { href: string; } ``` Example: ```js const styleSheet = { href: 'url/to/stylesheet', }; ``` will be rendered as: ```html ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/app-layout/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/app-layout/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/app-layout) --- > Docs for `@gravity-ui/app-layout@1.5.0`. Versioned at: `https://gravity-ui.com/llms/app-layout/1.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/app-layout/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/app-layout/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.4.1` # @gravity-ui/navigation documentation Documentation for the **6.4.1** version of `@gravity-ui/navigation`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/navigation/build/docs/`). ## For AI agents Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@bem-react/classname` | `^1.6.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.42.0` | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ## Components - [ActionBar](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/ActionBar.md) — The component is a flexible horizontal bar that provides a standardized layout for arranging navigation elements, actions, and informational content within an application. It serves as a container for organizing UI elements like breadcrumbs, buttons, and dropdown menus into defined sections and groups. - [AsideHeader](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/AsideHeader.md) — AsideHeader is provided a flexible and customizable navigation experience within your application. Users can easily customize the appearance of the sidebar to match their branding colors also to add personalized links, icons that cater specifically to their application's functionality. - [AsideHeader/components/AllPagesPanel](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/AsideHeader/components/AllPagesPanel.md) — A navigation panel for managing and organizing application pages in the middle (menuItems) section of AsideHeader component. Panel provides drag-and-drop reordering, visibility toggles, pin/unpin and category grouping of menu items. - [Footer](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/Footer.md) — The page footer components. Use Footer for the desktop version and MobileFooter for the mobile version. Both components have the same properties. - [HotkeysPanel](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/HotkeysPanel.md) — A navigation panel for hotkeys documentation. The panel displays a set of hotkeys for your application with a description of their purpose. - [Logo](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/Logo.md) — Logo icon is wrapped in UIKit Button, text is wrapped in HTML tag a or div, when passing hasWrapper prop. - [MobileHeader](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/MobileHeader.md) — Header for Mobile navigation. MobileHeader provides maintaining Panels except for Modals. - [Settings](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/components/Settings.md) — The Settings component provides the layout for a settings panel with the following features. ## Hooks - [useOverflowingHorizontalListItems](https://unpkg.com/@gravity-ui/navigation@6.4.1/build/docs/hooks/useOverflowingHorizontalListItems.md) — A hook for determining which horizontal list items stay visible and which collapse into an overflow "more" dropdown. --- > Docs for `@gravity-ui/navigation@6.4.1`. Versioned at: `https://gravity-ui.com/llms/navigation/6.4.1/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.4.0` # @gravity-ui/navigation documentation Documentation for the **6.4.0** version of `@gravity-ui/navigation`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/navigation/build/docs/`). ## For AI agents Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.42.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ## Components - [ActionBar](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/ActionBar.md) — The component is a flexible horizontal bar that provides a standardized layout for arranging navigation elements, actions, and informational content within an application. It serves as a container for organizing UI elements like breadcrumbs, buttons, and dropdown menus into defined sections and groups. - [AsideHeader](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/AsideHeader.md) — AsideHeader is provided a flexible and customizable navigation experience within your application. Users can easily customize the appearance of the sidebar to match their branding colors also to add personalized links, icons that cater specifically to their application's functionality. - [AsideHeader/components/AllPagesPanel](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/AsideHeader/components/AllPagesPanel.md) — A navigation panel for managing and organizing application pages in the middle (menuItems) section of AsideHeader component. Panel provides drag-and-drop reordering, visibility toggles, pin/unpin and category grouping of menu items. - [Footer](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/Footer.md) — The page footer components. Use Footer for the desktop version and MobileFooter for the mobile version. Both components have the same properties. - [HotkeysPanel](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/HotkeysPanel.md) — A navigation panel for hotkeys documentation. The panel displays a set of hotkeys for your application with a description of their purpose. - [Logo](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/Logo.md) — Logo icon is wrapped in UIKit Button, text is wrapped in HTML tag a or div, when passing hasWrapper prop. - [MobileHeader](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/MobileHeader.md) — Header for Mobile navigation. MobileHeader provides maintaining Panels except for Modals. - [Settings](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/components/Settings.md) — The Settings component provides the layout for a settings panel with the following features. ## Hooks - [useOverflowingHorizontalListItems](https://unpkg.com/@gravity-ui/navigation@6.4.0/build/docs/hooks/useOverflowingHorizontalListItems.md) — A hook for determining which horizontal list items stay visible and which collapse into an overflow "more" dropdown. --- > Docs for `@gravity-ui/navigation@6.4.0`. Versioned at: `https://gravity-ui.com/llms/navigation/6.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.3.0` # @gravity-ui/navigation documentation Documentation for the **6.3.0** version of `@gravity-ui/navigation`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/navigation/build/docs/`). ## For AI agents Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.42.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ## Components - [ActionBar](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/ActionBar.md) — The component is a flexible horizontal bar that provides a standardized layout for arranging navigation elements, actions, and informational content within an application. It serves as a container for organizing UI elements like breadcrumbs, buttons, and dropdown menus into defined sections and groups. - [AsideHeader](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/AsideHeader.md) — AsideHeader is provided a flexible and customizable navigation experience within your application. Users can easily customize the appearance of the sidebar to match their branding colors also to add personalized links, icons that cater specifically to their application's functionality. - [AsideHeader/components/AllPagesPanel](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/AsideHeader/components/AllPagesPanel.md) — A navigation panel for managing and organizing application pages in the middle (menuItems) section of AsideHeader component. Panel provides drag-and-drop reordering, visibility toggles, pin/unpin and category grouping of menu items. - [Footer](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/Footer.md) — The page footer components. Use Footer for the desktop version and MobileFooter for the mobile version. Both components have the same properties. - [HotkeysPanel](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/HotkeysPanel.md) — A navigation panel for hotkeys documentation. The panel displays a set of hotkeys for your application with a description of their purpose. - [Logo](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/Logo.md) — Logo icon is wrapped in UIKit Button, text is wrapped in HTML tag a or div, when passing hasWrapper prop. - [MobileHeader](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/MobileHeader.md) — Header for Mobile navigation. MobileHeader provides maintaining Panels except for Modals. - [Settings](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/components/Settings.md) — The Settings component provides the layout for a settings panel with the following features. ## Hooks - [useOverflowingHorizontalListItems](https://unpkg.com/@gravity-ui/navigation@6.3.0/build/docs/hooks/useOverflowingHorizontalListItems.md) — A hook for determining which horizontal list items stay visible and which collapse into an overflow "more" dropdown. --- > Docs for `@gravity-ui/navigation@6.3.0`. Versioned at: `https://gravity-ui.com/llms/navigation/6.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.2.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.42.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@6.2.0`. Versioned at: `https://gravity-ui.com/llms/navigation/6.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.1.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.42.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@6.1.0`. Versioned at: `https://gravity-ui.com/llms/navigation/6.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@6.0.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@6.0.0`. Versioned at: `https://gravity-ui.com/llms/navigation/6.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@5.0.1` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@5.0.1`. Versioned at: `https://gravity-ui.com/llms/navigation/5.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@5.0.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@5.0.0`. Versioned at: `https://gravity-ui.com/llms/navigation/5.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@4.0.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@4.0.0`. Versioned at: `https://gravity-ui.com/llms/navigation/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@3.11.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@3.11.0`. Versioned at: `https://gravity-ui.com/llms/navigation/3.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@3.10.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@3.10.0`. Versioned at: `https://gravity-ui.com/llms/navigation/3.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/navigation@3.9.0` # Navigation > Application-shell navigation components for Gravity UI apps — the collapsible `AsideHeader` sidebar plus footers, drawers, logo, hotkeys and settings panels that frame a whole page. > > **npm:** `@gravity-ui/navigation` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/navigation ``` Ensure that peer dependencies are installed in your project ```bash npm install --dev @gravity-ui/uikit@^7.2.0 @gravity-ui/icons@^2.2.0 @bem-react/classname@^1.6.0 react@^19.0.0 react-dom@^19.0.0 ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0` | | `@gravity-ui/icons` | `^2.2.0` | | `@gravity-ui/uikit` | `^7.2.0` | | `@bem-react/classname` | `^1.6.0` | ## Usage Render `AsideHeader` as the app shell. It is a controlled component — you own the collapsed state via `compact`/`onChangeCompact` — and your page content goes through `renderContent`. Set up `@gravity-ui/uikit` styles and `ThemeProvider` first (see the [uikit styles guide](https://github.com/gravity-ui/uikit?tab=readme-ov-file#styles)). ```tsx import React from 'react'; import {AsideHeader} from '@gravity-ui/navigation'; import {Gear, House} from '@gravity-ui/icons'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; export function App() { const [compact, setCompact] = React.useState(false); return (
Page content
} />
); } ``` ### When to use - The app's primary navigation frame: `AsideHeader` (collapsible side navigation) with `menuItems`, subheader, and footer sections. - Supporting shell UI: `Drawer`/`DrawerItem`, `Footer`/`MobileFooter`, `MobileHeader`, `HotkeysPanel`, `Settings`, `ActionBar`, `Logo`. - Laying out page content inside the navigation frame via `renderContent` / `PageLayout`. ### When not to use - Generic in-page controls (buttons, tabs, menus, breadcrumbs) — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit); this package is the outer app chrome, not general components. - Rendering the page body itself from config — use [`@gravity-ui/page-constructor`](https://github.com/gravity-ui/page-constructor). - Client-side routing — this provides the navigation UI only; wire clicks to your own router. ### Common pitfalls - **`AsideHeader` is controlled.** You must own the collapsed state with `compact` and update it in `onChangeCompact`; passing `compact` without the handler freezes the sidebar. - **Menu items are `menuItems`, keyed by `id`.** Each item is `{id, title, icon, current, onItemClick}`; `icon` takes an icon component (e.g. from `@gravity-ui/icons`), not a string name. - **Peer dependencies are required.** `@gravity-ui/uikit`, `@gravity-ui/icons`, and `@bem-react/classname` must be installed alongside `react`/`react-dom`. - **Needs uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`, or the shell renders unstyled. - **Page content goes through `renderContent`.** Render your routed content via the `renderContent` prop / `PageLayout`, not as `children`. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/navigation/main/README.md) - [Storybook](https://preview.gravity-ui.com/navigation/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/navigation/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/navigation) --- > Docs for `@gravity-ui/navigation@3.9.0`. Versioned at: `https://gravity-ui.com/llms/navigation/3.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/navigation/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/navigation/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.7.1` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.7.1`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.7.1/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.7.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.7.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.6.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.6.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.5.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.5.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.4.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.4.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.3.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.3.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.2.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.2.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.1.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.1.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@2.0.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@2.0.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@1.4.2` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@1.4.2`. Versioned at: `https://gravity-ui.com/llms/date-utils/1.4.2/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@1.4.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@1.4.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/1.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-utils@1.3.0` # Date Utils > Timezone-aware date/time helpers — parsing (including relative expressions like `now-1d/d`), formatting, and locale management — without any UI, reach for it when you need to compute and format dates reliably across time zones instead of pulling in a full UI calendar. > > **npm:** `@gravity-ui/date-utils` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm i @gravity-ui/date-utils ``` ## Usage ```typescript import {dateTimeParse, dateTime} from '@gravity-ui/date-utils'; // Current date: 2021-08-07T12:10:00 // User's time zone: Europe/Istanbul const FORMAT = 'YYYY-MM-DDTHH:mm:ssZ'; // parse absolute date dateTimeParse({year: 2021, month: 7, day: 7})?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse([2021, 7, 7])?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('2021-08-07')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse(1621708204063)?.format(FORMAT); // "2021-05-22T21:30:04+03:00" dateTimeParse('')?.format(FORMAT); // undefined dateTimeParse('incorrect-date')?.format(FORMAT); // undefined // parse relative date dateTimeParse('now')?.format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTimeParse('now-1d')?.format(FORMAT); // "2021-08-06T12:10:00+03:00" dateTimeParse('now-1d+1M')?.format(FORMAT); // "2021-09-06T12:10:00+03:00" dateTimeParse('now/d')?.format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTimeParse('now+1d/d')?.format(FORMAT); // "2021-08-08T00:00:00+03:00" dateTimeParse('now-1f')?.format(FORMAT); // undefined // create dateTime dateTime().format(FORMAT); // "2021-08-07T12:10:00+03:00" dateTime({input: '2021-08-07'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({input: '2021-08-07', format: 'YYYY-MM-DD'}).format(FORMAT); // "2021-08-07T00:00:00+03:00" dateTime({timeZone: 'Asia/Tokyo'}).format(FORMAT); // "2021-08-07T18:10:00+09:00 dateTime({input: ''}).format(FORMAT); // "Invalid Date" dateTime({input: '2021-08', format: 'YYYY-MM-DD'}).format(FORMAT); // "Invalid Date" ``` ### When to use - Parsing absolute or relative date expressions (`'now-1d'`, `'now/d'`) into a timezone-aware `dateTime` object. - Formatting dates for display in the user's timezone with locale support. - Sharing date logic between server (Node) and client (React) code — the package has no React dependency. ### When not to use - To render a calendar, date picker, or any date **UI**, use [`@gravity-ui/date-components`](https://gravity-ui.com/components/date-components) — it builds its visuals on top of this package. - For lightweight immutable date math and no timezone/relative-expression needs, `date-fns` or the native `Intl`/`Date` APIs may suffice. ### Common pitfalls - **Calling `dateTimeParse('')` expecting a date** — returns `undefined`, not a `dateTime`; guard with optional chaining or a null check. - **Forgetting to load a locale** — `settings.setLocale('de')` only formats localized names (weekdays, months) after `settings.loadLocale('de')` has resolved. - **Hallucinated function `formatDate` / `parseDate`** — the entry points are `dateTimeParse` (parse) and `dateTime(...).format(...)` (format). - **Assuming the user's timezone is applied automatically** — pass `timeZone` explicitly or the system timezone is used. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-utils/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-utils/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-utils) --- > Docs for `@gravity-ui/date-utils@1.3.0`. Versioned at: `https://gravity-ui.com/llms/date-utils/1.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-utils/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/date-utils/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@4.0.0` # @gravity-ui/date-components documentation Documentation for the **4.0.0** version of `@gravity-ui/date-components`. Your training data may be outdated — these files are the source of truth. Paths are relative to this file (`node_modules/@gravity-ui/date-components/dist/docs/`). ## For AI agents React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/date-utils` | `^2.6.0` | | `@gravity-ui/uikit` | `^7.21.0` | | `@types/react` | `>=17.0.0` | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ## Components - [Calendar](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/Calendar.md) — Calendar is a flexible, user-friendly calendar component for React applications. It allows users to view, select, and manage dates with ease. Ideal for event scheduling, booking systems, and any application where date selection is essential. It can be controlled if you set value property. Or it can be uncontrolled if you don't set any value, but in this case you can manage the initial state with optional property defaultValue. Component is uncontrolled by default. - [DateField](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/DateField.md) — DateField component is a versatile and convenient input field specifically designed for date entry in React applications. With an intuitive interface and easy integration, it's perfect for any form that requires date or time input, such as event schedulers, booking systems, or data-driven reports. It can be controlled if you set value property. Or it can be uncontrolled if you don't set any value, but in this case you can manage the initial state with optional property defaultValue. Component is uncontrolled by default. - [DatePicker](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/DatePicker.md) — DatePicker is a sophisticated, lightweight, and fully customizable component designed to provide intuitive date picking functionality in your React applications. Built with user experience and ease of integration in mind, it fits seamlessly within forms, modals, or any UI element requiring date input. It can be controlled if you set value property. Or it can be uncontrolled if you don't set any value, but in this case you can manage the initial state with optional property defaultValue. Component is uncontrolled by default. - [RangeCalendar](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/RangeCalendar.md) — RangeCalendar is a powerful, flexible, and user-friendly UI component designed for selecting a range of dates. Built with React, it combines the functionality of a calendar and a date range picker, making it an ideal choice for applications that require users to input a start and end date. It can be controlled if you set value property. Or it can be uncontrolled if you don't set any value, but in this case you can manage the initial state with optional property defaultValue. Component is uncontrolled by default. - [RelativeDateField](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/RelativeDateField.md) — RelativeDateField component is used only for entering relative dates. It can't be used as "normal" DateField. - [RelativeDatePicker](https://unpkg.com/@gravity-ui/date-components@4.0.0/dist/docs/components/RelativeDatePicker.md) — RelativeDatePicker is almost the same component as DatePicker but it has ability to use relative dates. --- > Docs for `@gravity-ui/date-components@4.0.0`. Versioned at: `https://gravity-ui.com/llms/date-components/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.4.2` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@types/react` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.21.0` | | `@gravity-ui/date-utils` | `^2.6.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.4.2`. Versioned at: `https://gravity-ui.com/llms/date-components/3.4.2/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.4.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@types/react` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.21.0` | | `@gravity-ui/date-utils` | `^2.6.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.4.0`. Versioned at: `https://gravity-ui.com/llms/date-components/3.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.3.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@types/react` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.21.0` | | `@gravity-ui/date-utils` | `^2.5.3` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.3.0`. Versioned at: `https://gravity-ui.com/llms/date-components/3.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.2.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.2.0`. Versioned at: `https://gravity-ui.com/llms/date-components/3.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.1.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.1.0`. Versioned at: `https://gravity-ui.com/llms/date-components/3.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@3.0.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^7.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@3.0.0`. Versioned at: `https://gravity-ui.com/llms/date-components/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@2.12.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@2.12.0`. Versioned at: `https://gravity-ui.com/llms/date-components/2.12.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@2.11.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@2.11.0`. Versioned at: `https://gravity-ui.com/llms/date-components/2.11.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@2.10.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@2.10.0`. Versioned at: `https://gravity-ui.com/llms/date-components/2.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/date-components@2.9.0` # Date Components > React date and time controls for Gravity UI apps — date/time pickers, calendars, and absolute/relative range selectors built on `@gravity-ui/date-utils`. > > **npm:** `@gravity-ui/date-components` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install react react-dom @gravity-ui/uikit @gravity-ui/date-components @gravity-ui/date-utils ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `>=17.0.0` | | `react-dom` | `>=17.0.0` | | `@gravity-ui/uikit` | `^6.0.0` | ## Usage ```jsx import {createRoot} from 'react-dom/client'; import {DatePicker} from '@gravity-ui/date-components'; import {ThemeProvider} from '@gravity-ui/uikit'; import '@gravity-ui/uikit/styles/styles.css'; function App() { return (

DatePicker

); } const root = createRoot(document.getElementById('root')); root.render(); ``` ### Localization ```jsx import {settings} from '@gravity-ui/date-utils'; // Load date locales that will be used in an application. await settings.loadLocale('ru'); function App() { return ( // Set the language to use with components.

DatePicker

); } ``` If the app supports language switching, preload all supported locales when the app first loads, or load the locales before switching the language: ```jsx // Preload locales await Promise.all([settings.loadLocale('ru'), settings.loadLocale('nl')]); const root = createRoot(document.getElementById('root')); root.render(); // or load locales on demand. function App() { const [lang, setLang] = React.useState('en'); const handleLangChange = (newLang) => { settings.loadLocale(newLang).then(() => { setLang(newLang); }); }; return ...; } ``` The components have translations into English and Russian. To add translations into other languages, use `addLanguageKeysets` from `@gravity-ui/uikit`: ```ts import {addLanguageKeysets} from '@gravity-ui/uikit/i18n'; import type {Keysets, PartialKeysets} from '@gravity-ui/date-components'; // Use the Keyset type to specify translations for all available components addLanguageKeysets(lang, {...}); // or use the PartialKeysets type to specify only the ones you need addLanguageKeysets(lang, {...}); // To specify translations for some components addLanguageKeysets>(lang, {...}); ``` ### When to use - A single date or date-time input: `DatePicker`, `DateField`. - Calendars for month/day selection: `Calendar`, `CalendarView`. - Date ranges: `RangeDatePicker`, `RangeCalendar`, `RangeDateField`. - Relative and mixed absolute/relative ranges (e.g. "last 7 days"): `RelativeDatePicker`, `RelativeRangeDatePicker`, `RelativeDateField`. ### When not to use - Plain text or number inputs, buttons, or other generic controls — use [`@gravity-ui/uikit`](https://github.com/gravity-ui/uikit). - Low-level date math, parsing, formatting, or timezone handling without UI — use [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils) directly. ### Common pitfalls - **Values are `DateTime` objects, not JS `Date`.** Components work with `dateTime()` from [`@gravity-ui/date-utils`](https://github.com/gravity-ui/date-utils); pass and read `DateTime`, not native `Date` or ISO strings. - **Requires uikit setup.** Render inside `ThemeProvider` and import `@gravity-ui/uikit/styles/styles.css`; `@gravity-ui/uikit` and `@gravity-ui/date-utils` are required peer dependencies. - **Locale is loaded, not just set.** Set language via `ThemeProvider` `lang`, but load the locale data first with `settings.loadLocale('ru')` from `@gravity-ui/date-utils`, or dates render in the default locale. - **Component-specific translations use `addLanguageKeysets`.** For languages beyond `en`/`ru`, register keysets via `addLanguageKeysets` from `@gravity-ui/uikit/i18n` using the `Keysets`/`PartialKeysets` types exported here. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/date-components/main/README.md) - [Storybook](https://preview.gravity-ui.com/date-components/?path=/docs/components-calendar--docs) - [Changelog](https://raw.githubusercontent.com/gravity-ui/date-components/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/date-components) --- > Docs for `@gravity-ui/date-components@2.9.0`. Versioned at: `https://gravity-ui.com/llms/date-components/2.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/date-components/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/date-components/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/axios-wrapper@1.5.1` # Axios wrapper > Axios wrapper that provides automatic cancelling of concurrent requests. > > **npm:** `@gravity-ui/axios-wrapper` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/axios-wrapper ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.3.4` | | `lodash` | `^4.17.11` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/axios-wrapper) --- > Docs for `@gravity-ui/axios-wrapper@1.5.1`. Versioned at: `https://gravity-ui.com/llms/axios-wrapper/1.5.1/llms.txt` (exact), `https://gravity-ui.com/llms/axios-wrapper/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/axios-wrapper/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/axios-wrapper@1.5.0` # Axios wrapper > Axios wrapper that provides automatic cancelling of concurrent requests. > > **npm:** `@gravity-ui/axios-wrapper` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/axios-wrapper ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.3.4` | | `lodash` | `^4.17.11` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/axios-wrapper) --- > Docs for `@gravity-ui/axios-wrapper@1.5.0`. Versioned at: `https://gravity-ui.com/llms/axios-wrapper/1.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/axios-wrapper/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/axios-wrapper/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/axios-wrapper@1.4.0` # Axios wrapper > Axios wrapper that provides automatic cancelling of concurrent requests. > > **npm:** `@gravity-ui/axios-wrapper` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/axios-wrapper ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^1.3.4` | | `lodash` | `^4.17.11` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/axios-wrapper) --- > Docs for `@gravity-ui/axios-wrapper@1.4.0`. Versioned at: `https://gravity-ui.com/llms/axios-wrapper/1.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/axios-wrapper/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/axios-wrapper/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/axios-wrapper@1.3.0` # Axios wrapper > Axios wrapper that provides automatic cancelling of concurrent requests. > > **npm:** `@gravity-ui/axios-wrapper` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```shell npm install --save-dev @gravity-ui/axios-wrapper ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `axios` | `^0.21.2` | | `lodash` | `^4.17.11` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/axios-wrapper/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/axios-wrapper) --- > Docs for `@gravity-ui/axios-wrapper@1.3.0`. Versioned at: `https://gravity-ui.com/llms/axios-wrapper/1.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/axios-wrapper/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/axios-wrapper/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@6.1.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@bem-react/classname` | `^1.6.0` | | `@gravity-ui/i18n` | `^1.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^7.1.1` | | `final-form` | `^4.20.7` | | `final-form-arrays` | `^3.0.2` | | `final-form-calculate` | `^1.3.2` | | `react-final-form` | `^6.5.9` | | `react-final-form-arrays` | `^3.1.3` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@6.1.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/6.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@6.0.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^7.0.0 || >=7.0.0-beta.6` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@6.0.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/6.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/6/llms.txt` (latest of major 6), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@5.0.10` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.1.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@5.0.10`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/5.0.10/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@5.0.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^6.1.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@5.0.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/5.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@4.3.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@4.3.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/4.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@4.2.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@4.2.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/4.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@4.1.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@4.1.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/4.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@4.0.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@4.0.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@3.1.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/icons` | `^2.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@3.1.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/3.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@3.0.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `react-dom` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@gravity-ui/uikit` | `^5.0.0` | | `@bem-react/classname` | `^1.6.0` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@3.0.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/dialog-fields@2.0.0` # Dialog Fields > A react-final-form wrapper that provides some useful high-level components for building forms. > > **npm:** `@gravity-ui/dialog-fields` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash $ npm install @gravity-ui/dialog-fields ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16 | ^17 | ^18` | | `react-dom` | `^16 | ^17 | ^18` | | `bem-cn-lite` | `^4` | | `@gravity-ui/uikit` | `^5` | # Use required version of react/react-dom in case you haven't installed them yet $ npm install @gravity-ui/dialog-fields react@18 react-dom@18 ``` Depending on your package manager you may need to install `peerDependencies` manually. ## Usage ```ts import {DFDialog, FormApi} from '@gravity-ui/dialog-fields'; interface FormValues { firstName: string; lastName: string; } function MyForm() { return ( visible={true} headerProps={{ title: 'My form', }} onAdd={(form) => { console.log(form.getState().values); return Promise.resolve(); }} fields={[ { name: 'firstName', type: 'text', caption: 'First name', tooltip: 'Description for first name field', }, { name: 'lastName', type: 'text', caption: 'LastName', tooltip: 'Description for last name field', }, ]} /> ); } ``` See more examples in [storybook](https://preview.yandexcloud.dev/dialog-fields). > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/dialog-fields/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/dialog-fields) --- > Docs for `@gravity-ui/dialog-fields@2.0.0`. Versioned at: `https://gravity-ui.com/llms/dialog-fields/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/dialog-fields/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/dialog-fields/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.8.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.8.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.7.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.7.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.6.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.6.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.5.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.5.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.4.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.4.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.3.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.3.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.2.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.2.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.1.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.1.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/i18n@1.0.0` # I18n > Internationalization helpers of Gravity UI projects. > > **npm:** `@gravity-ui/i18n` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/i18n/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/i18n/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/i18n) --- > Docs for `@gravity-ui/i18n@1.0.0`. Versioned at: `https://gravity-ui.com/llms/i18n/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/i18n/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/i18n/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.10.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@tanstack/react-query` | `^5.0.0` | | `react` | `^18.0.0 || ^19.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.10.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.10.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.9.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.9.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.8.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.8.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.7.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0 || ^19.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.7.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.6.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.6.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.6.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.5.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.5.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.4.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.4.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.3.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^18.0.0` | | `@tanstack/react-query` | `^5.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.3.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.2.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@tanstack/react-query` | `^4.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.2.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/data-source@0.1.0` # Data Source > A wrapper around data fetching. > > **npm:** `@gravity-ui/data-source` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/data-source @tanstack/react-query ``` `@tanstack/react-query` is a peer dependency. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^16.0.0 || ^17.0.0 || ^18.0.0` | | `@tanstack/react-query` | `^4.0.0` | ## Usage ### 1. Setup DataManager First, create and provide a `DataManager` in your application: ```tsx import React from 'react'; import {ClientDataManager, DataSourceProvider} from '@gravity-ui/data-source'; const dataManager = new ClientDataManager({ defaultOptions: { queries: { staleTime: 5 * 60 * 1000, // 5 minutes retry: 3, }, // ... other react-query options }, }); function App() { return ( ); } ``` ### 2. Define Error Types and Wrappers Define a type of error and make your constructors for data sources based on default constructors: ```ts import {makePlainQueryDataSource as makePlainQueryDataSourceBase} from '@gravity-ui/data-source'; export interface ApiError { code: number; title: string; description?: string; } export const makePlainQueryDataSource = ( config: Omit, 'type'>, ): PlainQueryDataSource => { return makePlainQueryDataSourceBase(config); }; ``` ### 3. Create Custom DataLoader Component Write a `DataLoader` component based on default to define your display of loading status and errors: ```tsx import { DataLoader as DataLoaderBase, DataLoaderProps as DataLoaderPropsBase, ErrorViewProps, } from '@gravity-ui/data-source'; export interface DataLoaderProps extends Omit, 'LoadingView' | 'ErrorView'> { LoadingView?: ComponentType; ErrorView?: ComponentType>; } export const DataLoader: React.FC = ({ LoadingView = YourLoader, // You can use your own loader component ErrorView = YourError, // You can use your own error component ...restProps }) => { return ; }; ``` ### 4. Define Your First Data Source ```ts import {skipContext} from '@gravity-ui/data-source'; // Your API function import {fetchUser} from './api'; export const userDataSource = makePlainQueryDataSource({ // Keys have to be unique. Maybe you should create a helper for making names of data sources name: 'user', // skipContext is a helper to skip 2 first parameters in the function (context and fetchContext) fetch: skipContext(fetchUser), // Optional: generate tags for advanced cache invalidation tags: (params) => [`user:${params.userId}`, 'users'], }); ``` ### 5. Use in Components ```tsx import {useQueryData} from '@gravity-ui/data-source'; export const UserProfile: React.FC<{userId: number}> = ({userId}) => { const {data, status, error, refetch} = useQueryData(userDataSource, {userId}); return ( {data && } ); }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/data-source/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/data-source/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/data-source) --- > Docs for `@gravity-ui/data-source@0.1.0`. Versioned at: `https://gravity-ui.com/llms/data-source/0.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/data-source/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/data-source/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.3.2` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `>=4.8.4 <6.1.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.3.2`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.3.2/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.3.1` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `^5.8.3` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.3.1`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.3.1/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.3.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `^5.8.3` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.3.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.2.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `^5.8.3` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.2.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.1.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `^5.8.3` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.1.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@4.0.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^3.0.0` | | `typescript` | `^5.8.3` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@4.0.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@3.3.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | | `prettier` | `^3.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@3.3.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/3.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@3.2.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | | `prettier` | `^3.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@3.2.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/3.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@3.1.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | | `prettier` | `^3.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@3.1.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/3.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@3.0.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | | `prettier` | `^3.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@3.0.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@2.2.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@2.2.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/2.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/eslint-config@2.1.0` # ESlint Config > ESLint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/eslint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev eslint @gravity-ui/eslint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `eslint` | `^8.0.0` | ## Usage Add `eslint.config.js` file in your project with the following content: ```js import baseConfig from '@gravity-ui/eslint-config'; export default [ ...baseConfig, { // ...other config }, ]; ``` Base config also includes TypeScript rules. ### Prettier If you are using Prettier, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import prettierConfig from '@gravity-ui/eslint-config/prettier'; export default [ ...baseConfig, ...prettierConfig, { // ...other config }, ]; ``` ### a11y If you want to spot accessibility issues, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import a11yConfig from '@gravity-ui/eslint-config/a11y'; export default [ ...baseConfig, ...a11yConfig, { // ...other config }, ]; ``` ### Order if you want to enforce a convention in module import order, add corresponding config: ```js import baseConfig from '@gravity-ui/eslint-config'; import importOrderConfig from '@gravity-ui/eslint-config/import-order'; export default [ ...baseConfig, ...importOrderConfig, { // ...other config }, ]; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/eslint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/eslint-config) --- > Docs for `@gravity-ui/eslint-config@2.1.0`. Versioned at: `https://gravity-ui.com/llms/eslint-config/2.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/eslint-config/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/eslint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/tsconfig@1.0.0` # TSconfig > TypeScript compiler configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/tsconfig` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev @gravity-ui/tsconfig ``` ## Usage Add `tsconfig.json` file in the project root with the following content: ```json { "extends": "@gravity-ui/tsconfig/tsconfig.json" } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/tsconfig/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/tsconfig/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/tsconfig/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/tsconfig) --- > Docs for `@gravity-ui/tsconfig@1.0.0`. Versioned at: `https://gravity-ui.com/llms/tsconfig/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/tsconfig/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/tsconfig/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/prettier-config@1.1.1` # Prettier Config > Prettier configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/prettier-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev prettier @gravity-ui/prettier-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `*` | ## Usage Add `.prettierrc.js` file in the project root with the following content: ```js module.exports = require('@gravity-ui/prettier-config'); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/prettier-config) --- > Docs for `@gravity-ui/prettier-config@1.1.1`. Versioned at: `https://gravity-ui.com/llms/prettier-config/1.1.1/llms.txt` (exact), `https://gravity-ui.com/llms/prettier-config/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/prettier-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/prettier-config@1.1.0` # Prettier Config > Prettier configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/prettier-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev prettier @gravity-ui/prettier-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `*` | ## Usage Add `.prettierrc.js` file in the project root with the following content: ```js module.exports = require('@gravity-ui/prettier-config'); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/prettier-config) --- > Docs for `@gravity-ui/prettier-config@1.1.0`. Versioned at: `https://gravity-ui.com/llms/prettier-config/1.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/prettier-config/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/prettier-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/prettier-config@1.0.0` # Prettier Config > Prettier configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/prettier-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev prettier @gravity-ui/prettier-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `prettier` | `^2.2.1` | ## Usage Add `.prettierrc.js` file in the project root with the following content: ```js module.exports = require('@gravity-ui/prettier-config'); ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/prettier-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/prettier-config) --- > Docs for `@gravity-ui/prettier-config@1.0.0`. Versioned at: `https://gravity-ui.com/llms/prettier-config/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/prettier-config/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/prettier-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@5.0.0` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `prettier` | `^3.0.0` | | `stylelint` | `^16.18.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@5.0.0`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/5.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@4.0.1` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `prettier` | `^3.0.0` | | `stylelint` | `^15.8.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@4.0.1`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/4.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@4.0.0` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `prettier` | `^3.0.0` | | `stylelint` | `^15.8.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@4.0.0`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@3.0.0` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `stylelint` | `^15.0.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@3.0.0`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@2.0.0` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `stylelint` | `^14.0.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@2.0.0`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/stylelint-config@1.0.0` # Stylelint Config > Stylelint configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/stylelint-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev stylelint postcss @gravity-ui/stylelint-config ``` ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `postcss` | `^8.0.0` | | `stylelint` | `^14.0.0` | ## Usage Add `.stylelintrc` file in the project root with the following content: ```json { "extends": "@gravity-ui/stylelint-config" } ``` ### Prettier If you are using Prettier, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/prettier"] } ``` ### Order If you want to order properties in your css files, extend root config with the additional rules: ```json { "extends": ["@gravity-ui/stylelint-config", "@gravity-ui/stylelint-config/order"] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/stylelint-config/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/stylelint-config) --- > Docs for `@gravity-ui/stylelint-config@1.0.0`. Versioned at: `https://gravity-ui.com/llms/stylelint-config/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/stylelint-config/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/stylelint-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/babel-preset@1.0.1` # Babel Preset > Babel configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/babel-preset` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev @gravity-ui/babel-preset ``` ## Usage ### Via `.babelrc` ```json5 { "presets": [ "@gravity-ui/babel-preset", { "env": {modules: false}, // defaults to {} "runtime": {useESModules: true}, // defaults to {} "typescript": true, // defaults to false "react": {runtime: "automatic"} // defaults to {} } ] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/babel-preset) --- > Docs for `@gravity-ui/babel-preset@1.0.1`. Versioned at: `https://gravity-ui.com/llms/babel-preset/1.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/babel-preset/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/babel-preset/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/babel-preset@1.0.0` # Babel Preset > Babel configuration preset for Gravity UI projects. > > **npm:** `@gravity-ui/babel-preset` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ``` npm install --save-dev @gravity-ui/babel-preset ``` ## Usage ### Via `.babelrc` ```json5 { "presets": [ "@gravity-ui/babel-preset", { "env": {modules: false}, // defaults to {} "runtime": {useESModules: true}, // defaults to {} "typescript": true, // defaults to false "react": {runtime: "automatic"} // defaults to {} } ] } ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/babel-preset/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/babel-preset) --- > Docs for `@gravity-ui/babel-preset@1.0.0`. Versioned at: `https://gravity-ui.com/llms/babel-preset/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/babel-preset/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/babel-preset/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@5.0.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@5.0.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/5.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/5/llms.txt` (latest of major 5), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@4.4.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@4.4.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/4.4.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@4.3.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@4.3.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/4.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@4.2.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@4.2.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/4.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@4.1.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@4.1.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/4.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@4.0.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@4.0.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/4.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/4/llms.txt` (latest of major 4), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/browserslist-config@3.0.0` # Browserslist Config > Browserslist configuration preset used in our services. > > **npm:** `@gravity-ui/browserslist-config` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm i --save-dev @gravity-ui/browserslist-config ``` Add config to `package.json` in `browserslist` section: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config" ] } ``` You can specify additional browsers based on your audience, like: ```json { "browserslist": [ "extends @gravity-ui/browserslist-config", "Chrome >= 100", "Firefox >= 100" ] } ``` ## Usage Package provides production version of browserslist. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/browserslist-config/master/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/browserslist-config) --- > Docs for `@gravity-ui/browserslist-config@3.0.0`. Versioned at: `https://gravity-ui.com/llms/browserslist-config/3.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/browserslist-config/3/llms.txt` (latest of major 3), `https://gravity-ui.com/llms/browserslist-config/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/webpack-i18n-assets-plugin@1.0.0` # Webpack i18n plugin > A plugin for Webpack that replaces calls to localization functions (i18n) with target texts. > > **npm:** `@gravity-ui/webpack-i18n-assets-plugin` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/webpack-i18n-assets-plugin/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `webpack` | `^5.0.0` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/webpack-i18n-assets-plugin/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/webpack-i18n-assets-plugin/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/webpack-i18n-assets-plugin) --- > Docs for `@gravity-ui/webpack-i18n-assets-plugin@1.0.0`. Versioned at: `https://gravity-ui.com/llms/webpack-i18n-assets-plugin/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/webpack-i18n-assets-plugin/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/webpack-i18n-assets-plugin/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.29.2` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.29.2`. Versioned at: `https://gravity-ui.com/llms/timeline/1.29.2/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.29.1` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.29.1`. Versioned at: `https://gravity-ui.com/llms/timeline/1.29.1/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.29.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.29.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.29.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.28.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.28.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.28.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.27.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.27.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.27.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.26.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.26.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.26.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.25.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.25.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.25.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.24.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.24.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.24.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.23.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.23.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.23.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.22.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.22.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.22.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.21.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.21.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.21.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/timeline@1.20.0` # Timeline > A React-based library for building interactive timeline visualizations with canvas rendering. > > **npm:** `@gravity-ui/timeline` — check the installed major version in the user's `package.json` and read docs matching it. ## Install ```bash npm install @gravity-ui/timeline ``` ## Usage The timeline component can be used in React applications with the following basic setup: ```tsx import { TimelineCanvas, useTimeline } from '@gravity-ui/timeline/react'; const MyTimelineComponent = () => { const { timeline, api, start, stop } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, // 1 hour from now axes: [], events: [], markers: [], sections: [] }, viewConfiguration: { // Optional view configuration } }); // timeline - Timeline instance // api - CanvasApi instance (same as timeline.api) // start - function to initialize timeline with canvas // stop - function to destroy timeline return (
); }; ``` ### Axis Structure Each axis has the following structure: ```typescript type TimelineAxis = { id: string; // Unique axis identifier tracksCount: number; // Number of tracks in the axis top: number; // Vertical position (px) height: number; // Height per track (px) }; ``` ### Section Structure Each section requires the following structure: ```typescript type TimelineSection = { id: string; // Unique section identifier from: number; // Start timestamp to?: number; // Optional end timestamp (defaults to timeline end) color: string; // Background color of the section hoverColor?: string; // Optional color when section is hovered renderer?: AbstractSectionRenderer; // Optional custom renderer (exported from the package) }; ``` Sections provide background coloring for time periods and help organize timeline content visually: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [], sections: [ { id: 'morning', from: Date.now(), to: Date.now() + 1800000, // 30 minutes color: 'rgba(255, 235, 59, 0.3)', // Semi-transparent yellow hoverColor: 'rgba(255, 235, 59, 0.4)' }, { id: 'afternoon', from: Date.now() + 1800000, // No 'to' specified - extends to timeline end color: 'rgba(76, 175, 80, 0.2)', // Semi-transparent green hoverColor: 'rgba(76, 175, 80, 0.3)' } ] }, viewConfiguration: { sections: { hitboxPadding: 2 // Hover detection padding } } }); return ; }; ``` ### Marker Structure Each marker requires the following structure: ```typescript type TimelineMarker = { time: number; // Timestamp for the marker position color: string; // Color of the marker line activeColor: string; // Color when marker is selected (required) hoverColor: string; // Color when marker is hovered (required) lineWidth?: number; // Optional width of the marker line label?: string; // Optional label text labelColor?: string; // Optional label color renderer?: AbstractMarkerRenderer; // Optional custom renderer nonSelectable?: boolean;// Whether marker can be selected group?: boolean; // Whether marker represents a group }; ``` ### Marker Grouping and Zoom The timeline automatically groups markers that are close together and provides zoom functionality: ```tsx const MyTimelineComponent = () => { const { timeline } = useTimeline({ settings: { start: Date.now(), end: Date.now() + 3600000, axes: [], events: [], markers: [ // These markers will be grouped together { time: Date.now(), color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 1' }, { time: Date.now() + 1000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 2' }, { time: Date.now() + 2000, color: '#ff0000', activeColor: '#ff5252', hoverColor: '#ff1744', label: 'Event 3' }, ] }, viewConfiguration: { markers: { collapseMinDistance: 8, // Group markers within 8 pixels groupZoomEnabled: true, // Enable zoom on group click groupZoomPadding: 0.3, // 30% padding around group groupZoomMaxFactor: 0.3, // Max zoom factor } } }); // Listen for group zoom events useTimelineEvent(timeline, 'on-group-marker-click', (data) => { console.log('Group zoomed:', data); }); return ; }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/timeline/main/README.md) - [Storybook](https://preview.gravity-ui.com/timeline/) - [Changelog](https://raw.githubusercontent.com/gravity-ui/timeline/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/timeline) --- > Docs for `@gravity-ui/timeline@1.20.0`. Versioned at: `https://gravity-ui.com/llms/timeline/1.20.0/llms.txt` (exact), `https://gravity-ui.com/llms/timeline/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/timeline/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor-builder@1.3.0` # Page-constructor-builder > A powerful command-line utility for building static pages from YAML configurations > > **npm:** `@gravity-ui/page-constructor-builder` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage 1. **Install package:** ```bash npm install @gravity-ui/page-constructor-builder ``` 2. **Add build command to package.json:** ```json { "scripts": { "build": "page-builder build" } } ``` 3. **Add source files:** `page-builder.config.yml`: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg theme: light minify: true ``` `pages/index.yml`: ```yaml meta: title: Hello, World description: A simple page constructor page blocks: - type: header-block title: Hello, World description: | Build beautiful static pages from **YAML configurations** using the power of [@gravity-ui/page-constructor](https://github.com/gravity-ui/page-constructor). background: color: '#f8f9fa' ``` 4. **Build your pages:** ```bash npm run build ``` 5. **Open the generated HTML files in your browser:** ```bash open dist/index.html ``` ### Commands #### `page-builder build` Build pages from YAML configurations. ```bash page-builder build [options] ``` **Options:** - `-i, --input `: Input directory containing YAML files (default: "./pages") - `-o, --output `: Output directory for built files (default: "./dist") - `-c, --config `: Configuration file path (default: "./page-builder.config.yml") - `--css `: Custom CSS files to include - `--components `: Custom components directory - `--navigation `: Navigation data file - `--assets `: Static assets directory to copy - `--theme `: Theme (light|dark) (default: "light") - `--base-url `: Base URL for the site - `--minify`: Enable minification - `--source-maps`: Generate source maps - `--watch`: Enable watch mode ### Configuration Create a `page-builder.config.yml` file in your project root: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg # Favicon file from assets or external URL theme: light baseUrl: https://mysite.com minify: true sourceMaps: false # Generate source maps for debugging (increases bundle size) css: - ./styles/main.css - ./styles/components.scss components: ./components navigation: ./navigation.yml webpack: # Custom webpack configuration ``` ### Page Configuration Create YAML files in your pages directory: ```yaml # pages/index.yml meta: title: Welcome to My Site description: This is the homepage of my awesome site blocks: - type: header-block title: Welcome! description: This is a **header block** with markdown support background: color: '#f0f0f0' - type: content-block title: About Us text: | This is a content block with multiple lines of text. You can use **markdown** formatting here. - type: CustomBlock # Your custom component title: Custom Component content: This uses a custom component ``` ### Custom Components Create React components in your components directory: ```typescript // components/CustomBlock.tsx import React from 'react'; interface CustomBlockProps { title: string; content: string; className?: string; } export const CustomBlock: React.FC = ({ title, content, className = '' }) => { return (

{title}

{content}

); }; export default CustomBlock; ``` ### Custom Styles Add your custom CSS/SCSS files: ```css /* styles/main.css */ .custom-block { padding: 20px; margin: 20px 0; border-radius: 8px; background: #f5f5f5; border-left: 4px solid #007acc; } .custom-block h2 { margin-top: 0; color: #007acc; } ``` ### Static Assets The page constructor builder automatically handles static assets like images, icons, and other files. Configure the assets directory in your configuration file: ```yaml # page-builder.config.yml input: ./pages output: ./dist assets: ./assets # Assets directory to copy ``` **Assets Directory Structure:** ``` assets/ ├── images/ │ ├── hero-banner.jpg │ └── about-photo.png ├── icons/ │ ├── logo.svg │ └── social-icons.svg └── documents/ └── brochure.pdf ``` **Using Assets in Your Pages:** ```yaml # pages/index.yml blocks: - type: header-block title: Welcome description: Check out our amazing content background: image: assets/images/hero-banner.jpg - type: media-block title: About Us media: - type: image src: assets/images/about-photo.png alt: Our team photo ``` ### Favicon The page constructor builder supports adding favicons to your static pages. You can specify either a local file from your assets directory or an external URL. #### Configuration Add the `favicon` option to your configuration file: ```yaml # page-builder.config.yml favicon: logo.svg # Local file from assets directory # or favicon: https://cdn.example.com/favicon.ico # External URL ``` #### Local Favicon Files For local favicon files, the builder will: - Automatically detect the file in your assets directory - Copy it to the output directory - Generate proper HTML `` tags with correct MIME types **Supported file formats:** - **SVG** (recommended) - `image/svg+xml` - **ICO** (classic) - `image/x-icon` - **PNG** (modern) - `image/png` - **JPG/JPEG** (acceptable) - `image/jpeg` - **GIF** (animated) - `image/gif` **Examples:** ```yaml # page-builder.config.yml favicon: logo.svg # File in assets/ directory favicon: icons/favicon.ico # File in assets/icons/ subdirectory favicon: ./custom/path/favicon.png # Custom path relative to project favicon: /absolute/path/favicon.ico # Absolute path ``` #### External Favicon URLs You can also use external favicon URLs from CDNs or other domains: ```yaml # page-builder.config.yml favicon: https://cdn.example.com/favicon.ico favicon: https://mysite.com/assets/logo.svg ``` #### Generated HTML The builder automatically generates appropriate HTML tags based on the favicon type: ```html ``` ### Navigation The page constructor builder supports global navigation configuration that appears on all pages. Navigation is configured through a separate YAML file. #### Navigation Configuration Create a `navigation.yml` file in your project root (or specify a custom path in your config): ```yaml # navigation.yml logo: text: Your Site Name url: 'index.html' icon: 'assets/logo.svg' header: leftItems: - text: Home url: 'index.html' type: 'link' - text: About url: 'about.html' type: 'link' - text: Documentation url: 'https://external-site.com/docs' type: 'link' rightItems: - text: GitHub url: 'https://github.com/your-repo' type: 'link' - text: Contact url: 'contact.html' type: 'link' footer: leftItems: - text: Privacy Policy url: 'privacy.html' type: 'link' rightItems: - text: © 2024 Your Company type: 'text' ``` #### Per-Page Navigation Override You can override navigation for specific pages by adding a `navigation` section directly in your page YAML: ```yaml # pages/special-page.yml meta: title: Special Page navigation: logo: text: Special Site url: 'index.html' header: leftItems: - text: Back to Main url: 'index.html' type: 'link' blocks: - type: header-block title: This page has custom navigation ``` ### Analytics Configuration Add the `analytics` field to your `page-builder.config.yml`: ```yaml analytics: ./analytics.js ``` `analytics.js`: ```javascript module.exports = { sendEvents: (events) => { /* ... */ }, autoEvents: true, }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor-builder) --- > Docs for `@gravity-ui/page-constructor-builder@1.3.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor-builder/1.3.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor-builder/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/page-constructor-builder/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor-builder@1.2.0` # Page-constructor-builder > A powerful command-line utility for building static pages from YAML configurations > > **npm:** `@gravity-ui/page-constructor-builder` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage 1. **Install package:** ```bash npm install @gravity-ui/page-constructor-builder ``` 2. **Add build command to package.json:** ```json { "scripts": { "build": "page-builder build" } } ``` 3. **Add source files:** `page-builder.config.yml`: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg theme: light minify: true ``` `pages/index.yml`: ```yaml meta: title: Hello, World description: A simple page constructor page blocks: - type: header-block title: Hello, World description: | Build beautiful static pages from **YAML configurations** using the power of [@gravity-ui/page-constructor](https://github.com/gravity-ui/page-constructor). background: color: '#f8f9fa' ``` 4. **Build your pages:** ```bash npm run build ``` 5. **Open the generated HTML files in your browser:** ```bash open dist/index.html ``` ### Commands #### `page-builder build` Build pages from YAML configurations. ```bash page-builder build [options] ``` **Options:** - `-i, --input `: Input directory containing YAML files (default: "./pages") - `-o, --output `: Output directory for built files (default: "./dist") - `-c, --config `: Configuration file path (default: "./page-builder.config.yml") - `--css `: Custom CSS files to include - `--components `: Custom components directory - `--navigation `: Navigation data file - `--assets `: Static assets directory to copy - `--theme `: Theme (light|dark) (default: "light") - `--base-url `: Base URL for the site - `--minify`: Enable minification - `--source-maps`: Generate source maps - `--watch`: Enable watch mode ### Configuration Create a `page-builder.config.yml` file in your project root: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg # Favicon file from assets or external URL theme: light baseUrl: https://mysite.com minify: true sourceMaps: false # Generate source maps for debugging (increases bundle size) css: - ./styles/main.css - ./styles/components.scss components: ./components navigation: ./navigation.yml webpack: # Custom webpack configuration ``` ### Page Configuration Create YAML files in your pages directory: ```yaml # pages/index.yml meta: title: Welcome to My Site description: This is the homepage of my awesome site blocks: - type: header-block title: Welcome! description: This is a **header block** with markdown support background: color: '#f0f0f0' - type: content-block title: About Us text: | This is a content block with multiple lines of text. You can use **markdown** formatting here. - type: CustomBlock # Your custom component title: Custom Component content: This uses a custom component ``` ### Custom Components Create React components in your components directory: ```typescript // components/CustomBlock.tsx import React from 'react'; interface CustomBlockProps { title: string; content: string; className?: string; } export const CustomBlock: React.FC = ({ title, content, className = '' }) => { return (

{title}

{content}

); }; export default CustomBlock; ``` ### Custom Styles Add your custom CSS/SCSS files: ```css /* styles/main.css */ .custom-block { padding: 20px; margin: 20px 0; border-radius: 8px; background: #f5f5f5; border-left: 4px solid #007acc; } .custom-block h2 { margin-top: 0; color: #007acc; } ``` ### Static Assets The page constructor builder automatically handles static assets like images, icons, and other files. Configure the assets directory in your configuration file: ```yaml # page-builder.config.yml input: ./pages output: ./dist assets: ./assets # Assets directory to copy ``` **Assets Directory Structure:** ``` assets/ ├── images/ │ ├── hero-banner.jpg │ └── about-photo.png ├── icons/ │ ├── logo.svg │ └── social-icons.svg └── documents/ └── brochure.pdf ``` **Using Assets in Your Pages:** ```yaml # pages/index.yml blocks: - type: header-block title: Welcome description: Check out our amazing content background: image: assets/images/hero-banner.jpg - type: media-block title: About Us media: - type: image src: assets/images/about-photo.png alt: Our team photo ``` ### Favicon The page constructor builder supports adding favicons to your static pages. You can specify either a local file from your assets directory or an external URL. #### Configuration Add the `favicon` option to your configuration file: ```yaml # page-builder.config.yml favicon: logo.svg # Local file from assets directory # or favicon: https://cdn.example.com/favicon.ico # External URL ``` #### Local Favicon Files For local favicon files, the builder will: - Automatically detect the file in your assets directory - Copy it to the output directory - Generate proper HTML `` tags with correct MIME types **Supported file formats:** - **SVG** (recommended) - `image/svg+xml` - **ICO** (classic) - `image/x-icon` - **PNG** (modern) - `image/png` - **JPG/JPEG** (acceptable) - `image/jpeg` - **GIF** (animated) - `image/gif` **Examples:** ```yaml # page-builder.config.yml favicon: logo.svg # File in assets/ directory favicon: icons/favicon.ico # File in assets/icons/ subdirectory favicon: ./custom/path/favicon.png # Custom path relative to project favicon: /absolute/path/favicon.ico # Absolute path ``` #### External Favicon URLs You can also use external favicon URLs from CDNs or other domains: ```yaml # page-builder.config.yml favicon: https://cdn.example.com/favicon.ico favicon: https://mysite.com/assets/logo.svg ``` #### Generated HTML The builder automatically generates appropriate HTML tags based on the favicon type: ```html ``` ### Navigation The page constructor builder supports global navigation configuration that appears on all pages. Navigation is configured through a separate YAML file. #### Navigation Configuration Create a `navigation.yml` file in your project root (or specify a custom path in your config): ```yaml # navigation.yml logo: text: Your Site Name url: 'index.html' icon: 'assets/logo.svg' header: leftItems: - text: Home url: 'index.html' type: 'link' - text: About url: 'about.html' type: 'link' - text: Documentation url: 'https://external-site.com/docs' type: 'link' rightItems: - text: GitHub url: 'https://github.com/your-repo' type: 'link' - text: Contact url: 'contact.html' type: 'link' footer: leftItems: - text: Privacy Policy url: 'privacy.html' type: 'link' rightItems: - text: © 2024 Your Company type: 'text' ``` #### Per-Page Navigation Override You can override navigation for specific pages by adding a `navigation` section directly in your page YAML: ```yaml # pages/special-page.yml meta: title: Special Page navigation: logo: text: Special Site url: 'index.html' header: leftItems: - text: Back to Main url: 'index.html' type: 'link' blocks: - type: header-block title: This page has custom navigation ``` ### Analytics Configuration Add the `analytics` field to your `page-builder.config.yml`: ```yaml analytics: ./analytics.js ``` `analytics.js`: ```javascript module.exports = { sendEvents: (events) => { /* ... */ }, autoEvents: true, }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor-builder) --- > Docs for `@gravity-ui/page-constructor-builder@1.2.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor-builder/1.2.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor-builder/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/page-constructor-builder/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor-builder@1.1.0` # Page-constructor-builder > A powerful command-line utility for building static pages from YAML configurations > > **npm:** `@gravity-ui/page-constructor-builder` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage 1. **Install package:** ```bash npm install @gravity-ui/page-constructor-builder ``` 2. **Add build command to package.json:** ```json { "scripts": { "build": "page-builder build" } } ``` 3. **Add source files:** `page-builder.config.yml`: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg theme: light minify: true ``` `pages/index.yml`: ```yaml meta: title: Hello, World description: A simple page constructor page blocks: - type: header-block title: Hello, World description: | Build beautiful static pages from **YAML configurations** using the power of [@gravity-ui/page-constructor](https://github.com/gravity-ui/page-constructor). background: color: '#f8f9fa' ``` 4. **Build your pages:** ```bash npm run build ``` 5. **Open the generated HTML files in your browser:** ```bash open dist/index.html ``` ### Commands #### `page-builder build` Build pages from YAML configurations. ```bash page-builder build [options] ``` **Options:** - `-i, --input `: Input directory containing YAML files (default: "./pages") - `-o, --output `: Output directory for built files (default: "./dist") - `-c, --config `: Configuration file path (default: "./page-builder.config.yml") - `--css `: Custom CSS files to include - `--components `: Custom components directory - `--navigation `: Navigation data file - `--assets `: Static assets directory to copy - `--theme `: Theme (light|dark) (default: "light") - `--base-url `: Base URL for the site - `--minify`: Enable minification - `--source-maps`: Generate source maps - `--watch`: Enable watch mode ### Configuration Create a `page-builder.config.yml` file in your project root: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg # Favicon file from assets or external URL theme: light baseUrl: https://mysite.com minify: true sourceMaps: false # Generate source maps for debugging (increases bundle size) css: - ./styles/main.css - ./styles/components.scss components: ./components navigation: ./navigation.yml webpack: # Custom webpack configuration ``` ### Page Configuration Create YAML files in your pages directory: ```yaml # pages/index.yml meta: title: Welcome to My Site description: This is the homepage of my awesome site blocks: - type: header-block title: Welcome! description: This is a **header block** with markdown support background: color: '#f0f0f0' - type: content-block title: About Us text: | This is a content block with multiple lines of text. You can use **markdown** formatting here. - type: CustomBlock # Your custom component title: Custom Component content: This uses a custom component ``` ### Custom Components Create React components in your components directory: ```typescript // components/CustomBlock.tsx import React from 'react'; interface CustomBlockProps { title: string; content: string; className?: string; } export const CustomBlock: React.FC = ({ title, content, className = '' }) => { return (

{title}

{content}

); }; export default CustomBlock; ``` ### Custom Styles Add your custom CSS/SCSS files: ```css /* styles/main.css */ .custom-block { padding: 20px; margin: 20px 0; border-radius: 8px; background: #f5f5f5; border-left: 4px solid #007acc; } .custom-block h2 { margin-top: 0; color: #007acc; } ``` ### Static Assets The page constructor builder automatically handles static assets like images, icons, and other files. Configure the assets directory in your configuration file: ```yaml # page-builder.config.yml input: ./pages output: ./dist assets: ./assets # Assets directory to copy ``` **Assets Directory Structure:** ``` assets/ ├── images/ │ ├── hero-banner.jpg │ └── about-photo.png ├── icons/ │ ├── logo.svg │ └── social-icons.svg └── documents/ └── brochure.pdf ``` **Using Assets in Your Pages:** ```yaml # pages/index.yml blocks: - type: header-block title: Welcome description: Check out our amazing content background: image: assets/images/hero-banner.jpg - type: media-block title: About Us media: - type: image src: assets/images/about-photo.png alt: Our team photo ``` ### Favicon The page constructor builder supports adding favicons to your static pages. You can specify either a local file from your assets directory or an external URL. #### Configuration Add the `favicon` option to your configuration file: ```yaml # page-builder.config.yml favicon: logo.svg # Local file from assets directory # or favicon: https://cdn.example.com/favicon.ico # External URL ``` #### Local Favicon Files For local favicon files, the builder will: - Automatically detect the file in your assets directory - Copy it to the output directory - Generate proper HTML `` tags with correct MIME types **Supported file formats:** - **SVG** (recommended) - `image/svg+xml` - **ICO** (classic) - `image/x-icon` - **PNG** (modern) - `image/png` - **JPG/JPEG** (acceptable) - `image/jpeg` - **GIF** (animated) - `image/gif` **Examples:** ```yaml # page-builder.config.yml favicon: logo.svg # File in assets/ directory favicon: icons/favicon.ico # File in assets/icons/ subdirectory favicon: ./custom/path/favicon.png # Custom path relative to project favicon: /absolute/path/favicon.ico # Absolute path ``` #### External Favicon URLs You can also use external favicon URLs from CDNs or other domains: ```yaml # page-builder.config.yml favicon: https://cdn.example.com/favicon.ico favicon: https://mysite.com/assets/logo.svg ``` #### Generated HTML The builder automatically generates appropriate HTML tags based on the favicon type: ```html ``` ### Navigation The page constructor builder supports global navigation configuration that appears on all pages. Navigation is configured through a separate YAML file. #### Navigation Configuration Create a `navigation.yml` file in your project root (or specify a custom path in your config): ```yaml # navigation.yml logo: text: Your Site Name url: 'index.html' icon: 'assets/logo.svg' header: leftItems: - text: Home url: 'index.html' type: 'link' - text: About url: 'about.html' type: 'link' - text: Documentation url: 'https://external-site.com/docs' type: 'link' rightItems: - text: GitHub url: 'https://github.com/your-repo' type: 'link' - text: Contact url: 'contact.html' type: 'link' footer: leftItems: - text: Privacy Policy url: 'privacy.html' type: 'link' rightItems: - text: © 2024 Your Company type: 'text' ``` #### Per-Page Navigation Override You can override navigation for specific pages by adding a `navigation` section directly in your page YAML: ```yaml # pages/special-page.yml meta: title: Special Page navigation: logo: text: Special Site url: 'index.html' header: leftItems: - text: Back to Main url: 'index.html' type: 'link' blocks: - type: header-block title: This page has custom navigation ``` ### Analytics Configuration Add the `analytics` field to your `page-builder.config.yml`: ```yaml analytics: ./analytics.js ``` `analytics.js`: ```javascript module.exports = { sendEvents: (events) => { /* ... */ }, autoEvents: true, }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor-builder) --- > Docs for `@gravity-ui/page-constructor-builder@1.1.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor-builder/1.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor-builder/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/page-constructor-builder/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/page-constructor-builder@1.0.0` # Page-constructor-builder > A powerful command-line utility for building static pages from YAML configurations > > **npm:** `@gravity-ui/page-constructor-builder` — check the installed major version in the user's `package.json` and read docs matching it. ## Usage 1. **Install package:** ```bash npm install @gravity-ui/page-constructor-builder ``` 2. **Add build command to package.json:** ```json { "scripts": { "build": "page-builder build" } } ``` 3. **Add source files:** `page-builder.config.yml`: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg theme: light minify: true ``` `pages/index.yml`: ```yaml meta: title: Hello, World description: A simple page constructor page blocks: - type: header-block title: Hello, World description: | Build beautiful static pages from **YAML configurations** using the power of [@gravity-ui/page-constructor](https://github.com/gravity-ui/page-constructor). background: color: '#f8f9fa' ``` 4. **Build your pages:** ```bash npm run build ``` 5. **Open the generated HTML files in your browser:** ```bash open dist/index.html ``` ### Commands #### `page-builder build` Build pages from YAML configurations. ```bash page-builder build [options] ``` **Options:** - `-i, --input `: Input directory containing YAML files (default: "./pages") - `-o, --output `: Output directory for built files (default: "./dist") - `-c, --config `: Configuration file path (default: "./page-builder.config.yml") - `--css `: Custom CSS files to include - `--components `: Custom components directory - `--navigation `: Navigation data file - `--assets `: Static assets directory to copy - `--theme `: Theme (light|dark) (default: "light") - `--base-url `: Base URL for the site - `--minify`: Enable minification - `--source-maps`: Generate source maps - `--watch`: Enable watch mode ### Configuration Create a `page-builder.config.yml` file in your project root: ```yaml input: ./pages output: ./dist assets: ./assets favicon: logo.svg # Favicon file from assets or external URL theme: light baseUrl: https://mysite.com minify: true sourceMaps: false # Generate source maps for debugging (increases bundle size) css: - ./styles/main.css - ./styles/components.scss components: ./components navigation: ./navigation.yml webpack: # Custom webpack configuration ``` ### Page Configuration Create YAML files in your pages directory: ```yaml # pages/index.yml meta: title: Welcome to My Site description: This is the homepage of my awesome site blocks: - type: header-block title: Welcome! description: This is a **header block** with markdown support background: color: '#f0f0f0' - type: content-block title: About Us text: | This is a content block with multiple lines of text. You can use **markdown** formatting here. - type: CustomBlock # Your custom component title: Custom Component content: This uses a custom component ``` ### Custom Components Create React components in your components directory: ```typescript // components/CustomBlock.tsx import React from 'react'; interface CustomBlockProps { title: string; content: string; className?: string; } export const CustomBlock: React.FC = ({ title, content, className = '' }) => { return (

{title}

{content}

); }; export default CustomBlock; ``` ### Custom Styles Add your custom CSS/SCSS files: ```css /* styles/main.css */ .custom-block { padding: 20px; margin: 20px 0; border-radius: 8px; background: #f5f5f5; border-left: 4px solid #007acc; } .custom-block h2 { margin-top: 0; color: #007acc; } ``` ### Static Assets The page constructor builder automatically handles static assets like images, icons, and other files. Configure the assets directory in your configuration file: ```yaml # page-builder.config.yml input: ./pages output: ./dist assets: ./assets # Assets directory to copy ``` **Assets Directory Structure:** ``` assets/ ├── images/ │ ├── hero-banner.jpg │ └── about-photo.png ├── icons/ │ ├── logo.svg │ └── social-icons.svg └── documents/ └── brochure.pdf ``` **Using Assets in Your Pages:** ```yaml # pages/index.yml blocks: - type: header-block title: Welcome description: Check out our amazing content background: image: assets/images/hero-banner.jpg - type: media-block title: About Us media: - type: image src: assets/images/about-photo.png alt: Our team photo ``` ### Favicon The page constructor builder supports adding favicons to your static pages. You can specify either a local file from your assets directory or an external URL. #### Configuration Add the `favicon` option to your configuration file: ```yaml # page-builder.config.yml favicon: logo.svg # Local file from assets directory # or favicon: https://cdn.example.com/favicon.ico # External URL ``` #### Local Favicon Files For local favicon files, the builder will: - Automatically detect the file in your assets directory - Copy it to the output directory - Generate proper HTML `` tags with correct MIME types **Supported file formats:** - **SVG** (recommended) - `image/svg+xml` - **ICO** (classic) - `image/x-icon` - **PNG** (modern) - `image/png` - **JPG/JPEG** (acceptable) - `image/jpeg` - **GIF** (animated) - `image/gif` **Examples:** ```yaml # page-builder.config.yml favicon: logo.svg # File in assets/ directory favicon: icons/favicon.ico # File in assets/icons/ subdirectory favicon: ./custom/path/favicon.png # Custom path relative to project favicon: /absolute/path/favicon.ico # Absolute path ``` #### External Favicon URLs You can also use external favicon URLs from CDNs or other domains: ```yaml # page-builder.config.yml favicon: https://cdn.example.com/favicon.ico favicon: https://mysite.com/assets/logo.svg ``` #### Generated HTML The builder automatically generates appropriate HTML tags based on the favicon type: ```html ``` ### Navigation The page constructor builder supports global navigation configuration that appears on all pages. Navigation is configured through a separate YAML file. #### Navigation Configuration Create a `navigation.yml` file in your project root (or specify a custom path in your config): ```yaml # navigation.yml logo: text: Your Site Name url: 'index.html' icon: 'assets/logo.svg' header: leftItems: - text: Home url: 'index.html' type: 'link' - text: About url: 'about.html' type: 'link' - text: Documentation url: 'https://external-site.com/docs' type: 'link' rightItems: - text: GitHub url: 'https://github.com/your-repo' type: 'link' - text: Contact url: 'contact.html' type: 'link' footer: leftItems: - text: Privacy Policy url: 'privacy.html' type: 'link' rightItems: - text: © 2024 Your Company type: 'text' ``` #### Per-Page Navigation Override You can override navigation for specific pages by adding a `navigation` section directly in your page YAML: ```yaml # pages/special-page.yml meta: title: Special Page navigation: logo: text: Special Site url: 'index.html' header: leftItems: - text: Back to Main url: 'index.html' type: 'link' blocks: - type: header-block title: This page has custom navigation ``` ### Analytics Configuration Add the `analytics` field to your `page-builder.config.yml`: ```yaml analytics: ./analytics.js ``` `analytics.js`: ```javascript module.exports = { sendEvents: (events) => { /* ... */ }, autoEvents: true, }; ``` > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/page-constructor-builder/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/page-constructor-builder) --- > Docs for `@gravity-ui/page-constructor-builder@1.0.0`. Versioned at: `https://gravity-ui.com/llms/page-constructor-builder/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/page-constructor-builder/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/page-constructor-builder/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@2.0.1` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@2.0.1`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/2.0.1/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@2.0.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@2.0.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/2.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/2/llms.txt` (latest of major 2), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@1.1.3` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@1.1.3`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/1.1.3/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@1.1.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@1.1.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/1.1.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@1.0.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `react` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `react-dom` | `^17.0.0 || ^18.0.0 || ^19.0.0` | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@1.0.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/1.0.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/1/llms.txt` (latest of major 1), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@0.9.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@0.9.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/0.9.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@0.8.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@0.8.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/0.8.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@0.7.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | | `@playwright/experimental-ct-react` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@0.7.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/0.7.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@0.5.0` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@0.5.0`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/0.5.0/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/playwright-tools@0.4.1` # Playwright Tools > A collection of utilities for writing Playwright tests, including browser actions, HAR-based request recording and replay, and component testing fixtures. > > **npm:** `@gravity-ui/playwright-tools` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) for full documentation. ## Peer dependencies Install these in the host project at a compatible version: | Package | Version range | | --- | --- | | `@playwright/test` | `^1.22` | ## Links - [README](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/README.md) - [Changelog](https://raw.githubusercontent.com/gravity-ui/playwright-tools/main/CHANGELOG.md) - [GitHub](https://github.com/gravity-ui/playwright-tools) --- > Docs for `@gravity-ui/playwright-tools@0.4.1`. Versioned at: `https://gravity-ui.com/llms/playwright-tools/0.4.1/llms.txt` (exact), `https://gravity-ui.com/llms/playwright-tools/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/playwright-tools/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead. --- > Generated for `@gravity-ui/farm@0.0.1-rc2025-08-15-18-00` # Farm > Documentation for the Farm package. > > **npm:** `@gravity-ui/farm` — check the installed major version in the user's `package.json` and read docs matching it. > Note: this package's README does not yet have a `## For AI agents` section. See the [README](https://raw.githubusercontent.com/gravity-ui/farm/main/README.md) for full documentation. ## Links - [README](https://raw.githubusercontent.com/gravity-ui/farm/main/README.md) - [GitHub](https://github.com/gravity-ui/farm) --- > Docs for `@gravity-ui/farm@0.0.1-rc2025-08-15-18-00`. Versioned at: `https://gravity-ui.com/llms/farm/0.0.1-rc2025-08-15-18-00/llms.txt` (exact), `https://gravity-ui.com/llms/farm/0/llms.txt` (latest of major 0), `https://gravity-ui.com/llms/farm/llms.txt` (latest). If the version installed in the project differs, fetch the matching URL instead.