@getflywheel/local-components

中文文档
17.8.2发布于 2026/07/14MITTypeScriptCommonJS近 30 天下载 3755

ya# Local component library

原始使用文档
文档目录8 节
  1. What's included in this component library?
  2. Storybook
  3. Developing within Local
  4. Digging deeper
  5. Components
  6. Styles
  7. SVGs
  8. License

ya# Local component library

npm version

Welcome to the official component library for Local!

What's included in this component library?

We appreciate curious minds and that's a great question! Take a quick look at our living component documentation here.

In additional to a quickly growing set of React components, we also have SVGs, SASS partials, and more to come!

Storybook

The quickest way to work on local-components is to leverage Storybook. Storybook is a local development area that works well with React components and supports hot-module reloading.

To start Storybook, run yarn storybook. Or, from the root of Local, run nps storybook.

Developing within Local

local-components is now a workspace of Local core, meaning you can just develope normally with nps build.dev to get the package built and under watch mode. yarn install takes care of all the symlinks for us, so long as the versions in the root and package's package.json match.

Digging deeper

The local-components library can be broken down into 3 main parts:

  1. Components
  2. Styles
  3. SVGs

Components

These are the visual elements that make up both Local and its Add-ons. There are currently 40+ React components in the library. Each component consists of a .tsx, index.js, README.md and optional .sass file.

Try it out for yourself!

  1. Make changes to the internals of a component through its .tsx and .sass files (they should live reload)
  2. Play around with the examples found in the README.md files

Note: the entry point for all components and styles is index.ts.

Containers Wrapper

Several components leverage the Container.tsx component to wrap their own implementation. Container is a highly specialized component that can be toggled on (wraps contents in extra div) or toggled off (no extra div). In addition, the Container wrapper adds convenience props that allow for easy one-off adjustments like adding 3px of margin without conflicting with the inner content's classes and styles.

Note: setting any of container's props will automatically toggle it on (disabled: false) thus wrapping the contents in the container wrapper.

Organization

Components are organized by type. These type groups can be seen when running Storybook.

Styles

Suit CSS

Naming is hard. And there's no perfect system. That said, we have chosen Suit CSS for naming conventions.

Note: instead of dashes, local-components uses underscores due to a limitation of a legacy package.

CSS Modules

The component library leverages CSS Modules to manage and scope styles. These are considered local styles (not to be confused with the Local app 😉) Scoped local styles are a beautiful thing that allow Local to isolate components, run Add-ons with multiple versions of local-components and avoid collisions.

As wonderful as local styles are, there are instances where CSS needs to transcend a single component. For that, we make use of global styles. Global styles should be familiar to most as that's what the web largely used for 20+ years. Global styles are intended to be used sparingly as they introduce a lot of challenges when scaling an app with a library of Add-ons and Environments.

The following is an instance where a scoped component may use a combination of local and global styles to achieve a specific result:

:global(.WindowsToolbar .DragRegion)

This is something we try to avoid and are actively working to whittle down to the bare essentials.

If you'd like to learn more about scoped styles, please check out CSS Modules here.

Webpack compiles all styles down to scoped.css, which is included in the <style> tags of the Core app's browser windows HTML.

SASS Partials, Mixins, and Functions

There is an extensive sass system in use that many -- if not most -- components leverage.

Partials

If you search for the _partials directory, you will find variables, mixins, functions, and other shared resources.

Variables

If Local uses a color, it's defined as a variable within the _variables.scss file. In addition, there are fonts, font sizes, font weights, and margin/padding preset values here.

Note: font sies and margin/padding uses t-shirt sizes to indicate relative sizing while adhering to strict design standards/values.

Themes

Local has both light and dark modes. Since this impacts every single components, the _theme.scss file contains mixins that simplifies the implementation of these variations in a repeatable and predictable way.

While you could leverage if-theme-light and if-theme-dark directly, most light/dark combinations follow a specific pattern and therefore have dedicated mixin. For example, the theme-color-black-else-white mixin applies the color style of black (if light) otherwise white (if dark). Another example, the theme-background-green-else-graydark mixin applies the background style of green (if light) otherwise graydark (if dark).

Note: light/dark mode styles are applied by toggling a class added to the html element (e.g. Theme__Light).

SVGs

Coming soon!

License

MIT

版本与发布记录

@getflywheel/local-components 共发布 234 个版本,首次发布于 2018/12/01;过去 12 个月发布了 1 个版本。

版本发布日期距今
17.8.2latest2026/07/144 个月前
17.8.12025/05/281.5 年前
17.8.02024/03/292 年前
17.7.42024/01/112 年前
17.7.32023/11/033 年前
17.7.3-beta.14beta2023/11/013 年前

关于 @getflywheel/local-components 的常见问题

@getflywheel/local-components 是什么?

ya# Local component library

如何安装 @getflywheel/local-components?

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

@getflywheel/local-components 支持 TypeScript 吗?

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

@getflywheel/local-components 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@getflywheel/local-components 可以商用吗?

@getflywheel/local-components 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@getflywheel/local-components 的下载量有多少?

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

@getflywheel/local-components 还在维护吗?

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