Payment Methods
ProA wrapping row of small chips with the names of the payment methods a shop accepts. Display only: the chips are text, not logos or buttons.
Playground
Installation
Payment Methods comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { PaymentMethods, PAYMENT_METHODS, PaymentMark } from "@wunderui/react"Then use it:
import { PaymentMethods } from "@wunderui/react"
export function AcceptedMethods() {
return (
<div className="flex flex-col items-center gap-2">
<p className="text-xs text-text-tertiary">We accept</p>
<PaymentMethods methods={["VISA", "MC", "AMEX", "PayPal"]} className="justify-center" />
</div>
)
}Expected result: You see the text We accept and under it a centred row of four small chips reading VISA, MC, AMEX and PayPal.
When to use
Use Payment Methods for
- The accepted methods under a pay button or in the footer of a checkout
- A short reminder in a cart, a pricing page or a shop footer
- A list of names that changes by market or by order
Use something else for
- Radio Group for choosing one payment method
- Selector Item for a list of methods to pick from, each with a description
- Badge for a status or a count on another element, not a name in a row
Methods
Pass a list of names, one chip each; without it the row shows six: VISA, MC, AMEX, PayPal, Apple Pay and Klarna. A chip is 24 px high, at least 40 px wide, and grows with a longer name.
Alignment
The row is as wide as its parent and starts at the left. Add a class to centre it or push it to the end.
Width
The component has no width of its own. When the parent is narrower than the chips, they wrap with 4 px between lines and chips, and nothing is cut off.
Behavior and motion
What Payment Methods does with its list, its width and its text. It is display only: no hover, focus, keyboard or loading behaviour.
- A row of text, not controls
- The row is a div with the group role and each chip a span, with no role, focus stop or hover state, and a click does nothing. To let people choose a method, use Radio Group or Option Row Group.
- Names, not logos
- Every chip shows the string you passed, with no brand colour or mark. The component does not expand MC, so write Mastercard where the short form would not be understood.
- Screen readers
- A screen reader announces the group named Accepted payment methods, then reads the chips as plain text, such as VISA MC AMEX. A visible label in front is still the better signal.
- Size and wrapping
- A chip is 24 px high, at least 40 px wide and grows with its name, and the row wraps 4 px apart. A parent narrower than one chip makes the name wrap inside it, so keep it wider.
- Alignment
- The row is as wide as its parent and chips start on the left. A class on the row, such as justify-center or justify-end, aligns them; margin and width work the same way.
- Keys and an empty list
- The name is the React key of its chip, so two equal names log a duplicate key warning. An empty list draws an empty row with no height that still takes its place in the layout.
- Colour
- Chips use the card fill, border and secondary text colour, all theme tokens that no prop can change. A chip is not tinted per method, so VISA and PayPal look the same.
- Motion and reduced motion
- Nothing is animated, so there is nothing to reduce under reduced motion.
Anatomy
The parts of the row, numbered in the figure, drawn larger than real size. The chips are made from the methods list, not passed as children.
- 1data-slot="payment-methods"
A group named Accepted payment methods that lays the chips out in a wrapping row, 4 px apart, as wide as its parent and starting on the left. It takes the methods and the attributes of a div.
- 2
One span per name: 24 px high, at least 40 px wide, with a border, a 4 px radius and the name in 10 px medium text. There is no logo and no icon.
- data-slot="payment-mark"Optional
Best practices
- Do
Pass only the methods you accept, and change the list by market. The default list is VISA, MC, AMEX, PayPal, Apple Pay and Klarna.
- Do
Write a label such as We accept before the row, because the chips are plain text. A screen reader announces the row as a group; pass an aria-label to name it for your page.
- Do
Keep names short, as in the defaults. A chip grows with its name, but a row narrower than one chip makes the name wrap and run out of the chip.
- Do
Align the row with a justify class when it sits in a centred or right-aligned area.
- Don’t
Don't expect logos or an interactive choice: the chips are plain text and not selectable. To let people pick a method, use Radio Group or Option Row Group.
- Don’t
Don't pass the same name twice. The name is the React key, so a repeat logs a warning and one of the two chips may not render.
- Don’t
Don't render the row with an empty list. It draws nothing but still takes its place in the layout, so hide it yourself.
API reference
Payment Methods is one component with the props below. It renders a div with the group role and passes every other div attribute on, so an id, a data attribute or an aria-label can be set.
A group named Accepted payment methods that lays the chips out in a wrapping row, 4 px apart, as wide as its parent and starting on the left. It takes the methods and the attributes of a div.
| Prop | Type | Default | Description |
|---|---|---|---|
| methods | string[] | ["VISA", "MC", "AMEX", "PayPal", "Apple Pay", "Klarna"] | The names of the accepted methods, one chip each, in this order. , , , , and by default. Each name must be unique, because it is the key of its chip. |
| Prop | Type | Default | Description |
|---|---|---|---|
| name required | "PayPal" | "Visa" | "Mastercard" | "Amex" | "SEPA" | "Apple Pay" | "Google Pay" | "Bank transfer" | — | Which payment method. |
| label | string | — | Accessible name. Defaults to the method name; pass "" when the text beside it already names it. |
| size | "sm" | "md" | "md" | 24 × 15 for table cells and dense rows, 32 × 20 for forms and lists. Default . |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("payment-methods")The full library index for assistants is at /llms.txt.