跳到正文
cccskills
免费在 GitHub 公开

component-styling

Use when building or styling a component in libs/ui-react or libs/ui-rnative — the cross-platform styling principles, plus routing to the platform mechanics: Tailwind + cva + cn on web, useStyleSheet + themeJS + lx on React Native. Load this before writing component styles.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(3)

  • SKILL.md3.8 KB
  • references/react.md4.8 KB
  • references/rnative.md3.4 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Component styling

Lumen ships the same components on web and React Native. The vocabulary of design tokens is shared across both (bg-muted ↔ t.colors.bg.muted); the mechanism is not. This skill states the principles that hold on both platforms, then routes you to the platform mechanics.

Route by lib

Derive the touched lib from the path (see the Libraries table in AGENTS.md), then read the matching reference:

LibRead
libs/ui-reactreferences/react.md (Tailwind + cva + cn)
libs/ui-rnativereferences/rnative.md (useStyleSheet + themeJS + lx)

Never apply one platform's mechanics to the other lib. A className on an RN file or a useStyleSheet call on a web file is always wrong.

Shared principles (both platforms)

These hold regardless of mechanism — the references show how each realises them.

  • Design tokens, never raw values. Colours, typography, spacing and sizes come from the design system, not from raw Tailwind palette classes / arbitrary sizes (web) or hardcoded literals (RN). The token catalogues live in references/*.
  • Props-drill to the top-level element. Behaviour must never be hidden. When a prop legitimately targets a nested element (a nested ref, className, or style), give it a distinct name (contentClassName, inputStyle) rather than overloading the top-level prop.
  • Compose variants declaratively. Appearance / size / state maps are declared once at the top of the styling layer (cva on web, Record<Variant, value> inside useStyleSheet on RN), never assembled ad hoc in the render body.
  • Never build a style value by concatenation. text-${color} and its RN equivalents are wrong — use complete token strings and a merge helper (cn on web, StyleSheet.flatten on RN).

Review checks

Rules verifiable from a diff. Lint already covers unknown/invalid Tailwind classnames, banned imports and formatting — see the "already enforced" list in pr-review; don't raise those here.

CheckApplies toDetectSkip
Raw Tailwind value instead of a tokenreacttext-gray-, bg-blue-, font-bold, text-sm, w-[, h-[.mdx doc-table markup
Dynamic classname built by concatenationreactclassName={`...${ `—
Classnames in a bare string variable instead of cn() / cva()reactconst … = 'flex …' outside a cn( / cva( callstrings inlined in className
cva skipped where variants/many classes exist (or forced for 1–2 classes)reactinline variant branching in JSX—
data-[state=…] on a Base UI primitive (or data-[open] on a Radix one)reactimport source vs attribute form—
Hardcoded colour/spacing/size literal instead of a t.* tokenrnativenumeric or '#…' inside useStyleSheetgeometry constants under Components/visualization/
Large stylesheet inlined in the component body instead of a useXStyles hookrnativeuseStyleSheet call inline in the componentsmall one-off styles
Consumer style/lx merged before internal styles (consumer can't win)rnativeflatten([style, styles.root]) (reversed order)—
Nested override overloads the top-level prop instead of a distinct namebothone className/style prop feeding an inner element—

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Creates and maintains Figma Code Connect files (`*.figma.tsx`) that map Figma components to code via the parser-based `figma.connect()` API. Use when the user mentions Code Connect, Figma component mapping, design-to-code translation, or asks to create/update .figma.tsx files.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

Use when creating, naming, or placing a file or folder in libs/*, or when modifying or adding a file to an existing component (even when the barrel isn't touched) — component vs utility naming, the one-responsibility-per-file layout, when a folder needs an `index.ts` barrel (public API only), and the required set of files a component needs per lib. Load this before scaffolding or restructuring a component so the layout matches the codebase.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

Use when designing or changing a component's public API, its composition, or its state model in libs/ui-react or libs/ui-rnative — layering (core vs internal vs primitives), BaseProps/Props splits, converting a component to compound / changing its composition with createSafeContext, controlled/uncontrolled state, prop-naming conventions, and cross-platform API parity. Load this before shaping a new component, changing its props, or refactoring its composition.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

Use when writing or editing Storybook MDX docs (*.mdx) — the two-tab Overview/Implementation structure, story-backed `<Source>` examples, and doc table guidelines.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

Use when creating or editing Storybook stories (*.stories.tsx, React or React Native) — story layout, controls, and export naming conventions.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

Use when writing or editing component tests in libs/ui-react or libs/ui-rnative — shared structure and coverage conventions, plus the per-platform runner: Vitest + React Testing Library on web, Jest + React Native Testing Library on RN. Load this before writing tests.

中文简介正在准备中。当前显示原文说明。

LedgerHQ/lumen232026年10月17日 更新

查看 LedgerHQ 的全部技能

报告此技能的问题