Aller au contenu

React

Ce contenu n’est pas encore disponible dans votre langue.

Use the @subnoto/embed-react package to render the signing UI in a React app. You pass the iframe token (and optional host); the component builds the embed URL for you.

install.sh
pnpm add @subnoto/embed-react
# or npm install @subnoto/embed-react

Requires React 17+.

Create the iframe token on your backend and pass it to the client. See Iframe token for the API and parameters.

SigningView.tsx
import { SignEmbed } from "@subnoto/embed-react";
function SigningView({ iframeToken, host }: { iframeToken: string; host?: string }) {
return (
<div style={{ width: "100%", height: "400px" }}>
<SignEmbed
token={iframeToken}
host={host}
title="Subnoto signing"
className="my-sign-embed"
/>
</div>
);
}

Props: token (required), host (optional, default https://app.subnoto.com), title, className. You can also pass a pre-built URL via iframeUrl instead of token and host. Give the embed a sized container so the iframe can fill it.

For a custom embed base URL (e.g. SUBNOTO_EMBED_BASE_URL), have your backend return both the token and the host and pass them to SignEmbed.