{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"credit-card","title":"Credit Card","description":"Show a payment card with its issuer, cardholder, number, expiry date and network mark, in one of thirteen looks. Search terms: payment method, card preview, bank card, billing.","registryDependencies":["@siteplane/base"],"files":[{"path":"packages/ui/src/components/credit-card/credit-card.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\n\nimport { surfaceClassNames } from \"../../system/styles/surface\";\nimport { cn } from \"../../system/utils/cn\";\nimport { slotClass } from \"../../system/utils/slot-class\";\n\nimport \"./credit-card.css\";\n\n/**\n * The thirteen looks of a card. The first six are a\n * full face: clear glass, glass with a soft colour glow in its corner, the\n * brand in a dark and a light shade, and a dark and a light grey. The next\n * four have a dark strip across their lower half under a clear glass, a light\n * grey, a soft brand gradient or a warm tint. The last three have the dark strip\n * on the left and a plain, a gradient or a warm column at the right, where the\n * network mark stands.\n */\nexport type CreditCardVariant =\n  | \"transparent\"\n  | \"transparent-gradient\"\n  | \"brand-dark\"\n  | \"brand-light\"\n  | \"gray-dark\"\n  | \"gray-light\"\n  | \"transparent-strip\"\n  | \"gray-strip\"\n  | \"gradient-strip\"\n  | \"salmon-strip\"\n  | \"gray-strip-vertical\"\n  | \"gradient-strip-vertical\"\n  | \"salmon-strip-vertical\";\n\n/** The variants that are clear glass, which lies on artwork and takes its look from it. */\nconst glassVariants: ReadonlySet<CreditCardVariant> = new Set([\n  \"transparent\",\n  \"transparent-gradient\",\n  \"transparent-strip\",\n]);\n\nconst horizontalStrips: ReadonlySet<CreditCardVariant> = new Set([\n  \"transparent-strip\",\n  \"gray-strip\",\n  \"gradient-strip\",\n  \"salmon-strip\",\n]);\n\nconst verticalStrips: ReadonlySet<CreditCardVariant> = new Set([\n  \"gray-strip-vertical\",\n  \"gradient-strip-vertical\",\n  \"salmon-strip-vertical\",\n]);\n\nexport interface CreditCardProps extends Omit<\n  React.ComponentProps<\"div\">,\n  \"children\"\n> {\n  /** The issuer's name, set as the wordmark at the top start of the card. */\n  brand?: React.ReactNode;\n  /** The expiry date, at the end of the line of the cardholder's name. */\n  expiry?: string | undefined;\n  /**\n   * The mark of the card network, in a tile at the bottom end of the card. The\n   * kit draws two overlapping circles, a generic mark, since it ships no\n   * network's own logo; pass the network's mark here. `null` leaves the tile\n   * out.\n   */\n  mark?: React.ReactNode;\n  /** The cardholder's name, set in capitals above the number. */\n  name?: string | undefined;\n  /** The card number, as it is to read, such as \"1234 1234 1234 1234\". */\n  number?: string | undefined;\n  /** One of the thirteen looks; `brand-dark` by default. */\n  variant?: CreditCardVariant | undefined;\n}\n\n/** The generic network mark: two overlapping circles, the overlap at full strength. */\nfunction GenericNetworkMark(): React.ReactElement {\n  return (\n    <svg\n      aria-hidden=\"true\"\n      className=\"sp-credit-card-mark-glyph\"\n      fill=\"currentColor\"\n      focusable=\"false\"\n      viewBox=\"0 0 30 19\"\n    >\n      <circle cx=\"9.4\" cy=\"9.5\" opacity=\"0.5\" r=\"9.4\" />\n      <circle cx=\"20.4\" cy=\"9.5\" opacity=\"0.5\" r=\"9.4\" />\n      <path d=\"M14.9 1.88A9.4 9.4 0 0 1 14.9 17.12A9.4 9.4 0 0 1 14.9 1.88Z\" />\n    </svg>\n  );\n}\n\n/**\n * The contactless symbol: the three waves of Phosphor's contactless payment\n * icon without the circle around them, drawn as a 20 by 24 picture whose\n * waves reach from the top to the bottom, the outer one at its end.\n */\nfunction ContactlessMark(): React.ReactElement {\n  return (\n    <svg\n      aria-hidden=\"true\"\n      className=\"sp-credit-card-contactless\"\n      fill=\"none\"\n      focusable=\"false\"\n      stroke=\"currentColor\"\n      strokeLinecap=\"round\"\n      strokeWidth=\"3\"\n      viewBox=\"0 0 20 24\"\n    >\n      <path d=\"M4.875 7.5A9.5625 9.5625 0 0 1 4.875 16.5\" />\n      <path d=\"M10.125 4.5A15.9375 15.9375 0 0 1 10.125 19.5\" />\n      <path d=\"M15.375 1.5A22.3125 22.3125 0 0 1 15.375 22.5\" />\n    </svg>\n  );\n}\n\n/**\n * A payment card: the issuer's wordmark and the contactless symbol above, the\n * cardholder, the expiry date and the number below, and the card network's\n * mark in a tile at the corner. It keeps the 316 by 190 proportions of a bank\n * card and draws everything in units of its width, so a width from the\n * consumer (a class such as `w-60`) scales the card with its text, its\n * padding and its corners. It is a picture of a card and keeps its colours in\n * both themes; the three clear glass looks take the kit's clear glass, which\n * lies on artwork and shows what is behind it.\n */\nexport function CreditCard({\n  brand,\n  className,\n  expiry,\n  mark,\n  name,\n  number,\n  variant = \"brand-dark\",\n  ...props\n}: CreditCardProps): React.ReactElement {\n  const glass = glassVariants.has(variant);\n  const strip = horizontalStrips.has(variant)\n    ? \"horizontal\"\n    : verticalStrips.has(variant)\n      ? \"vertical\"\n      : undefined;\n  return (\n    <div\n      className={cn(slotClass(\"credit-card\", props), className)}\n      data-slot=\"credit-card\"\n      data-variant={variant}\n      {...props}\n    >\n      <div\n        className={cn(\n          slotClass(\"credit-card-face\"),\n          glass && surfaceClassNames.glass,\n        )}\n        data-glass-tone={glass ? \"clear\" : undefined}\n        data-slot=\"credit-card-face\"\n      >\n        {strip ? (\n          <span\n            aria-hidden=\"true\"\n            className=\"sp-credit-card-strip\"\n            data-slot=\"credit-card-strip\"\n            data-strip={strip}\n          />\n        ) : null}\n        {variant === \"transparent-gradient\" ? (\n          <span\n            aria-hidden=\"true\"\n            className=\"sp-credit-card-glow\"\n            data-slot=\"credit-card-glow\"\n          />\n        ) : null}\n        <div className=\"sp-credit-card-header\" data-slot=\"credit-card-header\">\n          <p className=\"sp-credit-card-brand\" data-slot=\"credit-card-brand\">\n            {brand}\n          </p>\n          <ContactlessMark />\n        </div>\n        <div className=\"sp-credit-card-footer\" data-slot=\"credit-card-footer\">\n          <div\n            className=\"sp-credit-card-details\"\n            data-slot=\"credit-card-details\"\n          >\n            <div className=\"sp-credit-card-line\" data-slot=\"credit-card-line\">\n              <p className=\"sp-credit-card-name\" data-slot=\"credit-card-name\">\n                {name}\n              </p>\n              <p\n                className=\"sp-credit-card-expiry\"\n                data-slot=\"credit-card-expiry\"\n              >\n                {expiry}\n              </p>\n            </div>\n            <p className=\"sp-credit-card-number\" data-slot=\"credit-card-number\">\n              {number}\n            </p>\n          </div>\n          {mark === null ? null : (\n            <div className=\"sp-credit-card-mark\" data-slot=\"credit-card-mark\">\n              {mark === undefined ? <GenericNetworkMark /> : mark}\n            </div>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n","type":"registry:ui","target":"~/src/siteplane/components/credit-card/credit-card.tsx"},{"path":"packages/ui/src/components/credit-card/credit-card.css","content":"@layer theme, base, components, siteplane, utilities;\n\n@layer siteplane {\n  /* A payment card: 316 by 190 px, drawn in units of\n   * its width (--sp-credit-card-unit, a 316th of it, read where a part uses it)\n   * so a width from the consumer scales the text, the padding and the corners\n   * with it. The card is a picture of an object and keeps its colours in both\n   * themes: the greys are the kit's fixed neutrals, the brand shades derive from\n   * the accent, and the clear glass is the kit's shared glass surface. */\n  :where(.sp-credit-card) {\n    --sp-credit-card-unit: calc(100cqw / 316);\n    --sp-credit-card-white: var(--sp-primitive-color-white);\n    --sp-credit-card-ink-dark: var(--sp-primitive-color-neutral-700);\n    --sp-credit-card-ink-faint: var(--sp-primitive-color-neutral-400);\n    --sp-credit-card-strip: var(--sp-primitive-color-neutral-800);\n    --sp-credit-card-film: color-mix(\n      in oklab,\n      var(--sp-primitive-color-white) 10%,\n      transparent\n    );\n    --sp-credit-card-rim-light: color-mix(\n      in oklab,\n      var(--sp-primitive-color-white) 30%,\n      transparent\n    );\n    --sp-credit-card-rim-dark: var(--sp-primitive-color-black-alpha-10);\n\n    /* The brand in three shades and the soft gradients, from the accent. A\n     * brand override recolours them (rulebook C1, C3). */\n    --sp-credit-card-brand-100: oklch(\n      from var(--sp-rw-bg-accent) 0.951 calc(c * 0.14) h\n    );\n    --sp-credit-card-brand-700: oklch(\n      from var(--sp-rw-bg-accent) calc(l - 0.058) c h\n    );\n    --sp-credit-card-brand-900: oklch(\n      from var(--sp-rw-bg-accent) calc(l - 0.166) calc(c - 0.055) h\n    );\n    --sp-credit-card-soft-blue: oklch(\n      from var(--sp-rw-bg-accent) 0.804 calc(c * 0.465) calc(h + 7)\n    );\n    --sp-credit-card-soft-pink: oklch(\n      from var(--sp-rw-bg-accent) 0.88 calc(c * 0.52) calc(h + 82)\n    );\n    --sp-credit-card-soft-violet: oklch(\n      from var(--sp-rw-bg-accent) 0.685 calc(c * 0.66) calc(h + 43)\n    );\n    /* The warm tint of the salmon looks, in the hue of the orange colour tint\n     * (the warning moved to amber, 2 November 2026). */\n    --sp-credit-card-warm: oklch(from var(--sp-rw-bg-orange) 0.905 0.033 h);\n\n    /* What a variant sets: the face, the hairline ring along its edge, the\n     * wordmark, the lines of the footer, the contactless symbol, the tile of\n     * the network mark and the mark in it. The default is brand-dark. */\n    --sp-credit-card-fill: linear-gradient(\n      to top right,\n      var(--sp-credit-card-brand-900),\n      var(--sp-credit-card-brand-700)\n    );\n    --sp-credit-card-ring: var(--sp-credit-card-rim-light);\n    --sp-credit-card-brand-ink: var(--sp-credit-card-white);\n    --sp-credit-card-footer-ink: var(--sp-credit-card-white);\n    --sp-credit-card-contactless-ink: var(--sp-credit-card-white);\n    --sp-credit-card-tile: var(--sp-credit-card-film);\n    --sp-credit-card-mark-ink: var(--sp-credit-card-white);\n\n    position: relative;\n    display: grid;\n    width: 19.75rem;\n    max-width: 100%;\n    aspect-ratio: 316 / 190;\n    container-type: inline-size;\n  }\n\n  :where(.sp-credit-card[data-variant=\"brand-light\"]) {\n    --sp-credit-card-fill: var(--sp-credit-card-brand-100);\n    --sp-credit-card-ring: var(--sp-credit-card-rim-dark);\n    --sp-credit-card-brand-ink: var(--sp-credit-card-ink-dark);\n    --sp-credit-card-footer-ink: var(--sp-credit-card-ink-dark);\n    --sp-credit-card-tile: var(--sp-credit-card-white);\n    --sp-credit-card-mark-ink: var(--sp-credit-card-ink-dark);\n  }\n\n  :where(.sp-credit-card[data-variant=\"gray-dark\"]) {\n    --sp-credit-card-fill: linear-gradient(\n      to top right,\n      var(--sp-primitive-color-neutral-900),\n      var(--sp-primitive-color-neutral-700)\n    );\n  }\n\n  :where(.sp-credit-card[data-variant=\"gray-light\"]) {\n    --sp-credit-card-fill: var(--sp-primitive-color-neutral-100);\n    --sp-credit-card-ring: var(--sp-credit-card-rim-dark);\n    --sp-credit-card-brand-ink: var(--sp-credit-card-ink-dark);\n    --sp-credit-card-footer-ink: var(--sp-credit-card-ink-dark);\n    --sp-credit-card-contactless-ink: var(--sp-credit-card-ink-faint);\n    --sp-credit-card-tile: var(--sp-credit-card-white);\n    --sp-credit-card-mark-ink: var(--sp-credit-card-ink-dark);\n  }\n\n  /* The strips: a dark half under a coloured one, or a dark face with a\n   * coloured column at its end. The wordmark sits on the colour or on the dark\n   * as the variant's top or start does, and the footer lines on the dark. */\n  :where(.sp-credit-card[data-variant=\"gray-strip\"]) {\n    --sp-credit-card-fill: var(--sp-primitive-color-neutral-100);\n    --sp-credit-card-brand-ink: var(--sp-credit-card-ink-dark);\n    --sp-credit-card-contactless-ink: var(--sp-credit-card-ink-faint);\n  }\n\n  :where(.sp-credit-card[data-variant=\"gradient-strip\"]) {\n    --sp-credit-card-fill: linear-gradient(\n      to bottom,\n      var(--sp-credit-card-soft-blue),\n      var(--sp-credit-card-soft-pink)\n    );\n  }\n\n  :where(.sp-credit-card[data-variant=\"salmon-strip\"]) {\n    --sp-credit-card-fill: var(--sp-credit-card-warm);\n    --sp-credit-card-brand-ink: var(--sp-credit-card-ink-dark);\n  }\n\n  :where(.sp-credit-card[data-variant=\"gray-strip-vertical\"]) {\n    --sp-credit-card-fill: linear-gradient(\n      to bottom right,\n      var(--sp-credit-card-rim-light),\n      transparent\n    );\n    --sp-credit-card-contactless-ink: var(--sp-credit-card-ink-faint);\n  }\n\n  :where(.sp-credit-card[data-variant=\"gradient-strip-vertical\"]) {\n    --sp-credit-card-fill: linear-gradient(\n      to bottom,\n      var(--sp-credit-card-soft-pink),\n      var(--sp-credit-card-soft-violet)\n    );\n  }\n\n  :where(.sp-credit-card[data-variant=\"salmon-strip-vertical\"]) {\n    --sp-credit-card-fill: var(--sp-credit-card-warm);\n  }\n\n  /* The face fills the card, with 16 px inside it and 16 px corners, which are\n   * the kit's dialog radius at the most (16 px at the default radius) and\n   * shrink with the card, so a theme that squares or rounds the kit's corners\n   * does the same to the card. The clear glass variants take their fill, rim\n   * and shadow from the shared glass surface, which stands above this rule. */\n  :where(.sp-credit-card-face) {\n    position: relative;\n    isolation: isolate;\n    display: flex;\n    min-width: 0;\n    flex-direction: column;\n    justify-content: space-between;\n    overflow: hidden;\n    padding: calc(16 * var(--sp-credit-card-unit));\n    border-radius: min(\n      var(--sp-rw-radius-dialog),\n      calc(16 * var(--sp-credit-card-unit))\n    );\n    background: var(--sp-credit-card-fill);\n  }\n\n  /* The hairline ring along the edge, strongest at the top start and fading to\n   * a fifth of it at the bottom end. */\n  :where(.sp-credit-card-face:not(.sp-glass-surface))::before {\n    position: absolute;\n    inset: 0;\n    z-index: 2;\n    border-radius: inherit;\n    box-shadow: inset 0 0 0 var(--sp-rw-border-default)\n      var(--sp-credit-card-ring);\n    content: \"\";\n    -webkit-mask-image: linear-gradient(135deg, black, rgb(0 0 0 / 20%));\n    mask-image: linear-gradient(135deg, black, rgb(0 0 0 / 20%));\n    pointer-events: none;\n  }\n\n  /* The dark half of a strip variant, behind the text. */\n  :where(.sp-credit-card-strip) {\n    position: absolute;\n    z-index: 0;\n    background: var(--sp-credit-card-strip);\n    pointer-events: none;\n  }\n\n  :where(.sp-credit-card-strip[data-strip=\"horizontal\"]) {\n    inset-block-end: 0;\n    inset-inline: 0;\n    height: 50%;\n  }\n\n  :where(.sp-credit-card-strip[data-strip=\"vertical\"]) {\n    inset-block: 0;\n    inset-inline-start: 0;\n    inset-inline-end: calc(88 * var(--sp-credit-card-unit));\n  }\n\n  /* The soft glow in the corner of the transparent gradient: four quarters in\n   * the brand's neighbours, the kit's orange, blue and green, blurred into one\n   * haze. */\n  :where(.sp-credit-card-glow) {\n    position: absolute;\n    inset-block-start: calc(-16 * var(--sp-credit-card-unit));\n    inset-inline-start: calc(-16 * var(--sp-credit-card-unit));\n    z-index: 0;\n    width: calc(160 * var(--sp-credit-card-unit));\n    height: calc(160 * var(--sp-credit-card-unit));\n    border-radius: 50%;\n    background: conic-gradient(\n      color-mix(in oklab, var(--sp-rw-bg-orange) 50%, transparent) 0 25%,\n      color-mix(in oklab, var(--sp-rw-bg-positive) 30%, transparent) 0 50%,\n      color-mix(in oklab, var(--sp-rw-bg-accent) 30%, transparent) 0 75%,\n      color-mix(\n          in oklab,\n          oklch(from var(--sp-rw-bg-accent) l c calc(h + 100)) 30%,\n          transparent\n        )\n        0\n    );\n    filter: blur(calc(64 * var(--sp-credit-card-unit)));\n    pointer-events: none;\n  }\n\n  :where(.sp-credit-card-header),\n  :where(.sp-credit-card-footer) {\n    position: relative;\n    z-index: 1;\n    display: flex;\n    justify-content: space-between;\n  }\n\n  /* The wordmark and the contactless symbol: 4 px in from the sides and the\n   * top, a 16 px wordmark in the strong weight and the bare waves of the\n   * symbol in a 20 by 24 px box, with no circle around\n   * them (Lukas, 2 November 2026). */\n  :where(.sp-credit-card-header) {\n    align-items: flex-start;\n    padding-inline: calc(4 * var(--sp-credit-card-unit));\n    padding-block-start: calc(4 * var(--sp-credit-card-unit));\n  }\n\n  :where(.sp-credit-card-brand) {\n    margin: 0;\n    color: var(--sp-credit-card-brand-ink);\n    font-size: calc(16 * var(--sp-credit-card-unit));\n    font-weight: var(--sp-rw-font-weight-strong);\n    line-height: normal;\n  }\n\n  :where(.sp-credit-card-contactless) {\n    width: calc(20 * var(--sp-credit-card-unit));\n    height: calc(24 * var(--sp-credit-card-unit));\n    flex-shrink: 0;\n    color: var(--sp-credit-card-contactless-ink);\n  }\n\n  /* The footer: the cardholder and the expiry date over the number, 8 px apart,\n   * and the tile of the network mark 12 px after them. The tracking is\n   * 0.6 px at 12 px and 1 px at 16 px, set through the token that the\n   * global letter spacing reads. */\n  :where(.sp-credit-card-footer) {\n    align-items: flex-end;\n    gap: calc(12 * var(--sp-credit-card-unit));\n  }\n\n  :where(.sp-credit-card-details) {\n    display: flex;\n    min-width: 0;\n    flex-direction: column;\n    gap: calc(8 * var(--sp-credit-card-unit));\n  }\n\n  :where(.sp-credit-card-line) {\n    display: flex;\n    align-items: flex-end;\n    gap: calc(4 * var(--sp-credit-card-unit));\n  }\n\n  :where(.sp-credit-card-name),\n  :where(.sp-credit-card-expiry),\n  :where(.sp-credit-card-number) {\n    --sp-rw-letter-spacing-default: 0.05em;\n\n    margin: 0;\n    color: var(--sp-credit-card-footer-ink);\n    font-size: calc(12 * var(--sp-credit-card-unit));\n    font-weight: var(--sp-rw-font-weight-strong);\n    line-height: 1.375;\n  }\n\n  :where(.sp-credit-card-name) {\n    text-transform: uppercase;\n    word-break: break-word;\n  }\n\n  :where(.sp-credit-card-expiry) {\n    margin-inline-start: auto;\n    font-variant-numeric: tabular-nums;\n    line-height: normal;\n    text-align: end;\n  }\n\n  :where(.sp-credit-card-number) {\n    --sp-rw-letter-spacing-default: 0.0625em;\n\n    min-height: 1.2em;\n    font-size: calc(16 * var(--sp-credit-card-unit));\n    font-variant-numeric: tabular-nums;\n    line-height: normal;\n  }\n\n  :where(.sp-credit-card-mark) {\n    display: flex;\n    width: calc(46 * var(--sp-credit-card-unit));\n    height: calc(32 * var(--sp-credit-card-unit));\n    flex-shrink: 0;\n    align-items: center;\n    justify-content: center;\n    border-radius: min(\n      var(--sp-rw-radius-xs),\n      calc(4 * var(--sp-credit-card-unit))\n    );\n    background: var(--sp-credit-card-tile);\n    color: var(--sp-credit-card-mark-ink);\n  }\n\n  :where(.sp-credit-card-mark-glyph) {\n    width: calc(30 * var(--sp-credit-card-unit));\n    height: calc(19 * var(--sp-credit-card-unit));\n  }\n}\n","type":"registry:ui","target":"~/src/siteplane/components/credit-card/credit-card.css"},{"path":"packages/ui/src/components/credit-card/index.ts","content":"export * from \"./credit-card\";\n","type":"registry:ui","target":"~/src/siteplane/components/credit-card/index.ts"}],"type":"registry:ui","docs":"https://ui.siteplane.io/docs-markdown/components/credit-card.md","categories":["Data display"],"meta":{"avoidWhen":["Avoid for collecting card details; use the fields of a Form.","Avoid the transparent looks and gray-strip-vertical on a plain page; they let the background through and need a photo, an illustration or a gradient behind them."],"description":"Show a payment card with its issuer, cardholder, number, expiry date and network mark, in one of thirteen looks.","knownLimitations":["The kit ships no card network logo; the tile shows a generic mark until the network's mark is passed as mark.","The card shows details and owns no interaction or selection.","The looks keep their colors in Light and Dark, as a picture of a real card does."],"providerNotes":[],"releaseStatus":"preview","searchTerms":["credit card","payment card","payment method","card preview","bank card","billing"],"useWhen":["Use to show a saved payment method on a billing page or in a list of cards to choose from, with the last four digits of the number.","Use a width class to fit the card to its place; it scales its text, padding and corners with its width."]}}