open-payment-host

UI design conventions

Use these conventions for new and modified screens, including product forms, payment gateway and API fields, invoices, and invoice settings. They capture the design agreed for the existing forms. Agent workflow instructions live in AGENTS.md.

Theme and components

Forms and spacing

The Product Summary group in the product create form is the spacing reference.

Relationship Convention
Label, description, and control within a field group flex flex-col gap-3 (12px)
Between separate field groups or repeated pricing rows flex flex-col gap-5 (20px)
Field label block text-sm/6 font-medium with label-text text-xl on its text
Label containing its control flex flex-col gap-3 with label-text text-xl font-medium on its text
Description/help text text-sm/6
Control width w-full with the existing appropriate max-w-* limit
Hidden validation hint validator-hint hidden, paired with a validator control

Prefer container gaps over accumulating child margins or nested space-y-* utilities, especially around conditional fields. A hidden hint must occupy no space; DaisyUI reveals the hint when its associated control becomes invalid. Do not tighten the label-to-control gap to compensate for an empty hint.

Associate every label with its control using for/id or a containing label. Keep explanatory text next to the field it describes.

Billing forms must style optional business-name/GSTIN fields like the surrounding fields, including label size/weight, neutral input borders, width and spacing. Show both fields only for Indian billing addresses. For a foreign or unselected country, hide the group, disable its inputs, and clear its values on country changes so stale details cannot be submitted. Country controls show full country names and submit their ISO codes; buyers should not need to type codes. Razorpay’s international country selector follows State, with the detected country preselected where available.

For example:

<div class="flex flex-col gap-5">
  <div class="flex flex-col gap-3">
    <label for="gst_code" class="block text-sm/6 font-medium">
      <span class="label-text text-xl">HSN/SAC code</span>
    </label>
    <input id="gst_code" name="gst_code" type="text"
      class="input validator w-full max-w-lg prose lg:prose-xl"
      pattern="[0-9]{4}([0-9]{2})?([0-9]{2})?" required />
    <p class="validator-hint hidden">Enter a 4, 6 or 8 digit HSN/SAC code.</p>
  </div>
  <!-- Further field groups use the same internal gap. -->
</div>

See the GST fields, API fields, and invoice settings for existing examples. Apply the same spacing to create, update, and dynamically returned partials.

Conditional sections and payment flow

The GST toggle demonstrates the conditional section pattern. Preserve stored values, field names, request parameters, and schedule-specific behavior when changing presentation.

Responsive gateway pricing rows

Stack pricing controls on mobile. From the sm breakpoint (640px), keep the country, amount/plan, tax, currency, and remove button on the same row. Controls must shrink within the available width so the remove button stays beside them.

Element Layout classes
Pricing row flex flex-col gap-3 sm:flex-row sm:flex-nowrap sm:items-start
Country select select min-w-0 sm:flex-[2_1_0%] w-full max-w-60 rounded-sm
Amount, plan, or currency input input min-w-0 sm:flex-1 w-full plus the existing width limit
Tax HTMX wrapper w-full min-w-0 max-w-24 sm:flex-1
Remove button wrapper flex shrink-0
Label wrapping a pricing control flex min-w-0 flex-col gap-3 sm:flex-1

Constrain wrappers as well as their inputs: a tax input replaced by HTMX must remain inside a flexible wrapper. Use min-w-0 w-full on an input inside a flexible label. Avoid sm:flex-wrap on these rows because it sends the remove button to a second line.

See the PayPal pricing row and shared country select. Apply the same layout to Stripe, Square, PayPal, and Razorpay, including initial rows, added countries, saved update rows, and all supported schedules. Preserve field IDs, indices, tax calculations, and add/remove behavior.

Invoice PDFs

Building and checking changes

Edit template classes or Tailwind source; generate the committed stylesheet instead of editing the minified output by hand:

npx @tailwindcss/cli -i ./tailwind/tailwind.css -o ./src/app/assets/styles/app.css --minify

For UI changes, check the affected states in a browser:

Run existing checks appropriate to behavior changes. HTTP and unit tests do not establish visual layout; use browser verification for geometry changes. A documentation-only update needs link and whitespace checks, without rebuilding CSS or rerunning application tests.