# Engram — full API reference
> A Destiny 2 (Bungie FUI) React component library, distributed as a shadcn registry and built for AI-agent consumption.
Engram renders real Destiny data — item tiles, socket/perk grids, nameplates, loadouts, triumphs, scoreboards — in the in-game visual language. Components are framework-React; the data mapping (`@engram/core`) and color tokens (`@engram/tokens`) are framework-neutral. You own the code: `shadcn add` copies a component's source into your repo to read and edit directly.
## Setup
Add the `@engram` namespace to your `components.json`, then install components by name:
```json
"registries": {
"@engram": "https://engram.starside.ai/r/{name}.json"
}
```
```bash
npx shadcn@latest add @engram/item-tile
```
Components depend on the `tokens` theme (the `--engram-*` CSS variables) and on `@engram/core` (npm). Both are pulled in automatically. An agent can also browse/search/install via the shadcn MCP server pointed at this registry.
## Extension model
Every component is extensible four ways, in increasing escape-hatch order: (1) **edit the copied source** directly; (2) **`asChild`** (Radix Slot) to swap the rendered element; (3) the typed **`annotations`** prop for curated data (roll verdict, tags, per-plug tier/label/recommended) which Engram renders with default styles; (4) **slot / render-prop** props for arbitrary content. The typed annotations layer is implemented on top of the same slots — one render path, two ergonomics.
## Components
### Core & libs
#### cn() helper (`@engram/cn`)
Tailwind-aware class-name merge (clsx + tailwind-merge).
- Install: `npx shadcn@latest add @engram/cn`
- Registry item: /r/cn.json
- npm dependencies: clsx, tailwind-merge
#### Engram core (`@engram/core`)
Framework-neutral Bungie API → component-props mapping, image-ref resolver, enums, and types. Pure TypeScript, usable from any framework.
- Install: `npx shadcn@latest add @engram/core`
- Registry item: /r/core.json
#### Token utilities (`@engram/token-utils`)
Helpers that turn an @engram/core enum value (rarity, element, ammo, class) into its --engram-* CSS-variable reference.
- Install: `npx shadcn@latest add @engram/token-utils`
- Registry item: /r/token-utils.json
- npm dependencies: @engram/core
#### usePanelTransition (`@engram/use-panel-transition`)
Hook coordinating a Destiny-style directional panel swap (fade + slide out, commit, fade + slide in) for routed views or local tab state.
- Install: `npx shadcn@latest add @engram/use-panel-transition`
- Registry item: /r/use-panel-transition.json
### Theme
#### Engram tokens (`@engram/tokens`)
Destiny FUI palette + rarity/element/class colors as CSS variables (--engram-*), with a Tailwind v4 theme layer.
- Install: `npx shadcn@latest add @engram/tokens`
- Registry item: /r/tokens.json
### Primitives
#### Bungie image (`@engram/bungie-image`)
Renders a Bungie image, resolving an ImageRef to a URL via @engram/core's configurable image base.
- Install: `npx shadcn@latest add @engram/bungie-image`
- Registry item: /r/bungie-image.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/tokens
Props (`BungieImage`):
- `src` (`ImageRef | string`, required) — An Engram ImageRef (relative path + base) or an already-resolved URL.
- `alt` (`string`) — Alt text; falls back to the ImageRef's alt, then empty.
- `imageBase` (`string`) — Override the configured image base for this image only.
#### Button (`@engram/button`)
A Destiny FUI button: flat, square, tracked-uppercase, with an offset outline ring that fades in on hover and a rhythmic fill pulse.
- Install: `npx shadcn@latest add @engram/button`
- Registry item: /r/button.json
- npm dependencies: @radix-ui/react-slot, class-variance-authority
- Registry dependencies: @engram/cn, @engram/tokens
Props (`Button`):
- `asChild` (`boolean`, default `false`) — Render as the child element (Radix Slot), e.g. to wrap a Next.js Link.
#### Chip (`@engram/chip`)
A small tracked-uppercase label/badge — the general badge/pill primitive. `tone` (or a `color` override) carries the meaning; `variant` picks the treatment: tinted (soft), bordered (outline), or filled (solid).
- Install: `npx shadcn@latest add @engram/chip`
- Registry item: /r/chip.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`Chip`):
- `tone` (`ChipTone`, default `"neutral"`) — Semantic tone — carries the meaning color.
- `variant` (`ChipVariant`, default `"soft"`) — soft = tinted fill (default) · outline = bordered · solid = filled.
- `size` (`ChipSize`, default `"md"`)
- `color` (`string`) — Override the tone with any CSS color (e.g. an element/rarity token var).
#### Countdown (`@engram/countdown`)
A live countdown to a timestamp (vendor/weekly/event resets).
- Install: `npx shadcn@latest add @engram/countdown`
- Registry item: /r/countdown.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`Countdown`):
- `until` (`Date | number`, required) — Target time — a Date or epoch milliseconds.
- `format` (`(msRemaining: number) => string`, default `formatDuration`) — Format remaining ms → string. Default: compact "2d 4h" / "12m 30s".
- `expiredLabel` (`string`, default `"—"`) — Shown once the target has passed. Default "—".
- `onElapsed` (`() => void`) — Fired once when the timer crosses zero.
- `className` (`string`)
#### Key hint (`@engram/key-hint`)
A keybind hint — the bordered key chip Destiny shows in nav bars and footers (`[A] Clan`, `[Esc] Dismiss`).
- Install: `npx shadcn@latest add @engram/key-hint`
- Registry item: /r/key-hint.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`KeyHint`):
- `children` (`ReactNode`, required) — The key glyph (e.g. "A", "Esc", "F1").
- `label` (`ReactNode`) — Optional action label shown after the key (e.g. "Dismiss").
#### Progress ring (`@engram/progress-ring`)
A radial completion ring — the round counterpart to a progress bar, for node completion, character level, and compact stat readouts.
- Install: `npx shadcn@latest add @engram/progress-ring`
- Registry item: /r/progress-ring.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`ProgressRing`):
- `value` (`number`, required)
- `max` (`number`, default `100`)
- `size` (`number`, default `36`) — Diameter in px.
- `thickness` (`number`, default `4`) — Ring stroke width in px.
- `color` (`string`, default `"var(--engram-accent)"`) — Fill color (any CSS color, e.g. a token var).
- `trackColor` (`string`, default `"var(--engram-raised-2)"`) — Track (unfilled) color.
- `children` (`ReactNode`) — Center content (e.g. a count or completion fraction).
- `label` (`string`) — Accessible label.
- `className` (`string`)
#### Segmented bar (`@engram/segmented-bar`)
A segmented progress/stat bar in the Destiny FUI style.
- Install: `npx shadcn@latest add @engram/segmented-bar`
- Registry item: /r/segmented-bar.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`SegmentedBar`):
- `value` (`number`, required)
- `max` (`number`, default `100`)
- `segments` (`number`) — Optional number of segments; renders dividing ticks when set.
- `color` (`string`, default `"var(--engram-accent-2)"`) — Fill color (any CSS color, e.g. a token var).
- `glow` (`boolean`, default `true`) — Glow the fill (Destiny stat/health bars glow in their color).
### Layout
#### Band (`@engram/band`)
A section band: a flat raised bar with a left accent edge, an uppercase tracked title, and an optional right-aligned count — Destiny's in-game content-section divider.
- Install: `npx shadcn@latest add @engram/band`
- Registry item: /r/band.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`Band`):
- `title` (`ReactNode`, required)
- `count` (`ReactNode`) — Right-aligned count / hint (e.g. "04" or `<>3 / 3>`).
- `accent` (`string`) — Left-edge accent color. Defaults to the accent token; pass a team/faction color for scoreboard sections (e.g. `var(--engram-class-titan)` red).
#### Paged grid (`@engram/paged-grid`)
A paginated grid (the in-game Triumphs / Collections / vault pager): the page of cells flanked by full-height previous/next arrow bars, with page-indicator segments below and a fade+slide in the travel direction on change.
- Install: `npx shadcn@latest add @engram/paged-grid`
- Registry item: /r/paged-grid.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`PagedGrid`):
- `items` (`T[]`, required)
- `renderItem` (`(item: T, index: number) => ReactNode`, required)
- `itemKey` (`(item: T, index: number) => string`, required) — Stable key per item.
- `columns` (`number`, default `2`) — Columns on `sm`+ (mobile is always a single column). Default 2.
- `rows` (`number`, default `5`) — Rows per page — page size is `columns × rows`. Default 5.
- `gap` (`number`, default `8`) — Gap between cells (px). Default 8.
- `cellWidth` (`number`) — Fixed cell width (px). When set, columns are sized to the cell instead of stretching to fill the row, and the packed grid is centered — keeping fixed-size content (e.g. item tiles) tight at every breakpoint. Omit for the default fluid columns.
- `minRowHeight` (`number`) — Reserve `rows × minRowHeight` so partial last pages keep the page height.
- `label` (`string`, default `"Paged grid"`) — Accessible label for the paged region.
- `className` (`string`)
#### Panel (`@engram/panel`)
A Destiny FUI surface: a semi-transparent panel over the canvas, defined by its fill (no outline).
- Install: `npx shadcn@latest add @engram/panel`
- Registry item: /r/panel.json
- npm dependencies: class-variance-authority
- Registry dependencies: @engram/cn, @engram/tokens
#### Title bar (`@engram/title-bar`)
The FUI title bar: a leading flag glyph, an uppercase tracked title, and an optional right-aligned count, on a subtle left-lit gradient with a fading underline — Destiny's in-game panel header.
- Install: `npx shadcn@latest add @engram/title-bar`
- Registry item: /r/title-bar.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`TitleBar`):
- `title` (`ReactNode`, required)
- `count` (`ReactNode`) — Right-aligned count / hint (e.g. "04 / 10").
- `flag` (`ReactNode`, default `"▸"`) — Leading flag glyph. Pass `null` to hide it.
### Icons
#### Ammo icon (`@engram/ammo-icon`)
Ammo type glyph (primary/special/heavy) in the ammo's token color.
- Install: `npx shadcn@latest add @engram/ammo-icon`
- Registry item: /r/ammo-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/token-utils, @engram/tokens
Props (`AmmoIcon`):
- `ammo` (`AmmoType`, required)
- `size` (`number`, default `16`) — Pixel size (square footprint; the brick is letterboxed inside).
#### Breaker icon (`@engram/breaker-icon`)
Champion breaker glyph (the real Bungie icon), tinted to currentColor.
- Install: `npx shadcn@latest add @engram/breaker-icon`
- Registry item: /r/breaker-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/tokens
Props (`BreakerIcon`):
- `breaker` (`BreakerType`, required)
- `size` (`number`, default `16`) — Pixel size.
#### Class icon (`@engram/class-icon`)
The Guardian class mark (Titan / Hunter / Warlock), tinted in the class identity color with a soft glow.
- Install: `npx shadcn@latest add @engram/class-icon`
- Registry item: /r/class-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/token-utils, @engram/tokens
Props (`ClassIcon`):
- `class` (`GuardianClass`, required)
- `size` (`number`, default `20`) — Pixel size.
- `color` (`string`) — Override the class color (defaults to the class identity token).
#### Element icon (`@engram/element-icon`)
The damage element as its real Destiny glyph, masked and tinted in the element color with a soft glow.
- Install: `npx shadcn@latest add @engram/element-icon`
- Registry item: /r/element-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/token-utils, @engram/tokens
Props (`ElementIcon`):
- `element` (`ElementType`, required)
- `icon` (`ImageRef`) — Override the default manifest glyph (e.g. a resolved subclass icon).
- `size` (`number`, default `20`) — Pixel size.
#### Game icon (`@engram/game-icon`)
The one keyed icon for Destiny's small glyphs — elements, ammo, classes, breakers, weapon silhouettes, activities, currencies, factions: ``.
- Install: `npx shadcn@latest add @engram/game-icon`
- Registry item: /r/game-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/bungie-image, @engram/cn, @engram/tokens
Props (`GameIcon`):
- `name` (`GameIconName`) — Registry key, e.g. `"arc"`, `"raid"`, `"glimmer"`, `"auto-rifle"`.
- `icon` (`ImageRef`) — Escape hatch: any manifest definition's icon (displayProperties.icon) rendered as-is — for defs outside the curated registry.
- `label` (`string`) — Accessible label; defaults to the registry entry's label. Required with the raw `icon` escape hatch.
- `showLabel` (`boolean`, default `false`) — Render the label as a visible caption beside the icon.
- `size` (`number`, default `20`) — Pixel height (vector glyphs keep their aspect; art is square).
#### Weapon icon (`@engram/weapon-icon`)
A weapon-type silhouette glyph (Auto Rifle, Rocket Launcher, Sword, …), tinted to currentColor — the icon-font glyphs the game shows in tooltips and "Works best with" lines.
- Install: `npx shadcn@latest add @engram/weapon-icon`
- Registry item: /r/weapon-icon.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/cn, @engram/tokens
Props (`WeaponIcon`):
- `type` (`WeaponGlyphType`) — The weapon-type glyph to draw. Omit and pass `name` to map from a Bungie display name ("Rocket Launcher").
- `name` (`string`) — Bungie weapon-type display name — resolved via weaponGlyphFromName. Renders nothing when neither `type` nor a known `name` is given.
- `size` (`number`, default `16`) — Pixel height; width follows each glyph's aspect ratio (they're wide).
### Items
#### Cost chip (`@engram/cost-chip`)
A currency/cost token: an amount + its currency icon. Used for vendor costs, build/material requirements, and rewards.
- Install: `npx shadcn@latest add @engram/cost-chip`
- Registry item: /r/cost-chip.json
- npm dependencies: @engram/core
- Registry dependencies: @engram/bungie-image, @engram/cn, @engram/tokens
Props (`CostChip`):
- `size` (`number`, default `16`) — Icon size in px.
- `className` (`string`)
- `icon` (`ImageRef`) — Currency or item icon.
- `amount` (`number`, required) — Quantity.
- `name` (`string`) — Currency / item name (accessibility + tooltip).
- `affordable` (`boolean`, default `true`) — Whether the player can afford it — dims/flags when false.
#### Item grid (`@engram/item-grid`)
The fundamental inventory/collection container: a CSS grid that lays out item tiles (passed as `children`).
- Install: `npx shadcn@latest add @engram/item-grid`
- Registry item: /r/item-grid.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`ItemGrid`):
- `columns` (`number`) — Fixed number of columns. Omit for a responsive auto-fill grid that packs as many `min`-wide tiles per row as fit (the default inventory behavior).
- `min` (`number`, default `48`) — Min tile width (px) for the responsive auto-fill grid. Default 48.
- `gap` (`number`, default `4`) — Gap between tiles (px). Default 4.
#### Item hover card (`@engram/item-hover-card`)
Reveals an inspect popup for the trigger (e.g. an ItemTile / gear slot) — the in-game "hover gear to inspect" flyout.
- Install: `npx shadcn@latest add @engram/item-hover-card`
- Registry item: /r/item-hover-card.json
- Registry dependencies: @engram/cn, @engram/tokens
Props (`ItemHoverCard`):
- `children` (`ReactNode`, required) — The trigger — typically an / gear slot.
- `popup` (`ReactNode`, required) — The inspect content shown on hover/click — typically an .
- `openDelay` (`number`, default `90`) — ms before the cursor-following preview opens on hover/focus.
- `closeDelay` (`number`, default `140`) — ms before the preview closes after the pointer leaves.
- `as` (`"button" | "span"`, default `"button"`) — Trigger element. Use `"span"` when the children are themselves interactive (e.g. an button) so the wrapper doesn't nest a `