0Pricing
Design Systems & Component Libraries · レッスン

コンポーネントの命名規則

コンポーネントとそのpropsに明確で一貫した名前を付けることで、コンポーネントライブラリを見つけやすく、予測しやすく、保守しやすくする方法を学びます。

「コンポーネントの命名規則」はCoddyKit上の無料Design Systems & Component Librariesレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDesign Systems & Component Libraries学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Design Systems & Component Librariesコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Why Names Matter

The hardest problems in component libraries are not technical - they are naming. A poorly named component is hard to find, easy to misuse, and painful to rename later.

Good names act as documentation and reduce the questions teammates ask.

Be Descriptive, Not Clever

Name components by what they are or do, not by clever metaphors.

  • Good: UserAvatar, PrimaryButton
  • Avoid: Blob, Sparkle, Thingy

A new teammate should guess the purpose from the name alone.

Consistent Casing

Pick one casing rule and never deviate. The web convention:

  • Components: PascalCase (CardHeader)
  • Props: camelCase (isDisabled)
  • CSS classes: kebab-case (card-header)

Mixing casing styles erodes trust in the library.

Boolean Props

Boolean props read best with an is, has, or should prefix. They sound like questions and default to false.

The snippet below shows the pattern.

function describe(props) {
  return 'disabled=' + props.isDisabled + ', loading=' + props.isLoading;
}

console.log(describe({ isDisabled: true, isLoading: false }));

Prop Naming Patterns

Establish predictable prop names across all components:

  • variant for visual style (primary, ghost)
  • size for scale (sm, md, lg)
  • onChange, onClick for event handlers

If every component uses the same names, learning one teaches you all.

Avoid Implementation Details

Do not bake fragile details into names. BlueButton becomes a lie the moment the brand color changes.

Prefer intent-based names like PrimaryButton. The intent is stable even when the styling evolves.

Namespacing and Prefixes

Many systems prefix components to avoid clashes and signal origin: DsButton, AcmeCard.

This helps when consuming apps already have their own components. Choose a short prefix and apply it everywhere or nowhere - consistency over preference.

Compound Component Naming

Related parts should share a family name: Card, CardHeader, CardBody, CardFooter.

The shared prefix groups them in autocomplete and signals they belong together. This is far clearer than Card, Heading, Content.

Renaming Is Expensive

Once a component name ships, every consuming app depends on it. Renaming becomes a breaking change requiring deprecation cycles.

Invest time in the name up front. A 10-minute naming discussion saves months of migration pain.

Document the Rules

Write your naming conventions down in the contribution guide. New contributors should not have to reverse-engineer your patterns.

A short, enforced naming doc keeps the library coherent as more people contribute.

Names as a Contract

Ultimately, a component's name and prop names form a public API contract. Treat them with the same care as any API.

Predictable names let developers compose your library confidently without reading the source.

Quick Check

Test your naming instincts.

Recap

You learned naming conventions that keep a component library usable:

  • Be descriptive and intent-based, not clever or color-bound.
  • Use consistent casing and predictable prop names.
  • Group compound components with shared prefixes.
  • Document the rules and remember renaming is costly.

Good names are quiet documentation.

よくある質問

「コンポーネントの命名規則」レッスンは無料ですか?

はい。「コンポーネントの命名規則」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Design Systems & Component Librariesコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Design Systems & Component Librariesコースには全4レッスンが含まれています。

「コンポーネントの命名規則」で何を学びますか?

コンポーネントとそのpropsに明確で一貫した名前を付けることで、コンポーネントライブラリを見つけやすく、予測しやすく、保守しやすくする方法を学びます。 ブラウザで直接実行するハンズオンコードでDesign Systems & Component Librariesを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Design Systems & Component Librariesを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDesign Systems & Component Librariesは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「コンポーネントの命名規則」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDesign Systems & Component Librariesレッスンでコードを書いて実行できますか?

はい。すべてのDesign Systems & Component Librariesレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. Atomic Design手法
  2. コンポーネントの構造と解剖学
  3. 技術スタックのコンポーネント選定
  4. コンポーネントの命名規則
← Design Systems & Component Librariesに戻る