Payment Card
A company card face that stays masked until the reader asks, then shows each detail with a copy button.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
label | string | — | What the card is for ("Marketing team · Virtual"), top left; also its accessible name. |
holder | string | — | The cardholder's name. |
last4 | string | — | The last four digits, shown on the masked face. |
hide-after | number | 60 | Seconds the details stay shown before the card masks itself again. 0 keeps them until hide(). |
frozen | boolean | false | A frozen card: greyed, badged, and its details cannot be shown. |
Slots
| Name | Description |
|---|---|
brand | The card network's or issuer's logo, top right. The app supplies its own licensed artwork. |
badge | Replaces the "Frozen" badge of a frozen card. |
actions | More buttons beside "Show details" ("Freeze", "Report lost"). |
Events
| Name | Type | Description |
|---|---|---|
reveal-request | CustomEvent<void> | Fired when the reader asks to see the details: fetch them and set details, or call revealFailed(). Does not bubble. |
field-copy | CustomEvent<{ field: 'number' | 'expiry' | 'cvc' }> | Fired after a field was copied (named apart from the native clipboard copy). Does not bubble. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
face | The card face. |
number | The number line. |
actions | The row of buttons under the face. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-payment-card--width | pixel | 340px | |
--c2-payment-card--gap | pixel | 10px | Space between the face and the button row. |
--c2-payment-card__face--aspect-ratio | number | 1.586 | The ISO card proportion. |
--c2-payment-card__face--background | color | radial-gradient(120% 140% at 0% 0%, #3f3f46 0%, #18181b 60%) | A colour or a gradient. |
--c2-payment-card__face--color | color | #ffffff | |
--c2-payment-card__face--padding | padding | 20px | |
--c2-payment-card__face--border-radius | border-radius | 14px | |
--c2-payment-card__face--box-shadow | shadow | 0 8px 24px rgba(0, 0, 0, 0.18) | |
--c2-payment-card__number--font-size | font-size | 20px | |
--c2-payment-card__label--font-size | font-size | 13px | |
--c2-payment-card__caption--font-size | font-size | 10px | The field captions (CARDHOLDER, EXPIRES). |
--c2-payment-card__value--font-size | font-size | 14px | |
--c2-payment-card__chip--display | display | block | none drops the chip. |
--c2-payment-card__chip--background | color | linear-gradient(135deg, #e7c66b, #b8913a) | |
--c2-payment-card__fields--display | display | flex | none drops the expiry and security code row, for a compact card. |
--c2-payment-card__actions--display | display | flex | none drops the button row. |
--c2-payment-card__copy--color | color | rgba(255, 255, 255, 0.8) | The copy icons on the face. |
--c2-payment-card__skeleton--background | color | rgba(255, 255, 255, 0.18) | |
--c2-payment-card__badge--background | color | rgba(255, 255, 255, 0.16) | |
--c2-payment-card__frozen--filter | string | grayscale(1) brightness(0.9) | The filter on a frozen face. |
Text and languages
The text the component shows, in English. It shows another language when the app adds one with addTranslations, under payment-card, and the nearest lang asks for it; any message not translated stays in English. {0}, {1}… stand for the values a message carries. Languages guide.
| Key | English | Values |
|---|---|---|
card | Payment card | — |
show | Show details | — |
hide | Hide details | — |
holder | Cardholder | — |
expires | Expires | — |
cvc | CVC | — |
endingIn | Card ending in {0} | {0} last4 |
number | Card number {0} | {0} number |
copyNumber | Copy card number | — |
copyExpiry | Copy expiry date | — |
copyCvc | Copy security code | — |
frozen | Frozen | — |
shown | Card details shown | — |
hidden | Card details hidden | — |
loading | Loading card details | — |