Skip to content

Components

All components must be rendered inside a KymaProvider. Each component wraps its inner content in a KymaErrorBoundary, so a render error inside the component never crashes the host application.


KymaProvider

Import: import { KymaProvider } from "@kyma-ai/react"

Root provider. Creates a KymaClient, optionally a QueryClient, applies the theme as CSS custom properties, and renders a portal target for Radix UI popovers/dialogs.

PropTypeRequiredDefaultDescription
endpointstringyesKyma server URL, e.g. https://kyma.acme.internal. Trailing slashes are stripped.
authKymaAuthyes{ token: string } or { getToken: (opts?) => Promise<string> }. See Authentication.
databasestringnoDefault database sent as x-database on every request. Per-component database props override this.
themePartial<KymaTheme> | "inherit"nokymaDarkTheme tokens merged over kymaDark, or "inherit" to use host CSS vars. See Theming.
queryClientQueryClientnoisolated instanceReuse the host app's TanStack Query client. The provider creates its own (with staleTime: 30 000, refetchOnWindowFocus: false, retry: 1) when omitted.
onError(err: unknown) => voidnoError handler propagated via context for components that bubble non-render errors (e.g. auth failures).
childrenReactNodeyesComponent tree.

KymaGraph

Import: import { KymaGraph } from "@kyma-ai/react/graph"

Bundle note: pulls in react-force-graph-2d (WebGL force-directed graph canvas). If you never render KymaGraph, this library is not bundled.

Self-contained interactive property graph. Fetches graph data from the Kyma server, merges multi-database graphs onto a single canvas, and renders a force-directed layout with a sidebar showing controls, an inspector, and a legend.

Each mounted KymaGraph owns its own isolated Zustand store — two instances on the same page never share selection or layout state.

PropTypeDefaultDescription
graphsArray<{ database?: string; graph: string }>Explicit list of (database, graph) pairs to load. Omit to load all graphs from the provider's default database.
discover"all-databases"When set, discovers every graph across every database via catalog fan-out. Overrides graphs.
heightnumber | string"100%"Height of the container div.
layoutLayoutAlgorithm"force"Initial layout algorithm seeded into the graph store.
toolbarbooleantrueShow the sidebar/toolbar control surface. Setting either toolbar or sidebar to false hides the entire control surface (they share the same DOM region).
sidebarbooleantrueAlias for toolbar.
focusQuerystringInitial search text seeded into the store's search field on first mount. Not a controlled value — subsequent prop changes are ignored.
realmstringOverride the realm passed to the graph data layer.
classNamestringExtra CSS class on the container div.
styleReact.CSSPropertiesInline styles for the container div.
fallbackReactNodeCustom content rendered by the error boundary on a render error.
onNodeClick(node: GraphNode) => voidCalled when a node is clicked in the canvas. Receives the full GraphNode record.
onSelectionChange(nodes: GraphNode[]) => voidCalled when the selection changes. Receives an array of 0 or 1 node (current design is single-select).

KymaQueryEditor

Import: import { KymaQueryEditor } from "@kyma-ai/react/query"

Bundle note: pulls in @monaco-editor/react and monaco-editor. If you never render KymaQueryEditor, Monaco is not bundled.

Full-featured embedded query surface: KQL/SQL editor with syntax highlighting and completions, a schema browser, a results grid, optional chart panel, and a time range picker. Uses useKymaQuery internally.

PropTypeDefaultDescription
language"kql" | "sql""kql"Query language. SQL mode disables KQL completions and time-range injection.
defaultQuerystring""Initial query text. Uncontrolled — prop changes after mount are ignored.
showSchemaBrowserbooleantrueShow the schema browser panel on the left.
showResultsbooleantrueShow the results grid below the editor.
showChartbooleantrueShow an auto-detected chart panel below results when the result shape is plottable.
showTimeRangebooleantrueShow the time range picker in the toolbar (KQL mode only).
timeRangeTimeRange{ preset: "1h" }Initial time range; re-applied when the prop changes (controlled-ish).
readOnlybooleanfalseMake the editor read-only and hide the Run button.
databasestringOverride the database for execution and schema loading. Falls back to the provider's default database.
classNamestringCSS class on the outermost container div.
styleReact.CSSPropertiesInline styles for the outermost container div.
fallbackReactNodeError boundary fallback.
onResults(r: { columns: Column[]; rows: Record<string, unknown>[] }) => voidCalled after each successful query with the full result set.
onQueryChange(q: string) => voidCalled on each editor keystroke with the current query text.

TimeRange is { preset: "5m" | "15m" | "1h" | "6h" | "24h" | "7d" | "30d" }.

In KQL mode, the time range is spliced into the query via prependTimeFilter() immediately before execution — the editor's displayed text is never mutated. In SQL mode, time-range injection is skipped; write your own WHERE clause.


KymaDiscover

Import: import { KymaDiscover } from "@kyma-ai/react/discover"

Streaming log/event search surface with a scope picker, histogram timeline, field stats rail, and expandable row detail drawer. The discover grammar accepts free-text and field filters (service_name == "api", level != "debug", status_code > 400, full-text error).

When database is set, KymaDiscover calls client.withDatabase(database) internally and overrides the KymaContext client for all child components. Every search request and the scope picker list both use the scoped client.

PropTypeDefaultDescription
defaultQuerystringInitial discover-grammar search text.
scopeScopeInitial scope (set of source tables to search).
timeRangeTimeRangeInitial time range.
databasestringOverride the database for all search requests.
classNamestringCSS class on the container div.
styleReact.CSSPropertiesInline styles for the container div.
fallbackReactNodeError boundary fallback.
onRowOpen(row: Record<string, unknown>, source: string) => voidCalled when the user clicks a row to open its detail drawer. source is the source table key.
onExportKql(kql: string) => voidCalled when the user clicks "Export to KQL". Receives the compiled KQL string.
onSearchChange(search: string) => voidCalled on each keystroke in the search bar. Useful for persisting search state externally.
onScopeChange(scope: Scope) => voidCalled when the scope changes.
onTimeRangeChange(timeRange: TimeRange) => voidCalled when the time range changes.

KymaDashboard

Import: import { KymaDashboard } from "@kyma-ai/react/dashboards"

Bundle note: pulls in react-grid-layout for the drag-resize grid and echarts for panel charts.

Embeds a Kyma dashboard by ID. Read-only by default; editable={true} enables drag-to-reorder, panel resize, add/edit/delete, and inline name editing. Saves go directly to the Kyma API.

When database is set, all panel queries, the dashboard load, and the schema fetch in the add-panel modal all use a scoped client (same token cache, different x-database default). New panels are pre-seeded with the database so their stored database_name matches the override.

PropTypeDefaultDescription
dashboardIdstringyesID of the dashboard to load.
editablebooleanfalseAllow panel add/edit/delete and drag-to-reorder.
timeRangeTimeRangeOverride the dashboard's stored time range. When omitted, uses time_range_preset from the server.
databasestringOverride the database for all panel queries and dashboard operations.
classNamestringCSS class on the root element.
styleReact.CSSPropertiesInline styles for the root element.
fallbackReactNodeContent rendered while the dashboard is loading.
onPanelClick(panelId: string) => voidCalled when a panel title is clicked (read-only mode only).
onEditChange(editable: boolean) => voidCalled when the edit/view toggle is clicked. If provided, the host controls edit mode (the prop drives it); otherwise edit mode is managed internally.
onSaveSuccess(dashboard: DashboardWithPanels) => voidCalled after a successful save with the updated dashboard object.
onSaveError(err: unknown) => voidCalled when a save fails.

Auto-refresh: when refresh_interval_seconds > 0 on the loaded dashboard and the component is not in edit mode, a setInterval fires at that cadence and invalidates the React Query cache for this dashboard.


KymaAgentChat

Import: import { KymaAgentChat } from "@kyma-ai/react/agent"

Embedded AI assistant chat backed by the Kyma agent (POST /v1/agent/ask). The component wraps AgentConsole in a CapabilityGate on the agent capability flag: servers without the inline agent surface render a "not available" card rather than 404-ing. The gate fails open while capabilities load (pre-capabilities servers are treated as capable).

Note: KymaAgentChat requires a full-access token (no kyma_databases scope). Database-scoped tokens receive 403 from the server because the agent's tool loop can address any database internally. See Authentication.

PropTypeDefaultDescription
placeholderstring"Ask a question about <database or 'your data'>…"Placeholder text in the input area.
databasestringOverride the database sent with each request. Defaults to the transport's database.
classNamestringCSS class on the root container.
styleReact.CSSPropertiesInline styles for the root container.
fallbackReactNodeError boundary fallback.
onMessage(m: { role: string; text: string }) => voidCalled once per completed assistant turn (when the SSE stream finishes).

The agent uses the Vercel AI SDK UI Message Stream v1 protocol over SSE. Multi-turn conversation state (session ID) is tracked internally; the session resets when the component unmounts.

An open-source project · MIT licensed.