Skip to content

MemberCard ​

Membership tier / benefits card: grade (tier badge — the visible text is the identifier, not color-only), perks slot (perks), validity period (expire text + i18n prefix), action-button slot (actions — renew / upgrade buttons owned by the host, accessible names come from the host buttons); background variant="solid" (default) / gradient, both token-based (the exit tokens --oas-member-card-bg / --oas-member-card-gradient can take over the whole card; defaults reference theme tokens and follow dark automatically). Purely presentational (zero event protocol).

Basic card (solid + perks + validity) ​

Gold member (solid + perks slot + validity period)

2 free-shipping coupons monthly
5% off on member days
Birthday gift pack

Gradient background & action slot ​

variant="gradient" gives the gradient background (linear-gradient(135deg, primary, primary-active) — token-based, dark follows); the actions slot holds renew / upgrade buttons (behavior and accessible names owned by the host):

Black-gold member (gradient + renew/upgrade actions)

12% off storewide
Priority support & shipping
Renew nowUpgrade tier

Click an action button to see the host-side feedback (zero event protocol — behavior owned by the host).

Tier comparison ​

grade omitted renders no badge; for side-by-side tiers give each card its own variant / exit tokens (the host customizes the background by grade):

Tier comparison (standard / gold / diamond)

Newcomer coupon on signup
2 free-shipping coupons monthly
15% off storewide
Unlimited free shipping

Keyboard & accessibility ​

  • Card host carries role="group" + aria-label (“Membership card: {grade}” — the tier name is in the accessible name, screen readers know the tier without entering the card). aria-label ownership: an explicit host-provided name wins (the component never overwrites it, and grade changes don't clobber it); removing the attribute hands ownership back to the component, which follows grade again; a host value that happens to equal the derived string is treated as component-owned (an inherent limit of value-based ownership, semantically equivalent).
  • The grade badge's visible text is the tier identifier (not color-only — the background variant is just visual emphasis), with an sr-only “Membership tier” prefix for screen-reader semantics.
  • The validity row carries the i18n prefix (“Valid until:”); action buttons take accessible names from the host buttons (no wrapper layer).
  • perks / actions hide entirely when empty (no empty blocks); RTL and dark theme follow via logical properties and tokens.

Custom styling notes ​

::part(card) is the card face (background driven by variant — take over via the exit tokens --oas-member-card-bg / --oas-member-card-gradient rather than overriding the part); ::part(grade) is the tier badge (an on-primary outlined pill — white text sits directly on the card background, so contrast is never diluted by a tinted overlay); ::part(perks) / ::part(expire) / ::part(actions) are the three regions. Foreground text uses --oas-color-text-on-primary. data-variant reflects onto the host element, so oas-member-card[data-variant='gradient'] works from outside.

API ​

oas-member-card ​

Attributes ​

AttributeDescriptionTypeDefault
expireValidity text (the host supplies a date or copy, rendered with the i18n prefix); omitted renders no validity row——
gradeTier name (e.g. “Gold member”); omitted renders no badge; the identifier is the badge text + sr-only “Membership tier” prefix (not color-only)——
variantBackground variant: solid (default) / gradient; invalid values fall back to solid with a one-time warning; the current variant reflects to the data-variant attribute——

Slots ​

NameDescription
actionsAction row (renew / upgrade buttons — behavior and accessible names come from the host buttons; hides when empty)
perksBenefits area (entries owned by the host; hides when empty)

CSS Variables ​

CSS VariableDefault
--oas-member-card-bgvar(--oas-color-primary)
--oas-member-card-gradientlinear-gradient(135deg, var(--oas-color-primary), var(--oas-color-primary-active))

Released under the MIT OR Apache-2.0 License.