Angular standalone components for the Crossly embeddable storefront. Put your Crossly listings, a buy button and Vault Markets price widgets on your Angular site, with typed inputs and outputs.
They wrap the custom elements from @crossly/embed
(<crossly-catalog>, <crossly-buy-button>, <crossly-index>, <crossly-mark>). Every input, output and
default below comes from that package's source.
- No
CUSTOM_ELEMENTS_SCHEMA. The custom elements are created inside the components, so your templates only contain Angular components. - SSR-safe. Nothing runs on the server platform. Projected content is the fallback.
- One request per mount. Every attribute is set before the element connects. (Angular applies template
bindings after it inserts an element, so a raw
<crossly-catalog [attr.pk]>would fetch once per binding.) - No payments on your page. The buy button sends the buyer to a Crossly-hosted checkout.
- Public key only. Uses a publishable key (
crossly_pk_live_…). It is built to sit in page source.
npm install @crossly/angularPeers: @angular/core and @angular/common (20–22). @crossly/embed is installed with this package (see
Why @crossly/embed is a dependency).
Mint a publishable key in Crossly → Settings → Embeds.
// app.config.ts
import { ApplicationConfig } from '@angular/core';
import { provideCrossly } from '@crossly/angular';
export const appConfig: ApplicationConfig = {
providers: [provideCrossly({ pk: 'crossly_pk_live_…' })],
};// shop.component.ts
import { Component } from '@angular/core';
import {
CrosslyBuyButtonComponent,
CrosslyCatalogComponent,
type CatalogLoadedDetail,
} from '@crossly/angular';
@Component({
selector: 'app-shop',
imports: [CrosslyCatalogComponent, CrosslyBuyButtonComponent],
template: `
<crossly-ng-catalog [limit]="24" (loaded)="onLoaded($event)" (crosslyError)="onError($event.message)">
<p>Loading the shop…</p>
</crossly-ng-catalog>
<crossly-ng-buy-button listing="lst_123" label="Buy now" />
`,
})
export class ShopComponent {
onLoaded({ listings }: CatalogLoadedDetail) {
console.log(`${listings.length} listings`);
}
onError(message: string) {
console.warn(message);
}
}imports: [...CROSSLY_COMPONENTS] imports all four. A complete standalone app is in
examples/standalone.
Every component accepts:
| input / output | type | |
|---|---|---|
[pk] |
string |
Your publishable key. Required here or through provideCrossly(). The input wins. Without it the element shows "Missing pk". |
[api] |
string |
Overrides the API base (default https://crossly.net/api). For testing. |
[elementClass] |
string |
class on the custom element. |
[elementStyle] |
string |
Inline style on the custom element, e.g. --crossly-accent: #ff5a5f. |
| projected content | The fallback. Shown on the server and until the elements are registered. | |
(crosslyError) |
ErrorDetail = { message: string } |
crossly:error: the API rejected the request, or the embed script failed to load. |
Outputs emit the event's detail. Each component's host has display: contents, so it adds no box to your
layout. The element getter returns the underlying custom element once it's mounted.
| input / output | type | default | |
|---|---|---|---|
[limit] |
number | string |
12 |
How many to show, 1–48. |
[q] |
string |
Free-text filter over title and brand. See Known limitations. | |
(loaded) |
{ listings: EmbedListing[] } |
crossly:loaded: the listings that were rendered. Not emitted for an empty catalog (the element shows "Nothing listed right now."). |
EmbedListing is { id, title, description, priceCents, imageUrl, brand, size, condition, available }. Money is
always integer cents.
The element POSTs { items: [{ listingId, quantity }], returnUrl: location.href } and sends the buyer to the
returned Crossly-hosted URL.
| input / output | type | default | |
|---|---|---|---|
[listing] |
string |
Required. The listing id. | |
[quantity] |
number | string |
1 |
Units (the API accepts 1–10). |
[label] |
string |
"Buy now" |
Button text. Shows "Starting checkout…" while the request runs. |
[target] |
string |
'_self' |
_self navigates this tab. Any other value goes to window.open(url, target, 'noopener,noreferrer'). |
(checkout) |
{ checkoutUrl: string } |
crossly:checkout: the checkout URL was issued, just before navigation. |
A Vault Markets index level, its move, a sparkline, and its quality letter, n markets and as-of date. Shows Insufficient data when the data is too thin.
| input / output | type | default | |
|---|---|---|---|
[slug] |
string |
Required. The index slug, e.g. crossly-50. |
|
[range] |
'1m' | '3m' | '6m' | '1y' | '5y' |
'1y' |
Sparkline history. |
(loaded) |
{ index: EmbedIndexWidget } |
crossly:loaded. |
One vault market's mark, with its quality letter, trades in the last 30 days and as-of date. Shows No market yet when there isn't one.
| input / output | type | default | |
|---|---|---|---|
[bookKey] |
string |
Required. The market's book key, <variantId>:<condition>:<grade>. Set as the element's key attribute. |
|
[range] |
'1m' | '3m' | '6m' | '1y' | '5y' |
'1y' |
Sparkline history. |
(loaded) |
{ mark: EmbedMarkWidget } |
crossly:loaded. |
provideCrossly(config), CROSSLY_CONFIG (the InjectionToken), CROSSLY_COMPONENTS, loadCrosslyElements(),
isCrosslyDefined(), CROSSLY_TAGS, mountCrosslyElement(), CrosslyElementBase, and every detail type
(EmbedListing, EmbedIndexWidget, EmbedMarkWidget, CatalogLoadedDetail, CheckoutDetail,
IndexLoadedDetail, MarkLoadedDetail, ErrorDetail, CrosslyRange, CrosslyEventMap).
The elements use Shadow DOM and expose CSS custom properties and ::parts. Set the variables on the custom
element, not on a parent: each element declares its own defaults on :host, and those override inherited
values. The element isn't part of your component's view, so target it from a global stylesheet (or
::ng-deep):
/* styles.css */
crossly-catalog.shop {
--crossly-accent: #ff5a5f;
--crossly-min-col: 260px;
}
crossly-catalog.shop::part(card) { box-shadow: 0 2px 8px rgb(0 0 0 / 0.08); }<crossly-ng-catalog elementClass="shop" />| variable | default (light) | dark (prefers-color-scheme) |
|---|---|---|
--crossly-gap |
16px |
|
--crossly-radius |
10px |
|
--crossly-fg |
#111 |
#f3f4f6 |
--crossly-muted |
#666 |
#9ca3af |
--crossly-accent |
#10b981 |
|
--crossly-card-bg |
#fff |
#111827 |
--crossly-border |
#e5e7eb |
#374151 |
--crossly-min-col |
200px |
| element | parts |
|---|---|
crossly-catalog |
grid, card, image, title, meta, price |
crossly-buy-button |
button |
crossly-index, crossly-mark |
widget, title, value, change (index), image (mark), sparkline, meta |
@crossly/embed declares class … extends HTMLElement at module scope, so it must never load on the server.
The components check isPlatformBrowser. On the server they render only their projected content. In the
browser, ngAfterViewInit runs one shared dynamic import('@crossly/embed'). Then the component creates the
element with every attribute set and connects it.
These come from @crossly/embed 0.1.0 and the live API:
crossly:checkoutcan't be cancelled yet. The event is dispatched ascancelable, but 0.1.0 navigates even if you callpreventDefault().q(text search). For a fresh search, the API requires a proof-of-work header. The 0.1.0 element doesn't send one, so aqsearch surfaces as(crosslyError).- Origin allowlist. If your key has an allowlist (Settings → Embeds), the page origin must be on it. That
covers both the requests and the checkout
returnUrl, which is always the current page.
It's a regular dependency, not a peer (it's in allowedNonPeerDependencies for ng-packagr). These components
are a typed facade over one exact contract (attribute names, event names, detail shapes), so this package
states which embed range it was written against and installs it with itself. If your page also loads the hosted
embed.js, nothing breaks: registration skips tags that are already defined.
| Angular | peer range 20–22. Built with ng-packagr 22 (partial compilation). CI tests Angular 22, zoneless. |
| Change detection | zone.js or zoneless. Outputs are emitted inside NgZone. |
- Create a free Crossly account
- Embeds API reference
- All Crossly developer tools
- Crossly docs: https://crossly.net/docs
- The elements: https://github.com/crossly-dev/crossly-embed
- Other frameworks: React · Next.js · Vue · Nuxt · Svelte · React Native
- Security: see the org security policy. Use private vulnerability reporting on this repo.