Tally UI

CustomerCard

CustomerCard displays a customer's name, email, and address through the active connector's customer traits, or nothing if traits are missing.

Import

import { CustomerCard } from '@tallyui/components';

Usage

<CustomerCard doc={customerDocument} />

Renders a customer's name, email, and address summary. The component reads data through useCustomerTraits(), so the active connector's customer trait implementation determines which fields are used.

Requires a ConnectorProvider ancestor in the component tree.

Props

PropTypeDefaultDescription
docanyrequiredCustomer document from RxDB
traitsCustomerTraits<Doc>from ConnectorProviderCustomer traits used to read the name, email and address summary; read from the connector context when omitted
classNamestring---Override container styles

Trait mapping

FieldTrait method
Nametraits.customer.getName(doc)
Emailtraits.customer.getEmail(doc)
Addresstraits.customer.getAddressSummary(doc)

If the connector doesn't implement customer traits, the component renders nothing.

Live demo