@fusebase/fusebase-dashboards

中文文档
0.1.2发布于 2026/11/03SEE LICENSE IN LICENSETypeScriptES Module近 30 天下载 1967

FuseBase databases UI for React: databases list and table screens.

原始使用文档
文档目录6 节
  1. Install
  2. CSS
  3. Usage
  4. Host contract
  5. Embed entry
  6. License

@fusebase/fusebase-dashboards

FuseBase databases UI for React: the databases list and the table screen. It runs on the FuseBase dashboard API through a transport that the host gives.

Install

npm install @fusebase/fusebase-dashboards

Peers: react and react-dom 18 or later. The package does not need Next.js.

@tanstack/react-query 5 is a dependency. If your app has a QueryClientProvider above the screens, the package uses that client. If your app has a different 5.x version, npm installs a second copy, and the package then makes its own QueryClient. To share one client, use the same 5.x version as the package.

Long text cells render markdown with @fusebase/markdown-viewer, loaded only when a table has long text. The viewer has optional dynamic imports (katex, mermaid, dompurify, highlight.js/lib/common). Your bundler must resolve them: install them, or alias them to an empty module (webpack: resolve.alias: { katex: false, ... }). Without them, math, diagrams and code show as plain text.

Long text cells open @milkdown/crepe (the editor of v2 cells) on edit, also as a lazy chunk. Crepe imports dompurify, so do not alias dompurify to an empty module. Math is off in the editor, so a katex alias is safe.

CSS

Import both files once:

import "@fusebase/fusebase-dashboards/tokens.css";
import "@fusebase/fusebase-dashboards/styles.css";

tokens.css has the default --db-* variables. Text uses the font of the host page (--db-font-body is inherit). styles.css styles the components with these variables. All package UI is inside a .db-root element, so a host can change the theme with a rule on .db-root. :root .db-root wins over tokens.css in any import order:

:root .db-root {
  --db-page: #101010;
  --db-text: #f2f2f2;
}

The table grid scrolls in its own box, at most 70vh high, with a sticky head; it renders only the rows near the scroll position. To change the height, add a rule such as .db-root .db-grid { max-height: 60vh; }.

Usage

import {
  createDashboardsClient,
  DashboardsProvider,
  DatabasesScreen,
  TableScreen,
} from "@fusebase/fusebase-dashboards";

const client = createDashboardsClient({
  // The dashboard API origin with `/api/v1`, or a backend that forwards there.
  baseUrl: "/api/dashboards",
  // The host adds credentials or auth headers. The package never calls the global fetch.
  fetch: (input, init) => fetch(input, { ...init, credentials: "include" }),
});

export function Databases({ orgId }: { orgId: string }) {
  return (
    <DashboardsProvider client={client}>
      <DatabasesScreen
        orgId={orgId}
        navigate={(href) => history.pushState(null, "", href)}
      />
    </DashboardsProvider>
  );
}

baseUrl can be relative in the browser only. In Node, give an absolute URL.

Host contract

DashboardsProvider props:

PropDescription
clientFrom createDashboardsClient({ baseUrl, fetch }).
dictionaryTexts that replace the English defaults (defaultDictionary).
pageSizeRows per page. If not set, the value the user saved is used.
loadAssignees() => Promise<AssigneeOption[]>: the users an assignee cell can hold ({ id, name, email?, client? }). Without it, assignee cells are read-only.
uploadFiles(files: File[], context: FileCellContext) => Promise<DashboardFile[]>: uploads the files and returns { name, url, ... } for each. Without it, files cells have no upload control (remove still works).
filesBaseUrlBase for a relative file url (v2 stores /uuid/name); Studio passes /box/file. An absolute url is used as it is.

Screen props:

PropDescription
orgIdOrganization id.
databaseIdTableScreen only.
tableIdTableScreen, optional. Without it, the screen goes to the first table.
viewIdTableScreen, optional. Without it, the screen goes to the default view.
linkComponentOptional. Your router link, with href and children props. Without it, the package renders <a> that calls navigate.
navigate(href, { replace }) => void. replace: true is for redirects. Keep this function stable (for example, useCallback).

Hrefs have the shape /:orgId/databases/:databaseId/tables/:tableId/views/:viewId (databasesHref, databaseHref, tableHref). If your app has a base path, add it in linkComponent and navigate.

Errors: every failed API call is a DashboardsError with status and message.

The package keeps the rows per page in localStorage under fusebase.dashboards.pageSize.

Embed entry

import {
  createDashboardsClient,
  DashboardsProvider,
} from "@fusebase/fusebase-dashboards/embed";

@fusebase/fusebase-dashboards/embed is for a page that only shows an embedded table. It does not load the databases list. Both entries share one chunk, so a provider from one entry works with screens from the other.

License

See LICENSE.

版本与发布记录

@fusebase/fusebase-dashboards 共发布 4 个版本,首次发布于 2026/10/26;过去 12 个月发布了 4 个版本。

版本发布日期距今
0.1.2latest2026/11/0312 天前
0.1.12026/10/2620 天前
0.1.02026/10/2620 天前
0.0.0-stage2026/10/2620 天前

关于 @fusebase/fusebase-dashboards 的常见问题

@fusebase/fusebase-dashboards 是什么?

FuseBase databases UI for React: databases list and table screens.

如何安装 @fusebase/fusebase-dashboards?

在项目目录运行 npm install @fusebase/fusebase-dashboards,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18)、react-dom(>=18)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fusebase/fusebase-dashboards 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fusebase/fusebase-dashboards 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fusebase/fusebase-dashboards 可以商用吗?

@fusebase/fusebase-dashboards 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

@fusebase/fusebase-dashboards 的下载量有多少?

根据 npm 官方下载统计,@fusebase/fusebase-dashboards 在 2026/10/16 – 2026/11/14 这 30 天内被下载 1,967 次,日均约 66 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fusebase/fusebase-dashboards 还在维护吗?

最新版本 0.1.2 发布于 2026/11/03(12 天前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/10/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。