# Add a component

A component is data in the scene's "components" list (or in a config), then used like any other:

{ "name": "PriceTag", "description": "A price on a tag that swings in.", "props": { "price": { "type": "string", "req": true }, "ink": { "type": "color", "default": "ink" } },
  "tree": { "el": "box", "surface": "card", "motion": [{ "do": "enter", "from": { "rotate": -12, "y": -80, "opacity": 0 }, "curve": "bouncy" }],
            "children": [{ "el": "text", "id": "price", "text": "$price", "size": 96, "weight": 800, "color": "$ink" }] },
  "example": { "el": "PriceTag", "price": "$9" } }

- The tree is elements and other components. "$prop" reads a prop, "=expr" is arithmetic (it may read t, lt, props and tokens), "{expr}" fills text.
- Give a part an "id" if someone may want to restyle it. Leave fill and corner to a surface. Use palette names, never colour values.
- A preset of an existing one: { "name": "BrandStat", "extends": "StatReveal", "defaults": { "color": "accent2" } }.
Run  npx tsx cli.ts check scene.json  after adding it.
