@molecule/app-vendor-card-angular
Feature · vendor-card · App (browser) · v1.1.3 · Apache-2.0
Seller / vendor / agent profile card with logo, description, rating, badges
npm install @molecule/app-vendor-card-angularHow it works
@molecule/app-vendor-card-angular is a ready-made vendor-card feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.
import { Component } from '@angular/core'
import { VendorCard } from '@molecule/app-vendor-card-angular'
import { Button } from '@molecule/app-ui-angular'
@Component({
selector: 'vendor-page',
standalone: true,
imports: [VendorCard, Button],
template: `
<div
mol-vendor-card
name="Acme Supplies"
logoSrc="/logos/acme.png"
description="Industrial parts, fast shipping"
[rating]="4.7"
[reviewCount]="312"
memberSince="Jan 2021"
(click)="openVendorPage()"
>
<span slot="badges">Verified</span>
<button mol-button size="sm" slot="actions" (click)="follow()">Follow</button>
</div>
`,
})
export class VendorPage {
readonly openVendorPage = (): void => {
console.log('open vendor page')
}
readonly follow = (): void => {
console.log('follow vendor')
}
}Works with: @molecule/app-angular, @molecule/app-ui, @molecule/app-ui-angular
Reference
Vendor / seller / agent profile card.
Exports VendorCard — Avatar/logo + name + tagline + rating/review count
- member-since + badges + actions row, on the shared Card. It is the
Angular counterpart of
@molecule/app-vendor-card-react: same props and the same DOM for the same input.
Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit
src/index.tsJSDoc, not this file.
Quick Start
import { Component } from '@angular/core'
import { VendorCard } from '@molecule/app-vendor-card-angular'
import { Button } from '@molecule/app-ui-angular'
@Component({
selector: 'vendor-page',
standalone: true,
imports: [VendorCard, Button],
template: `
<div
mol-vendor-card
name="Acme Supplies"
logoSrc="/logos/acme.png"
description="Industrial parts, fast shipping"
[rating]="4.7"
[reviewCount]="312"
memberSince="Jan 2021"
(click)="openVendorPage()"
>
<span slot="badges">Verified</span>
<button mol-button size="sm" slot="actions" (click)="follow()">Follow</button>
</div>
`,
})
export class VendorPage {
readonly openVendorPage = (): void => {
console.log('open vendor page')
}
readonly follow = (): void => {
console.log('follow vendor')
}
}
Type
feature
Installation
npm install @molecule/app-vendor-card-angular @angular/common @angular/core @angular/platform-browser @molecule/app-angular @molecule/app-ui @molecule/app-ui-angular
API
Interfaces
VendorCardProps
Props accepted by VendorCard — the same props
@molecule/app-vendor-card-react accepts. Node props (name,
description, memberSince, badges, actions) are projected content in
Angular (an input cannot carry a node), so they are typed unknown: pass a
string or number value through the input, and element content in the host
template as [slot=<name>] content.
interface VendorCardProps {
/** Vendor / seller display name: text, or `[slot=name]` content. */
name?: unknown
/** Optional logo URL — falls back to Avatar text initials. */
logoSrc?: string
/** Tagline / one-liner: text, or `[slot=description]` content. */
description?: unknown
/** 0-5 average rating. */
rating?: number
/** Total review count. */
reviewCount?: number
/** Member-since date display: text, or `[slot=memberSince]` content. */
memberSince?: unknown
/** Optional badges row (Verified, Top seller, etc.): text, or `[slot=badges]` content. */
badges?: unknown
/** Right-side actions: text, or `[slot=actions]` content. */
actions?: unknown
/** Optional click handler on the body (a native `(click)` on the host element). */
onClick?: unknown
/** Extra classes. */
className?: string
}
Classes
VendorCard
VendorCard component.
Vendor / seller / agent profile card — Avatar/logo + name + tagline +
rating/review count + member-since + badges + actions row. Used in
marketplaces, agent directories, multi-tenant catalogs. The host IS the
Card's root <div> (div[mol-vendor-card] wearing cm.card({ variant: 'elevated' }) + cm.cardPadding('md')), matching React's root exactly;
onClick is a native (click) on the host, with no keyboard handler or
role — put primary navigation in actions buttons for accessibility.
rating renders a single ★ plus the number (toFixed(1)), not a
five-star row; reviewCount renders only when rating is also set. When
name is not a plain string the Avatar alt falls back to hardcoded
'Vendor'. Same props, same DOM as @molecule/app-vendor-card-react's
VendorCard. Node-valued name, description, memberSince, badges
and actions content is projected ([slot=<name>]); a string or number
input renders as text. The optional wrappers (description, memberSince,
actions) stay in the template so their <ng-content> always captures, and
leave the page while they render neither a text input nor a projection, as
React renders no wrapper for a falsy prop.
@Component({
selector: 'div[mol-vendor-card]',
standalone: true,
hostDirectives: [MolPlacement],
imports: [Avatar],
inputs: [
'name',
'logoSrc',
'description',
'rating',
'reviewCount',
'memberSince',
'badges',
'actions',
'className',
],
host: {
'[class]': 'classes()',
},
// prettier-ignore
template: `<div [class]="cm().flex({ align: 'start', gap: 'md' })">
<div mol-avatar [src]="logoSrc" [alt]="displayName()" [name]="displayName()" [size]="'lg'"></div>
<div [class]="cm().cn(cm().flex1, cm().stack(2))">
<header>
<h3 [class]="cm().cn(cm().textSize('lg'), cm().fontWeight('bold'))">@if (hasName) {<ng-container>{{ name }}</ng-container>}<ng-content select="[slot=name]" /></h3><p #descriptionEl [class]="cm().textSize('sm')">@if (hasDescription) {<ng-container>{{ description }}</ng-container>}<ng-content select="[slot=description]" /></p>
</header>
<div [class]="cm().flex({ align: 'center', gap: 'sm', wrap: 'wrap' })">@if (hasRating) {<span [class]="ratingClass()"><span aria-hidden="true">★</span><span [class]="cm().fontWeight('semibold')">{{ ratingText() }}</span>@if (hasReviewCount) {<span>{{ reviewText() }}</span>}</span>}<span #memberSinceEl [class]="cm().textSize('xs')">· @if (hasMemberSince) {<ng-container>{{ memberSince }}</ng-container>}<ng-content select="[slot=memberSince]" /></span>@if (hasBadges) {<ng-container>{{ badges }}</ng-container>}<ng-content select="[slot=badges]" /></div><div #actionsEl [class]="cm().flex({ align: 'center', gap: 'sm' })">@if (hasActions) {<ng-container>{{ actions }}</ng-container>}<ng-content select="[slot=actions]" /></div>
</div>
</div>`,
})
export class VendorCard {
/** Vendor / seller display name: text, or `[slot=name]` content. */
name?: unknown
/** Optional logo URL — falls back to Avatar text initials. */
logoSrc?: string
/** Tagline / one-liner: text, or `[slot=description]` content. */
description?: unknown
/** 0-5 average rating. */
rating?: number
/** Total review count. */
reviewCount?: number
/** Member-since date display: text, or `[slot=memberSince]` content. */
memberSince?: unknown
/** Optional badges row: text, or `[slot=badges]` content. */
badges?: unknown
/** Right-side actions: text, or `[slot=actions]` content. */
actions?: unknown
/** Extra classes. */
className?: string
/** The description paragraph (its text input or projected slot decides its presence). */
@ViewChild('descriptionEl', { static: true })
private descriptionEl?: ElementRef<HTMLParagraphElement>
/** The member-since span (its text input or projected slot decides its presence). */
@ViewChild('memberSinceEl', { static: true })
private memberSinceEl?: ElementRef<HTMLSpanElement>
/** The actions row (its text input or projected slot decides its presence). */
@ViewChild('actionsEl', { static: true }) private actionsEl?: ElementRef<HTMLDivElement>
/** Keeps each optional wrapper on the page only while it renders a text input or projected `[slot=<name>]` content, re-decided whenever either changes (a slot tak… */
constructor() {
usePlacement((hasContent) => {
const description = this.descriptionEl?.nativeElement
setElementPresent(
description,
this.hasDescription || (description ? hasContent(description) : false),
)
const memberSince = this.memberSinceEl?.nativeElement
setElementPresent(
memberSince,
this.hasMemberSince || (memberSince ? hasContent(memberSince, 1) : false),
)
const actions = this.actionsEl?.nativeElement
setElementPresent(actions, this.hasActions || (actions ? hasContent(actions) : false))
})
}
/**
* The current class map.
* @returns The UIClassMap.
*/
cm(): UIClassMap {
return getClassMap()
}
/**
* Computes the Card root class list (Card's elevated variant and md
* padding defaults, plus the extra classes).
* @returns The class string.
*/
classes(): string {
return this.cm().cn(
this.cm().card({ variant: 'elevated' }),
this.cm().cardPadding('md'),
this.className,
)
}
/**
* The avatar row's class.
* @returns The class string.
*/
avatarRowClass(): string {
return this.cm().flex({ align: 'start', gap: 'md' })
}
/**
* The body column's class.
* @returns The class string.
*/
bodyClass(): string {
return this.cm().cn(this.cm().flex1, this.cm().stack(2))
}
/**
* The name heading's class.
* @returns The class string.
*/
headingClass(): string {
return this.cm().cn(this.cm().textSize('lg'), this.cm().fontWeight('bold'))
}
/**
* The description paragraph's class.
* @returns The class string.
*/
descriptionClass(): string {
return this.cm().textSize('sm')
}
/**
* The rating / badges row's class.
* @returns The class string.
*/
metaRowClass(): string {
return this.cm().flex({ align: 'center', gap: 'sm', wrap: 'wrap' })
}
/**
* The rating chip's class.
* @returns The class string.
*/
ratingClass(): string {
return this.cm().cn(this.cm().flex({ align: 'center', gap: 'xs' }), this.cm().textSize('sm'))
}
/**
* The member-since text's class.
* @returns The class string.
*/
memberSinceClass(): string {
return this.cm().textSize('xs')
}
/**
* The actions row's class.
* @returns The class string.
*/
actionsClass(): string {
return this.cm().flex({ align: 'center', gap: 'sm' })
}
/**
* The Avatar's alt/name (React's `typeof name === 'string' ? name :
* 'Vendor'`).
* @returns The display name.
*/
displayName(): string {
return typeof this.name === 'string' ? this.name : 'Vendor'
}
/**
* The formatted rating, one decimal place (React's `rating.toFixed(1)`).
* @returns The rating text.
*/
ratingText(): string {
return (this.rating ?? 0).toFixed(1)
}
/**
* The review count in parentheses (React's `({reviewCount})`).
* @returns The review count text.
*/
reviewText(): string {
return `(${this.reviewCount})`
}
/**
* Whether a text name input is present (a projected name is not).
* @returns True when the name renders as text.
*/
get hasName(): boolean {
return this.name !== undefined && this.name !== null
}
/**
* Whether the description renders as text: React's `description && …`
* truthiness.
* @returns True when the tagline text shows.
*/
get hasDescription(): boolean {
return this.description !== undefined && this.description !== null && this.description !== ''
}
/**
* Whether a rating renders: React's `rating !== undefined` (a zero rating
* still renders).
* @returns True when the ★ chip shows.
*/
get hasRating(): boolean {
return this.rating !== undefined
}
/**
* Whether the review count renders: React's `reviewCount !== undefined`,
* only inside a rating.
* @returns True when the count shows.
*/
get hasReviewCount(): boolean {
return this.reviewCount !== undefined
}
/**
* Whether the member-since text renders: React's `memberSince && …`
* truthiness.
* @returns True when the date text shows.
*/
get hasMemberSince(): boolean {
return this.memberSince !== undefined && this.memberSince !== null && this.memberSince !== ''
}
/**
* Whether the badges text renders: React's `badges && …` truthiness (the
* `[slot=badges]` projection renders regardless).
* @returns True when the badges text shows.
*/
get hasBadges(): boolean {
return this.badges !== undefined && this.badges !== null && this.badges !== ''
}
/**
* Whether the actions text renders: React's `actions && …` truthiness.
* @returns True when the actions text shows.
*/
get hasActions(): boolean {
return this.actions !== undefined && this.actions !== null && this.actions !== ''
}
}
(The longest member comment is shortened to its first sentence to fit; the full declaration is in node_modules/@molecule/app-vendor-card-angular/dist/vendor-card.component.d.ts.)
Injection Notes
Requirements
Peer dependencies:
@angular/common^22.0.0@angular/core^22.0.0@angular/platform-browser^22.0.0@molecule/app-angular^3.13.0 || ^4.0.0@molecule/app-ui^1.0.1@molecule/app-ui-angular^1.1.0
Runtime Dependencies
@angular/common@angular/core@angular/platform-browser@molecule/app-angular@molecule/app-ui@molecule/app-ui-angular
Composes Avatar from @molecule/app-ui-angular on the shared Card
surface (cm.card({ variant: 'elevated' }) + cm.cardPadding('md')). The
host IS the card's root <div>, so a click anywhere on the card fires the
host's (click) — no keyboard handler or role is added; put primary
navigation in actions buttons for accessibility. rating renders a
single ★ plus the number (toFixed(1)), not a five-star row;
reviewCount renders only when rating is also set. When name is not a
plain string the Avatar alt falls back to hardcoded 'Vendor'. All text
slots (description, memberSince, badges, actions) are pre-translated — no
locale bond. Node props are projected content: name, description,
memberSince, badges and actions are selected by [slot=<name>],
everything else binds as inputs. Props (documented on the exported
VendorCardProps interface): name, logoSrc, description, rating,
reviewCount, memberSince, badges, actions, onClick, className.