Drop-in React components and headless hooks for drafting, validating and serialising SWIFT MT (MT103, MT202, MT202COV, MT199) and ISO 20022 MX (pacs.008, pacs.009, pacs.002, camt.053, camt.054) messages. A thin React layer on top of @ohmyfin/swift-draft — same pure-function engine, now wired up with useState, useMemo and ARIA.
npm install @ohmyfin/swift-draft @ohmyfin/swift-draft-react react
import { Mt103Form } from "@ohmyfin/swift-draft-react";
<Mt103Form
variant="tailwind"
defaultValues={{ senderBic: "BANKGB22XXX", receiverBic: "DEUTDEFFXXX" }}
onSubmit={({ values, serialized, report }) => {
if (report.ok) console.log(serialized);
else console.warn(report.issues);
}}
/>
import { useMt103Form, UetrInput, BicInput } from "@ohmyfin/swift-draft-react";
const form = useMt103Form();
<BicInput value={form.values.senderBic} onChange={v => form.setValue("senderBic", v)} />
<BicInput value={form.values.receiverBic} onChange={v => form.setValue("receiverBic", v)} />
<UetrInput value={form.values.uetr ?? ""} onChange={v => form.setValue("uetr", v)} />
<button disabled={!form.isValid} onClick={() => form.submit(({serialized}) => console.log(serialized))}>
Generate
</button>
The form below is the engine + validators that ship in the React package, rendered as plain DOM so it works without a JSX runtime. Fill in the fields — validation runs on every keystroke and the serialised 4-block MT103 appears under the form once the payload is valid.
| Kind | Hook | Form component |
|---|---|---|
MT103 | useMt103Form | <Mt103Form/> |
MT103 STP | useMt103StpForm | <Mt103StpForm/> |
MT202 | useMt202Form | <Mt202Form/> |
MT202 COV | useMt202CovForm | <Mt202CovForm/> |
MT199 | useMt199Form | <Mt199Form/> |
pacs.008.001.08 | usePacs008Form | <Pacs008Form/> |
pacs.009.001.08 | usePacs009Form | <Pacs009Form/> |