@fewchurs/react

中文文档
1.7.2发布于 2026/11/14SEE LICENSE IN LICENSETypeScriptESM + CJS零依赖近 30 天下载 2025

A Fewchurs feature-request board for any React app.

原始使用文档
文档目录15 节
  1. Integrate in 4 steps
  2. 1. Get an API key and add your domain
  3. 2. Install
  4. 3. Put the key in an environment variable
  5. 4. Render the board
  6. Show it as a button instead of a page
  7. Customize
  8. Hooks
  9. Link straight to one request
  10. Signed-in users
  11. Analytics
  12. Troubleshooting
  13. Server-safe entry
  14. More
  15. License

@fewchurs/react

A feature-request board for any React app: visitors submit ideas, vote, comment and follow, and you manage everything from your Fewchurs dashboard. This package has the components, hooks, styles and fetch client.

Using Next.js? Use @fewchurs/next instead. It renders the board on the server and keeps your API key out of the browser.

  • React 18 or 19, no runtime dependencies, no Tailwind or CSS-in-JS needed
  • Light and dark mode out of the box
  • Fully typed, with a headless mode and hooks if you want your own UI

Integrate in 4 steps

1. Get an API key and add your domain

In the Fewchurs dashboard, open your app, copy the API key (it looks like fr_live_…) and add the domain your app runs on. The key only works on domains you have added.

2. Install

npm install @fewchurs/react
# or: pnpm add @fewchurs/react
# or: yarn add @fewchurs/react

3. Put the key in an environment variable

Vite:

# .env
VITE_FEWCHURS_KEY=fr_live_…

Create React App uses process.env.REACT_APP_FEWCHURS_KEY; any other bundler works the same way. Restart the dev server after you edit .env.

4. Render the board

// src/App.tsx
import { FewchursBoard, FewchursProvider } from "@fewchurs/react";
import "@fewchurs/react/styles.css";

export function App() {
  return (
    <FewchursProvider apiKey={import.meta.env.VITE_FEWCHURS_KEY}>
      <FewchursBoard />
    </FewchursProvider>
  );
}

That is the whole integration. Run your app and the board shows up with tabs, voting, comments and a New request form.

The key is publishable, like a Stripe or PostHog public key. It is protected by the domains you added and by server-side rate limiting, not by secrecy. If you would rather keep it off the page, point the provider at your own proxy instead: <FewchursProvider baseUrl="/api/fewchurs">.

Show it as a button instead of a page

FewchursButton renders only a button. Clicking it slides the board in as a sheet (from the side on desktop, from the bottom on a phone). Nothing is fetched until it opens.

<FewchursProvider apiKey={import.meta.env.VITE_FEWCHURS_KEY}>
  <FewchursButton floating>Suggest a feature</FewchursButton>
</FewchursProvider>
PropWhat it does
floatingPins the button to the bottom right of every page
floating="left"Pins it to the bottom left
childrenYour own label. The default is "Feedback"
className, styleGo on the button
any FewchursBoard propGoes to the board inside the sheet

To open the sheet from your own button, use FewchursBoardDialog with open, onClose and variant="sheet". Leave variant out for a centered modal.

Customize

Start with the defaults and go deeper only when you need to.

CSS variables (the quickest way to match your brand):

.fewchurs {
  --fw-primary: #ed5f18;
  --fw-radius: 12px;
  --fw-font: var(--font-sans);
  --fw-surface: #fff;
}

Props:

<FewchursBoard
  tabs={["top", "new", "roadmap"]} // default: ["top", "new"]
  defaultTab="top"
  showDeclined={false}
  allowComments
  emailField="optional"
  pageSize={20}
  theme={{ primary: "#0f766e", radius: 4 }}
  colorScheme="system" // "light" | "dark" | "system"
  labels={{ title: "Ideas", submit: "Suggest an idea" }}
/>

Slots: renderHeader, renderEmpty and renderFeature replace parts of the board. Headless: compose FewchursBoard.Root, .Tabs, .List and .SubmitTrigger yourself, add unstyled to drop every class name, or skip the components and build on the hooks below.

Hooks

const { features, isLoading, error, loadMore, hasMore } = useFeatures({ sort: "top" });
const { hasVoted, upvoteCount, toggle, isPending } = useVote(featureId);
const { comments, add, loadMore } = useComments(featureId);
const { submit, isPending } = useSubmitFeature();
const { isFollowing, follow, unfollow } = useFollow(featureId);
const { feature, isLoading, refresh } = useFeature(featureId);
const { showBranding, hideVoteCounts } = useFewchursConfig();

Hooks must be rendered inside FewchursProvider. They never throw: every failure is a typed value with a code (invalid_key, validation_failed, rate_limited, not_found, limit_reached, server, network), and userMessage(error) turns it into a sentence you can show.

<FewchursBoard
  initialFeatureId={new URLSearchParams(location.search).get("request") ?? undefined}
/>

The request shows above the list with its comments open. An id that no longer exists is ignored.

Signed-in users

Votes are anonymous and tied to a device id that is generated on first use. To make votes follow the account across devices, pass a hashed user id. Never pass a raw id or an email address.

<FewchursProvider apiKey={key} deviceId={hashedUserId}>

Analytics

<FewchursProvider apiKey={key} onEvent={(event) => track(event.name, event)}>

Events: boardOpened, featureSubmitted, voted, commented, followed, error.

Troubleshooting

You seeWhy, and what to do
"Fewchurs isn't set up"No key was passed. Check the env var name and restart the dev server.
"Invalid API key" (401)The key is wrong. Copy it again from the dashboard.
"Invalid API key" (403)The domain is not added to your app. The message names the domain to add.
"You're offline"The request never reached Fewchurs. Check the network and press Try again.
The board has no stylingYou forgot import "@fewchurs/react/styles.css".

Outside production, every failed request is also logged once to the console as [fewchurs] ….

Server-safe entry

@fewchurs/react/core is the half with no React and no "use client" boundary: the fetch client, the types, validation and error mapping. Use it in server code, workers or scripts.

More

License

Proprietary. You may use the package in your own apps to connect them to Fewchurs and customize it through the documented props, CSS variables, slots and hooks. See LICENSE.

版本与发布记录

@fewchurs/react 共发布 13 个版本,首次发布于 2026/10/19;过去 12 个月发布了 13 个版本。

版本发布日期距今
1.7.2latest2026/11/14今天
1.7.12026/11/122 天前
1.7.02026/11/068 天前
1.6.02026/11/068 天前
1.5.02026/11/068 天前
1.4.02026/11/068 天前

关于 @fewchurs/react 的常见问题

@fewchurs/react 是什么?

A Fewchurs feature-request board for any React app.

如何安装 @fewchurs/react?

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

@fewchurs/react 支持 TypeScript 吗?

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

@fewchurs/react 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fewchurs/react 可以商用吗?

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

@fewchurs/react 的下载量有多少?

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

@fewchurs/react 还在维护吗?

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