# ETF holdings

External component: ETF portfolio performance tabs, sector weights and a holdings link, or (when none of those are configured) the live daily holdings table. Which one renders depends on `data`.

## Fields & Schema

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `externalComponentType` | Symbol | Yes | Must be `"ETF holdings"` |
| `heading` | Text | No | Daily-table heading, used when `data.dailyHeading` is absent. |
| `data` | Object | Yes | Mode is chosen from it (see below). If it has no performance blocks, no sectors, no `holdingsLinkLabel` and no valid `columns`, nothing renders. |

**Mode.** If any of `performance.monthly`/`performance.quarterly` (valid), `sectors` or `holdingsLinkLabel` is present, the **preview** layout renders. Otherwise, if `columns` has valid entries, the **daily holdings table** renders.

Preview mode keys (all optional):

| Key | Notes |
|-----|-------|
| `portfolioHeading` | Heading above the performance tabs. |
| `periods.monthly`, `periods.quarterly` | Tab labels. Default `Monthly` / `Quarterly`. |
| `performance.monthly`, `performance.quarterly` | `{ "label", "asOfLabel", "categories": [string], "series": [{ "name", "data": [number] }] }`. A block needs non-empty `categories` and `series`; a series needs `name` and a `data` array. |
| `performanceNotes` | Array of strings, shown in a disclosure box (also in daily mode). |
| `asOfPrefix` | Default `as of`. |
| `sectorHeading`, `sectorAsOf`, `sectors` | Sector table. `sectors` is `[[label, value], ...]` pairs; a pair missing either half is dropped. |
| `sectorLabel`, `sectorValueLabel` | Column headers. Default `Sector` / `% of Net Assets`. |
| `sectorNote` | Note under the sector table. |
| `holdingsHeading` | Heading for the holdings column; the live holdings date is shown beneath it. |
| `holdingsBefore`, `holdingsLinkLabel`, `holdingsHref`, `holdingsAfter` | Sentence with a tracked link. The link shows only when **both** `holdingsLinkLabel` and `holdingsHref` are set. |
| `holdingsNote` | Note under the link. |

Daily mode keys:

| Key | Notes |
|-----|-------|
| `columns` | Required. `[{ "field", "label", "format"?, "fallback"? }]`. `field` is a key of the live holdings feed (`Security Description` is the row header). `format` is `shares` or `weight`; anything else prints as is. |
| `dailyHeading` | Heading; overrides `heading`. |
| `performanceNotes` | Disclosure under the table. |

If the holdings feed fails, daily mode shows "Daily holdings are temporarily unavailable."

## Usage

```bash
# Add the component
cms-edit add "ETF holdings" --content-type externalComponent --target content

# Preview layout (sectors and link)
cms-edit set @ref data --json '{"sectorHeading":"Sector weights","sectorAsOf":"09/30/2026","sectors":[["Technology","24.1%"],["Financials","12.3%"]],"holdingsHeading":"Holdings","holdingsBefore":"View the","holdingsLinkLabel":"daily holdings","holdingsHref":"/etf/holdings","holdingsAfter":"for this fund."}'

# Or the daily holdings table
cms-edit set @ref data --json '{"dailyHeading":"Daily holdings","columns":[{"field":"Security Description","label":"Security"},{"field":"Constituent Weight (Base)","label":"Weight","format":"weight"}]}'

cms-edit save
```

`set data --json` replaces the whole object. Read the current `data` first and change only the key you mean to.
