Code pages
A code page is a coin page its creator writes in HTML and CSS instead of arranging tiles, placing apps with a <cd-app> tag. A creator writes one in the coin manager, on the Pro plan and above: Code pages.
The coin's identity
Every code page places the coin's identity, once, and keeps it visible above the fold: a visitor should see which coin they are on without scrolling. A page places it with <cd-identity> (the identity alone) or <cd-app app="core-crown-header"> (the whole header, identity included). A draft saves without one, but a page with none, or with more than one, cannot be published.
Where it goes is the page's choice, and its CSS places and sizes the box. We draw what is inside it, in the page's theme, and the page's CSS cannot style or hide it. When a page's identity is not on screen, we show our own identity bar at the top of the page, under the top bar, and it slides away when the page's own identity is back on screen.
How your app shows
| Mode | What the page decides | What your app keeps |
|---|---|---|
| Hosted (every app) | Where your app's box is and how big, not under your minimum | Everything inside the box |
| Themed (if your manifest says so) | Hosted, plus the page's colors for the tokens you list | Your layout, words and behavior |
Every app is hosted with nothing to declare: an app that works on a tile works on a code page. A page that asks for an app in a mode the app does not allow gets it hosted.
What a page cannot do to your app
These hold on every code page, whatever its creator writes.
- It cannot shrink your app. A page sizes your box with
width,height, grid or flex, but not under your minimum:display.minWidthandminHeightif your manifest has them, else your smallest tile (120 px for each ofminColSpan, 60 px for each ofminRowSpanplus 10 px between rows). - It cannot style the inside of your app. A page's CSS stops at the edge of every app's box. A themed app gets colors only through the tokens it lists.
- It cannot run code.
<script>,<iframe>,<form>,<svg>,on…handlers and inlinestyleare dropped. Links arehttps, relative ormailto; images arehttps. In its CSS,@import,@font-faceand@layerare dropped andurl()ishttpsonly; a page's fonts come from our list. - It cannot act for your app or the visitor. A page's button can do three things, and each opens our own sheet. A page cannot call your app, ask for a signature or take a payment.
- It cannot cover the coin page's own controls. Nothing a page draws paints outside the page's box.
position: fixedandposition: stickyare dropped from its CSS, andz-indexworks only inside the page, so nothing reaches over the Buy button, the menu or a wallet prompt.
Your app keeps its own sandbox too, as on a tile page: What your app must do.
Declaring themed
List the page colors your app takes in presentation.themeTokens:
"presentation": { "themeTokens": ["--cd-accent", "--cd-surface", "--cd-text"] }On a page that shows your app themed, each token you list arrives in the theme your app already gets, as the field; the rest keep the visitor's theme. List only the ones your app reads.
| Token | Arrives as | What it colors |
|---|---|---|
--cd-accent | theme.accentColor | Accents and buttons |
--cd-surface | theme.cardBackground | The card your app sits on |
--cd-text | theme.textPrimary | Body text |
--cd-text-muted | theme.textSecondary | Secondary text |
--cd-border | theme.borderColor | Borders and dividers |
No other token can be listed, and an empty list is refused: leave presentation out to be hosted only.
What a page writes
For reference: a page uses four tags of ours. Everything else is plain HTML and CSS.
<cd-identity> places the coin's identity. A page has exactly one, or a <cd-app app="core-crown-header"> instead.
density | Shows the identity |
|---|---|
line (the default) | On one line |
stacked | Stacked, for a narrow column |
It takes class, id, title, aria-* and data-* for the page's CSS. Like a <cd-app> it is empty: anything a page puts inside it is not shown, and hidden is dropped.
<cd-app> places an installed app.
| Attribute | |
|---|---|
app | The app's id |
instance | Which one, for an app placed more than once |
mode | hosted (the default) or themed |
class, id, title, aria-*, data-* | As on any element, for the page's CSS |
A <cd-app> is empty: your app draws the whole box, and anything a page puts inside it is not shown.
Not the <cd-app> a coin's own site pastes
Two different elements share this name, in two different places, and their rules are opposite.
| On a code page | On a coin's own site | |
|---|---|---|
| Where it is written | In the HTML of a coin page on chaindaddy.io, which we read and draw | In a page of the owner's own site, which loads https://js.chaindaddy.io/v1/cd.js |
| Attributes | app, instance, mode (hosted or themed) | crown, chain, app, mode (light or dark) |
| What goes inside it | Nothing: it is not shown | A link, which shows until the app is ready and stays if it cannot load |
| Reference | Code pages | JavaScript SDK, Apps on your own site |
<cd-data bind="…" format="…"> shows a value from the coin's own data, by the names the app SDK uses. A missing value shows —.
bind | |
|---|---|
symbol | The ticker, such as PEPE |
tokenName | The coin's full name |
description | The coin's description |
chainName | The chain, such as Base |
tokenAddress | The coin's contract address |
owner | The wallet that holds the page's crown |
status | The crown's status |
market.price | Price in US dollars |
market.marketCap | Market cap in US dollars |
market.volume24h | Trading volume over 24 hours, in US dollars |
market.liquidity | Liquidity in US dollars |
market.holders | How many wallets hold it |
market.totalSupply | Total supply |
market.circulatingSupply | Circulating supply |
market.txns24h | Trades over 24 hours |
market.priceChange1h | Price change over 1 hour, in percent |
market.priceChange6h | Price change over 6 hours, in percent |
market.priceChange24h | Price change over 24 hours, in percent |
format | Shows |
|---|---|
number (the default) | 12.3K |
usd | $0.0042 |
usd-compact | $1.2M |
percent | 5% |
<button cd-action="…"> runs one of our actions. A button with no action, or any other, does nothing.
cd-action | Does |
|---|---|
buy | Opens our buy sheet for the coin |
sign-in | Opens our sign-in |
connect-wallet | Opens our wallet connection |
copy-address | Copies the coin's contract address |
Fonts
A page uses a font by naming it in its CSS, from this list. We serve these fonts ourselves; @font-face and @import are dropped from a page's CSS, so these are the only fonts a page can load. Any other family in a font-family is left as written, for the fonts the visitor has.
| Font | Write in CSS |
|---|---|
Bangers | font-family: "Bangers" |
Luckiest Guy | font-family: "Luckiest Guy" |
Permanent Marker | font-family: "Permanent Marker" |
Bungee | font-family: "Bungee" |
Rubik Mono One | font-family: "Rubik Mono One" |
Press Start 2P | font-family: "Press Start 2P" |
Anton | font-family: "Anton" |
Bebas Neue | font-family: "Bebas Neue" |
Righteous | font-family: "Righteous" |
Lilita One | font-family: "Lilita One" |
Titan One | font-family: "Titan One" |
Chewy | font-family: "Chewy" |
Creepster | font-family: "Creepster" |
Black Ops One | font-family: "Black Ops One" |
Archivo Black | font-family: "Archivo Black" |
Poppins | font-family: "Poppins" |
Inter | font-family: "Inter" |
Space Grotesk | font-family: "Space Grotesk" |
Space Mono | font-family: "Space Mono" |
Rubik | font-family: "Rubik" |
Nunito | font-family: "Nunito" |
Poppins, Inter, Space Grotesk, Space Mono, Rubik and Nunito come in regular and bold (font-weight 400 and 700). The rest are display fonts in one weight. Name a fallback after ours, as in font-family: "Bangers", Impact, sans-serif, for the moment before the font loads.
Example
A store app that takes the page's accent, surface and text colors declares, in its capp.json:
"minColSpan": 2,
"minRowSpan": 4,
"display": { "minWidth": 280, "minHeight": 320 },
"presentation": { "themeTokens": ["--cd-accent", "--cd-surface", "--cd-text"] }A page places it, themed, beside its own hero:
<main class="page">
<cd-identity class="identity"></cd-identity>
<section class="hero">
<h1>$<cd-data bind="symbol"></cd-data></h1>
<p><cd-data bind="market.price" format="usd"></cd-data> ·
<cd-data bind="market.holders"></cd-data> holders</p>
<button cd-action="buy">Buy</button>
</section>
<cd-app app="my-store" mode="themed" class="store"></cd-app>
</main>.page {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 16px;
--cd-accent: #ff4fa3;
--cd-surface: #1b1030;
--cd-text: #fdf2ff;
}
.identity { grid-column: 1 / -1; }
.store { height: 420px; border-radius: 16px; }
@container page (max-width: 640px) {
.page { grid-template-columns: 1fr; }
}The store draws itself in the page's pink, dark purple and white. On a phone the page stacks it under the hero, and if the page had set height: 100px, the store would still be 320 px tall.
Images
A page's images are uploaded from the editor's Images panel, which lists them with their URLs: Copy URL to use one in your CSS, Insert to put an <img> where the caret is. PNG, JPEG, WebP and GIF are accepted, up to 8 MB each, and every image you upload counts toward the page's storage, like any other file the page keeps with Chain Daddy. An <img src> or a CSS url() may also point at an https image hosted elsewhere; visitors load it through our image proxy, so it is cached and served alongside the page.
The schema and its versions
The manifest schema, presentation included, is published:
- the latest:
https://docs.chaindaddy.io/schemas/capp.schema.json - each version:
https://docs.chaindaddy.io/schemas/capp/<version>.json, starting athttps://docs.chaindaddy.io/schemas/capp/1.0.0.json 1.0.0: the first published version1.1.0: addsembed
A new field or value is a new minor version.