# Component design

Build your own components with Ghost’s API, composition and visual craft conventions.

Component design teaches an agent how to extend your own component set: choose the right owner, define its contract, compose existing controls, apply shared styling, and verify the result. It works with your repository’s conventions and installed Ghost components.

## Install and use

```sh
npx skills@latest add collectivecreation/ghost-ui --skill component-design
```

Ask your coding agent to use component-design for the component you want to build or review. Give it the user’s task and the location of your existing components. See [Skills](/docs/skill/overview) for agent selection, manual installation and verification, or [download the complete SKILL.md](/skill.md). Install [Technical writing](/docs/skill/technical-writing) separately when you want help documenting the result.

## From a task to a reusable component

- Inspect the current source, public types and a real consumer. Compose the existing owner before adding a new one.

- Define inputs, defaults, callbacks and caller-owned state. Name meaningful disabled, pending, error and empty states before styling.

- Build with canonical controls and semantic tokens. Keep component CSS with its owner and product data, transport and persistence in your application.

- Write one believable example with exact copyable source. Document supported parts and behavior; do not infer an API from a mockup.

- Verify the affected behavior, appearance and installation. Keep untested boundaries explicit.

[Extend the library](/docs/extending) walks through these steps. A visual prototype can settle appearance or interaction; technical accuracy comes from the implementation and its actual consumers.

The comparisons below support particular visual decisions. They are examples of Ghost’s craft, rather than the whole component-building process.

## Hierarchy without heavy text

Use regular 400 interface text, including headings and controls. Color, size and spacing should make the reading order clear without making every label compete.

## One clear next action

Quiet defaults do not mean quiet everything. Give the main next step a stronger Button variant. Keep supporting actions readable and easy to find.

## Corners that belong together

Controls follow the height-based radius scale: 32px height starts at 12px radius. For nearby nested surfaces, use the theme’s shared corner recipe with the actual padding and border inset. Tall rows keep a coherent highlight rather than turning into pills.

## Continuity between peers

Use the canonical SharedBackground when a moving hover/focus surface makes the group easier to follow. Keep persistent selection distinguishable; menus use a checkmark for selection, with backgrounds reserved for hover, focus and open submenus.

## Motion that explains a change

Open both disclosures. The chevron and panel should explain the change without moving the content's meaning. Preserve reduced-motion preferences. A button-to-dialog morph is useful only when it preserves focus, semantics and interruption; it is not a requirement for every overlay.

## Show the real structure

A component's Structures section should reveal the public nesting a reader needs. A flat parts list hides relationships. Mark optional parts in the accompanying explanation and keep caller content caller-owned.

## Reuse the owner

Compose the real Button, Field, Collapsible, Loader, Progress and other owners for their jobs. Applying their classes to an imitation copies appearance while losing the behavior contract. Convenience compositions and lower-level parts share the same implementation.

## Decide before adding

Start with the user task, then find the existing owner. Choose a small explicit API, identify the meaningful states, and show the smallest believable task. [UI architecture](/docs/ui-architecture) defines the relationships between components, parts, blocks, templates and libraries. [Styling](/docs/styling) explains where CSS belongs.

## Check the result

Inspect the whole current preview before measuring details. Labels need space, hierarchy must read clearly and focus must remain visible. Check the affected interaction and actual installed source when those contracts change. A passing build or a screenshot of another state does not establish the result.

These are Ghost design choices, informed by the [Kumo skill's paired examples](https://kumo-ui.com/skill/). They are not universal usability laws or a claim of catalogue-wide production certification.
