Component and hook reference
Props, hooks, types, status enums, callbacks, and CSS customization for @taxbit/react-sdk. For setup, see the Questionnaire integration guide.
Sections that differ between major versions have a tab per version; pick the one you have installed (npm ls @taxbit/react-sdk). 7.x is the latest. Sections without tabs apply to 4.x through 7.x unless they say otherwise. For moving between versions, see the Upgrade guide.
<TaxbitQuestionnaire/> props
<TaxbitQuestionnaire/> propsThe primary component for collecting tax documentation. Import it from @taxbit/react-sdk and render it in your React application.
In 7.x, bearerToken, questionnaire, data, dryRun and the callbacks are top-level props. Every other setting goes in config, in the table after this one. A 6.x prop left at the top level is ignored; the console names each one once on mount, with where it moved. See the Upgrade guide.
<TaxbitQuestionnaire
bearerToken={token}
questionnaire="W-FORM"
config={{
wForm: { fatca: true, realTimeTinValidation: true },
rules: { adaptiveMode: 'skipLock', minimumAge: 18 },
locale: { language: 'en-us', dateFormat: 'mdy' },
display: { poweredByTaxbit: true },
connection: { region: 'US' },
}}
onSuccess={(data) => {}}
/>| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token for API communication. Optional on a dry run. |
questionnaire | required 'W-FORM' | 'DPS' | 'SELF-CERT'Which questionnaire to render. See Pick your questionnaire for guidance on choosing. |
config | optional QuestionnaireConfigEvery other setting, in groups: wForm, rules, locale, display and connection, plus prepopulateWithSavedData, documentDownload and telemetry. Every group and every setting in it is optional. See the config table below. |
data | optional ClientTaxDocumentationPre-collected data to populate form fields. Overrides server-fetched data if both exist. |
dryRun | optional booleanDefault false. Runs the questionnaire without storing anything. Without a bearerToken the IRS checks are simulated; with one, they run against Taxbit and nothing is stored. onSubmit receives the document. Replaces 6.x's demoMode. |
onError | optional (error: Error, data?: ClientTaxDocumentation) => voidCalled when a request to Taxbit fails, including a failed submission, when onSubmit rejects, or when a component fails to draw. Also receives the answers so far. A failed submission keeps the form and answers on screen and shows "Your Tax Documentation could not be saved. Please try again." above Submit, so the user can retry. |
onProgress | optional (progress: Progress, data: ClientTaxDocumentation) => voidCalled when the page shown changes. Receives a Progress object and the answers so far. |
onSettled | optional (data: ClientTaxDocumentation) => voidCalled after onSuccess or onError, or after a dry run's onSubmit. |
onSubmit | optional (data: SignedClientTaxDocumentation, files: Record<string, File>) => void | Promise<void>Called when the user submits, with the signed document and any files, before anything is stored. Waited for; a rejection stops the submit. Use onSuccess to act on a stored submission. |
onSuccess | optional (data: ClientTaxDocumentation) => voidCalled after Taxbit stores the submission. Without it, the questionnaire shows its finished screen. |
config settings
| Setting | Description |
|---|---|
config.connection.proxyDomain | optional stringRoutes every request through your own proxy instead of directly to Taxbit. Can't be combined with region. Was proxyDomain. |
config.connection.proxyHeaders | optional Record<string, string>Extra headers on proxied requests. Your proxy must strip them. authorization and content-type are reserved and overwritten. Was proxyHeaders. |
config.connection.region | optional 'US' | 'EU'Default 'US'. Routes SDK API requests to the selected Taxbit region. Was region. |
config.connection.staging | optional booleanDefault false. Sends requests to Taxbit's staging environment. |
config.display.poweredByTaxbit | optional booleanDefault false. When true, shows "Powered by Taxbit" at the bottom of the form. Was poweredByTaxbit. |
config.display.screens | optional { loading?, error?, finished? }Your own whole screens, each a component given { screenKey, text: { label, sublabel } }. loading shows while the status, saved documentation and language load (by default, "Retrieving interview status..."); error when the questionnaire can't load or a component fails to draw; finished once the document is stored and there's no onSuccess. loading replaces 6.x's loadingComponent. |
config.display.text | optional { loading?, error? }Changes only the words of the loading and error screens, each { label, sublabel }. The error screen's sublabel is otherwise the failure's message. |
config.documentDownload | optional booleanDefault false. Once the document is stored, shows a screen with a button that downloads the PDF the user signed. Not available for DPS, which has no document. A dry run stores nothing, so it doesn't show the screen. |
config.locale.dateFormat | optional 'mdy' | 'dmy' | 'ymd'Default 'mdy'. Order of date-of-birth select inputs when displayed. Was dateFormat. |
config.locale.language | optional stringDefault 'en-us' (W-FORM), 'en-gb' (DPS, SELF-CERT). Pre-selects the form language. See supported languages. Was language. |
config.prepopulateWithSavedData | optional booleanDefault true. When true, the SDK fetches the account owner's prior submission on mount, prefills the form, and routes returning users to the summary. Set to false to skip that fetch. Was prepopulateWithSavedData. |
config.rules.adaptiveMode | optional 'full' | 'skipLock' | 'skipEdit'Default 'full'. How prefilled answers are used. full: nothing hidden; answers filled in. skipLock: questions with valid answers are hidden and locked on the summary. skipEdit: questions with valid answers are hidden, and everything stays editable on the summary. A disregarded entity is asked every question under every mode. See Adaptive mode. Was adaptiveMode. |
config.rules.minimumAge | optional numberRefuses a date of birth under this age ("Must be 21 or older") for the account holder, a regarded owner and each controlling person, and limits the birth years the picker offers. |
config.telemetry | optional booleanDefault true. Sends usage events (steps shown, button presses, validation errors shown, real-time check outcomes; never what the user typed) to telemetry/events with the same token and host as other requests. false sends nothing; nothing is sent without a bearerToken. See Usage telemetry. Was telemetry. |
config.wForm.eDeliveryConsent | optional booleanDefault false. W-FORM only (W-9 and every W-8). Adds a checkbox to the Review and Sign section of the summary asking the account owner to consent to receiving their tax forms electronically. The answer is submitted as hasEDeliveryConsent. Was eDeliveryConsent. |
config.wForm.fatca | optional booleanDefault false. W-FORM only. Enables FATCA (Chapter 4) collection. Forced to true when typesOfIncome includes INTEREST or DIVIDENDS. See Enable FATCA collection. Was fatca. |
config.wForm.realTimeTinValidation | optional booleanDefault false. W-FORM only (W-9). Validates the account owner's name and TIN against the IRS in real time. Requires RTT configuration. Was realTimeTinValidation. |
config.wForm.treatyClaims | optional booleanDefault false. W-FORM only (W-8 flows). Enables treaty claim questions in W-8BEN and W-8BEN-E flows. Was treatyClaims. |
config.wForm.typesOfIncome | required if config.wForm.treatyClaims TypeOfIncome | string | (TypeOfIncome | string)[]W-FORM only. Income types the filer's account can generate. Drives treaty-eligibility filtering. See Accepted values. Was typesOfIncome. |
| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token for API communication. Not required when demoMode is true. |
questionnaire | required 'W-FORM' | 'DPS' | 'SELF-CERT'Which questionnaire to render. See Pick your questionnaire for guidance on choosing. |
adaptiveMode | optional 'full' | 'skipLock' | 'skipEdit'Default 'full'. How prefilled answers are used. full (default): nothing hidden; answers filled in. skipLock: questions with valid answers are hidden and locked on the summary. skipEdit: questions with valid answers are hidden, and everything stays editable on the summary. See Adaptive mode. |
data | optional ClientTaxDocumentationPre-collected data to populate form fields. Overrides server-fetched data if both exist. |
dateFormat | optional 'mdy' | 'dmy' | 'ymd'Default 'mdy'. Order of date-of-birth select inputs when displayed. |
demoMode | optional booleanDefault false. Renders the form without server communication. No bearer token required. Only onProgress and onSubmit apply in demo mode. See Set up locally. |
eDeliveryConsent | optional booleanDefault false. Available in 6.3.0 and later. W-FORM only (W-9 and every W-8). Adds a checkbox to the Review and Sign section of the summary asking the account owner to consent to receiving their tax forms electronically. The label holds the full consent statement. The box starts checked, is never required, and is never pre-filled from a prior submission. The answer is submitted as hasEDeliveryConsent (true checked, false cleared, absent when this prop is off), and config.eDeliveryConsent records whether consent was collected. |
fatca | optional booleanDefault false. W-FORM only. Enables FATCA (Chapter 4) collection: classification, certifications, GIIN capture, and substantial US owner collection where applicable. Forced to true when typesOfIncome includes INTEREST or DIVIDENDS — setting fatca={false} in that case throws at initialization. See Enable FATCA collection. |
language | optional stringDefault 'en-us' (W-FORM), 'en-gb' (DPS, SELF-CERT). Pre-selects the form language. See supported languages. |
loadingComponent | optional ReactNodeDefault text "Retrieving interview status...". Shown while the SDK fetches status and the first language, and when rendered on the server. |
onError | optional (error: Error) => voidDefault: logs to console. Called when the API returns an error. If omitted, the error is logged to the console and shown in the SDK's error alert — not rethrown. From 6.3.0, a failed submission keeps the form and answers on screen and shows "Your Tax Documentation could not be saved. Please try again." above Submit, so the user can retry; onError still receives the error. Not called for telemetry failures. Fires once per event, so an inline function is fine. |
onProgress | optional (progress: Progress) => voidCalled when the user navigates (Next, Back, Cancel, Submit). Receives a Progress object. Fires once per event, so an inline function is fine. |
onSettled | optional (data: ClientTaxDocumentation) => voidCalled after either onSuccess or onError. |
onSubmit | optional (data: ClientTaxDocumentation) => voidCalled after the form passes client-side validation, before the API request completes. Fires whether or not the save succeeds; use onSuccess to act on a saved submission. From 6.3.0, accountHolder.phoneNumber is in E.164 form (+447872615090), and hasEDeliveryConsent is included when eDeliveryConsent is on. |
onSuccess | optional (data: ClientTaxDocumentation) => voidCalled after the API confirms successful submission. |
poweredByTaxbit | optional booleanDefault false. When true, shows "Powered by Taxbit" at the bottom of the form. |
prepopulateWithSavedData | optional booleanDefault true. When true (default), the SDK fetches the account owner's prior submission on mount, prefills the form, and routes returning users to the summary. Set to false to skip that fetch — no saved PII is requested on mount and the form starts on step one. Does not affect host-supplied data, status reads, or submission. See Skip server-side prefill. |
proxyDomain | optional stringRoutes every request through your own proxy instead of directly to Taxbit. Can't be combined with region. |
proxyHeaders | optional Record<string, string>Extra headers on proxied requests. Your proxy must strip them. authorization and content-type are reserved and overwritten. |
realTimeTinValidation | optional booleanDefault false. W-FORM only (W-9). Validates the account owner's name and TIN against the IRS in real time. The account owner can still proceed if no match. Requires RTT configuration. In demo mode, TINs containing 0 return valid, 6 return invalid, otherwise pending. |
region | optional 'US' | 'EU'Default 'US'. Routes SDK API requests to the selected Taxbit region. |
telemetry | optional booleanDefault true. Available in 6.2.0 and later. Sends usage events (steps shown, button presses, validation errors shown, real-time check outcomes; never what the user typed) to telemetry/events with the same token and host as other requests. Failed events never interrupt the form. false sends nothing; demo mode sends nothing. See Usage telemetry. |
treatyClaims | optional booleanDefault false. W-FORM only (W-8 flows). Set to true if your clients are foreign persons claiming reduced US withholding rates under an income tax treaty. Enables treaty claim questions in W-8BEN and W-8BEN-E flows. Omit to skip treaty claims entirely. |
typesOfIncome | required if treatyClaims TypeOfIncome | string | (TypeOfIncome | string)[]W-FORM only. Income types the filer's account can generate. Drives treaty-eligibility filtering. Accepts hyphenated ( 'royalties-other') or underscored ('ROYALTIES_OTHER') forms. Unrecognized values throw at initialization. Some values (INTEREST, DIVIDENDS) also force fatca={true}. See Accepted values for the full list. |
Not in 5.x: telemetry (added in 6.2.0) and eDeliveryConsent (added in 6.3.0).
| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token for API communication. Not required when demoMode is true. |
questionnaire | required 'W-FORM' | 'DPS' | 'SELF-CERT'Which questionnaire to render. See Pick your questionnaire for guidance on choosing. |
adaptiveMode | optional 'full' | 'skipLock' | 'skipEdit'Default 'full'. How prefilled answers are used. full (default): nothing hidden; answers filled in. skipLock: questions with valid answers are hidden and locked on the summary. skipEdit: questions with valid answers are hidden, and everything stays editable on the summary. See Adaptive mode. |
data | optional ClientTaxDocumentationPre-collected data to populate form fields. Overrides server-fetched data if both exist. |
dateFormat | optional 'mdy' | 'dmy' | 'ymd'Default 'mdy'. Order of date-of-birth select inputs when displayed. |
demoMode | optional booleanDefault false. Renders the form without server communication. No bearer token required. Only onProgress and onSubmit apply in demo mode. See Set up locally. |
fatca | optional booleanDefault false. W-FORM only. Enables FATCA (Chapter 4) collection: classification, certifications, GIIN capture, and substantial US owner collection where applicable. Forced to true when typesOfIncome includes INTEREST or DIVIDENDS — setting fatca={false} in that case throws at initialization. See Enable FATCA collection. |
language | optional stringDefault 'en-us' (W-FORM), 'en-gb' (DPS, SELF-CERT). Pre-selects the form language. See supported languages. |
loadingComponent | optional ReactNodeDefault text "Retrieving interview status...". Shown while the SDK fetches status. |
onError | optional (error: Error) => voidDefault: logs to console. Called when the API returns an error. If omitted, the error is logged to the console and shown in the SDK's error alert — not rethrown. A failed submission replaces the form with the error, and the user's answers are lost. Wrap it in useCallback: an inline function that sets state can cause a render loop. |
onProgress | optional (progress: Progress) => voidCalled when the user navigates (Next, Back, Cancel, Submit). Receives a Progress object. Wrap it in useCallback: an inline function that sets state can cause a render loop. |
onSettled | optional (data: ClientTaxDocumentation) => voidCalled after either onSuccess or onError. |
onSubmit | optional (data: ClientTaxDocumentation) => voidCalled after the form passes client-side validation, before the API request completes. Fires whether or not the save succeeds; use onSuccess to act on a saved submission. |
onSuccess | optional (data: ClientTaxDocumentation) => voidCalled after the API confirms successful submission. |
poweredByTaxbit | optional booleanDefault false. When true, shows "Powered by Taxbit" at the bottom of the form. |
prepopulateWithSavedData | optional booleanDefault true. When true (default), the SDK fetches the account owner's prior submission on mount, prefills the form, and routes returning users to the summary. Set to false to skip that fetch — no saved PII is requested on mount and the form starts on step one. Does not affect host-supplied data, status reads, or submission. See Skip server-side prefill. |
proxyDomain | optional stringRoutes every request through your own proxy instead of directly to Taxbit. Can't be combined with region. |
proxyHeaders | optional Record<string, string>Extra headers on proxied requests. Your proxy must strip them. authorization and content-type are reserved and overwritten. |
realTimeTinValidation | optional booleanDefault false. W-FORM only (W-9). Validates the account owner's name and TIN against the IRS in real time. The account owner can still proceed if no match. Requires RTT configuration. In demo mode, TINs containing 0 return valid, 6 return invalid, otherwise pending. |
region | optional 'US' | 'EU'Default 'US'. Routes SDK API requests to the selected Taxbit region. |
treatyClaims | optional booleanDefault false. W-FORM only (W-8 flows). Set to true if your clients are foreign persons claiming reduced US withholding rates under an income tax treaty. Enables treaty claim questions in W-8BEN and W-8BEN-E flows. Omit to skip treaty claims entirely. |
typesOfIncome | required if treatyClaims TypeOfIncome | string | (TypeOfIncome | string)[]W-FORM only. Income types the filer's account can generate. Drives treaty-eligibility filtering. Accepts hyphenated ( 'royalties-other') or underscored ('ROYALTIES_OTHER') forms. Unrecognized values throw at initialization. Some values (INTEREST, DIVIDENDS) also force fatca={true}. See Accepted values for the full list. |
Not in 4.x: fatca and typesOfIncome (added in 5.0.0), telemetry (6.2.0) and eDeliveryConsent (6.3.0).
| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token for API communication. Not required when demoMode is true. |
questionnaire | required 'W-FORM' | 'DPS' | 'SELF-CERT'Which questionnaire to render. See Pick your questionnaire for guidance on choosing. |
adaptiveMode | optional 'full' | 'skipLock' | 'skipEdit'Default 'full'. How prefilled answers are used. full (default): nothing hidden; answers filled in. skipLock: questions with valid answers are hidden and locked on the summary. skipEdit: questions with valid answers are hidden, and everything stays editable on the summary. See Adaptive mode. |
data | optional ClientTaxDocumentationPre-collected data to populate form fields. Overrides server-fetched data if both exist. |
dateFormat | optional 'mdy' | 'dmy' | 'ymd'Default 'mdy'. Order of date-of-birth select inputs when displayed. |
demoMode | optional booleanDefault false. Renders the form without server communication. No bearer token required. Only onProgress and onSubmit apply in demo mode. See Set up locally. |
language | optional stringDefault 'en-us' (W-FORM), 'en-gb' (DPS, SELF-CERT). Pre-selects the form language. See supported languages. |
loadingComponent | optional ReactNodeDefault text "Retrieving interview status...". Shown while the SDK fetches status. |
onError | optional (error: Error) => voidDefault: logs to console. Called when the API returns an error. If omitted, the error is logged to the console and shown in the SDK's error alert — not rethrown. A failed submission replaces the form with the error, and the user's answers are lost. Wrap it in useCallback: an inline function that sets state can cause a render loop. |
onProgress | optional (progress: Progress) => voidCalled when the user navigates (Next, Back, Cancel, Submit). Receives a Progress object. Wrap it in useCallback: an inline function that sets state can cause a render loop. |
onSettled | optional (data: ClientTaxDocumentation) => voidCalled after either onSuccess or onError. |
onSubmit | optional (data: ClientTaxDocumentation) => voidCalled after the form passes client-side validation, before the API request completes. Fires whether or not the save succeeds; use onSuccess to act on a saved submission. |
onSuccess | optional (data: ClientTaxDocumentation) => voidCalled after the API confirms successful submission. |
poweredByTaxbit | optional booleanDefault false. When true, shows "Powered by Taxbit" at the bottom of the form. |
prepopulateWithSavedData | optional booleanDefault true. When true (default), the SDK fetches the account owner's prior submission on mount, prefills the form, and routes returning users to the summary. Set to false to skip that fetch — no saved PII is requested on mount and the form starts on step one. Does not affect host-supplied data, status reads, or submission. See Skip server-side prefill. |
proxyDomain | optional stringRoutes every request through your own proxy instead of directly to Taxbit. Can't be combined with region. |
proxyHeaders | optional Record<string, string>Extra headers on proxied requests. Your proxy must strip them. authorization and content-type are reserved and overwritten. |
realTimeTinValidation | optional booleanDefault false. W-FORM only (W-9). Validates the account owner's name and TIN against the IRS in real time. The account owner can still proceed if no match. Requires RTT configuration. In demo mode, TINs containing 0 return valid, 6 return invalid, otherwise pending. |
region | optional 'US' | 'EU'Default 'US'. Routes SDK API requests to the selected Taxbit region. |
treatyClaims | optional booleanDefault false. W-FORM only (W-8 flows). Set to true if your clients are foreign persons claiming reduced US withholding rates under an income tax treaty. Enables treaty claim questions in W-8BEN and W-8BEN-E flows. Omit to skip treaty claims entirely. |
Resubmission behavior
On mount the component fetches any prior submission for the questionnaire type and adapts:
| Previous status | Behavior |
|---|---|
COMPLETE | Shows the summary screen immediately for review/edit. |
INCOMPLETE, prior submission exists | Walks each screen with prior data pre-filled (e.g. earlier validation failure or changed requirements). |
INCOMPLETE, no prior submission | Walks each screen from the start; nothing to pre-fill. |
data prop + server data | The data prop wins. |
Partial progress is not saved. The SDK persists only on submit — closing or navigating away mid-flow discards entries and leaves dataCollectionStatus unchanged. The server sets INCOMPLETE when a submission fails validation or previously valid data no longer meets requirements, not on an abandoned session. Use statusData.needsResubmission as the canonical signal to route a user back through.
<TaxbitCuringDocumentation/> props
<TaxbitCuringDocumentation/> propsA focused component that clears specific W-8 validation issues in place. Import it from @taxbit/react-sdk. For the full embedding walkthrough, see the Curing integration guide.
import '@taxbit/react-sdk/style/inline.css';
import { TaxbitCuringDocumentation } from '@taxbit/react-sdk';One prop shape. A dry run replaces 6.x's demo mode, and every setting other than the token, the dry run and the callbacks goes in config, in the questionnaire's groups. A 6.x prop left at the top level is ignored; the console names each one once on mount, with where it moved.
| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token. Same token used by <TaxbitQuestionnaire />. Optional on a dry run. |
collectSignatureName | optional booleanDefault false. Shows an editable signature-name field instead of reading the name from the submitted W-Form (accountHolder.name). Use it when there's no submitted W-Form to read. |
config | optional CuringDocumentationConfigThe questionnaire's locale, display and connection groups. See the config table below. |
dryRun | optional true | { issueTypes?, accountOwnerType? }Reads no status and stores nothing. issueTypes (CurableIssueType[]) lists the issues to cure; none by default. accountOwnerType ('INDIVIDUAL' | 'ENTITY' | 'INTERMEDIARY', default 'ENTITY') picks the W-8 being cured; use 'INDIVIDUAL' for the W-8BEN reasonable-explanation flow. Replaces 6.x's demoIssueTypes. |
onError | optional (error: Error, submission?: ClientCuringSubmission) => voidFires when the status can't be read, the store fails, onSubmit rejects, or the widget fails to draw; with the curing documentation once there is some. |
onSettled | optional (submission: ClientCuringSubmission) => voidFires after onSuccess or onError, or after a dry run's onSubmit. |
onSubmit | optional (submission: ClientCuringSubmission, file?: File) => void | Promise<void>Fires when the user submits, with the file they chose, before anything is stored. Waited for; a rejection stops the submit. |
onSuccess | optional (submission: ClientCuringSubmission) => voidFires after the server stores the curing documentation. Not when the cure is reviewed. A dry run stores nothing, so it isn't called. |
config settings
| Setting | Description |
|---|---|
config.connection.proxyDomain | optional stringRoutes API requests through your own proxy instead of Taxbit directly. Can't be combined with region. Was proxyDomain. |
config.connection.proxyHeaders | optional Record<string, string>Custom headers on proxied requests; authorization and content-type are reserved. Was proxyHeaders. |
config.connection.region | optional 'US' | 'EU'Default 'US'. Regional server for API requests. Was region. |
config.connection.staging | optional booleanDefault false. Sends requests to Taxbit's staging environment. |
config.display.poweredByTaxbit | optional booleanDefault false. Renders the "Powered by Taxbit" footer. Was poweredByTaxbit. |
config.display.screens | optional { loading?, error? }Your own loading and error screens, each a component given { screenKey, text: { label, sublabel } }. loading replaces 6.x's loadingComponent. |
config.display.text | optional { loading?, error? }Changes only the words of the loading and error screens, each { label, sublabel }. |
config.locale.language | optional LocaleDefault en-us. Pre-selects the form language. Was language. |
From 7.0, the reasonable-explanation section applies only to individual W-8BEN filers with a U.S.-indicia issue. W-8BEN-E and W-8IMY filers cure the same issue with documentary evidence alone.
The component accepts one of three prop shapes. Exactly one applies per call site.
Common to all shapes
| Prop | Description |
|---|---|
language | optional LocaleDefault en-us. Pre-selects the form language. |
poweredByTaxbit | optional booleanDefault false. Renders the "Powered by Taxbit" footer. |
Demo mode
Renders against a synthesized issue list. No network calls, no token.
| Prop | Description |
|---|---|
demoIssueTypes | required CurableIssueType[]Open issues to render. Status is assumed OPEN. Doc type is fixed to W-8BEN-E. |
onSubmit | optional (submission: ClientCuringSubmission) => voidFires when the user submits. Receives the canonical submission shape. |
Production — region (default)
| Prop | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token. Same token used by <TaxbitQuestionnaire />. |
loadingComponent | optional ReactNodeDefault null. Shown during the initial status fetch and the first language download. |
onError | optional (error: Error) => voidDefault: logs to console. Fires on status-fetch or submission error. |
onSettled | optional (submission: ClientCuringSubmission) => voidFires after onSuccess or onError, with the same payload. |
onSuccess | optional (submission: ClientCuringSubmission) => voidFires after the server accepts the multipart POST. Not when the cure is reviewed. |
region | optional 'US' | 'EU'Default 'US'. Regional server for API requests. |
Production — through a proxy
Same as region, with region replaced by:
| Prop | Description |
|---|---|
proxyDomain | required stringRoute API requests through your own proxy instead of Taxbit directly. |
proxyHeaders | optional Record<string, string>Custom headers on proxied requests; authorization and content-type are reserved. |
Mount-time behavior
On mount, the component fetches statusData for the user and derives the curable issue list. The widget renders null and emits a dev-mode warning if no OPEN curable issue exists. Gate the mount on useTaxbit().needsCuringDocumentation to avoid the round-trip.
<TaxbitTaxResidencies/> props
<TaxbitTaxResidencies/> propsA single page that collects an individual's tax residences and hands them back to you. Nothing is stored, so it needs no token. Use it when you collect residences inside your own flow and submit them yourself.
import { TaxbitTaxResidencies } from '@taxbit/react-sdk';
<TaxbitTaxResidencies
data={[{ country: 'GB' }]}
onSubmit={(residences) => saveResidences(residences)}
/>The props are the same in every version; they don't use config.
| Prop | Description |
|---|---|
onSubmit | required (data: ClientTaxResidency[]) => voidCalled with the residences the user entered when they press Submit. |
data | optional ClientTaxResidency[]Residences to start from. A first country passed in can't be changed. |
language | optional LocaleDefault 'en-gb'. Pre-selects the form language. |
poweredByTaxbit | optional booleanDefault false. Shows "Powered by Taxbit" under the form. |
In 7.x the form's class is taxbit-form-account-holder-tax-residences-section (6.x and earlier: taxbit-form-standalone-residencies), so update any CSS that targets the old class. Submit also stays enabled before a residence is entered, and says one is needed when pressed.
useTaxbit hook
useTaxbit hookRead a user's tax documentation status and data without rendering the form, and generate the completed document PDF. Use it to drive your own UI — for example, to decide whether to route someone into <TaxbitQuestionnaire/> or to show a "documentation complete" state.
Unlike the component, the hook has no demo mode or dry run: a valid bearerToken is always required. The hooks take flat parameters in 7.x too; they don't use config.
Just need the PDF after submit? In 7.x,config.documentDownloadon<TaxbitQuestionnaire/>shows a download button once the document is stored, with no hook code.
Parameters
| Parameter | Description |
|---|---|
bearerToken | required stringAccount Owner–scoped token. |
questionnaire | required 'W-FORM' | 'DPS' | 'SELF-CERT'Which questionnaire's data to access. |
onError | optional (error: Error) => voidError handler. If omitted, errors log to the console. |
prepopulateWithSavedData | optional booleanDefault true. Available in 4.1.0 and later. false skips fetching the prior submission; serverData stays empty. |
proxyDomain | optional stringRoute requests through your own proxy. |
proxyHeaders | optional Record<string, string>Custom headers on proxied requests. |
region | optional 'US' | 'EU'Default 'US'. Regional server for API requests. |
Returns
| Return | Description |
|---|---|
canGetDocumentUrl | booleantrue once a W-Form or Self-Cert submission is COMPLETE (false while in progress). Always false for DPS (no PDF). |
documentUrl | string | undefinedTemporary PDF URL; the hook re-polls about every 4 minutes to keep it fresh. |
error | Error | undefinedSet on a fetch or bearer-token error; logged unless you pass onError. |
generateDocumentUrl | () => voidTriggers PDF URL generation. |
isGeneratingDocumentUrl | booleantrue between the call and the URL being ready. |
isLoading | booleantrue while the status fetch is in flight. Check before reading needsCuringDocumentation to avoid a flash of "no curing needed." |
needsCuringDocumentation | booleantrue when the user has at least one OPEN W-Form issue the curing flow can resolve. Gate the <TaxbitCuringDocumentation /> mount on this. |
refresh | () => Promise<void>Re-fetches status + submission. Resolves when both settle. Useful after a curing submit so derived state reflects the latest server view. |
refreshStatus | () => Promise<void>Re-fetches status only. Drives needsCuringDocumentation. |
refreshSubmission | () => Promise<void>Re-fetches submission only. Drives serverData. |
serverData | ClientTaxDocumentation | undefinedLast submitted data ( GET /tax-documentation/submissions). Empty object when prepopulateWithSavedData={false}. |
statusData | ClientTaxDocumentationStatus | undefinedStatus for this Account Owner ( GET /tax-documentation-status). |
useTaxbitStatus hook
useTaxbitStatus hookAvailable in 5.0.0 and later; 4.x does not export it. A status-only version of useTaxbit. It never fetches the prior submission, so no previously submitted personal data reaches the browser. Use it when you only need to know whether the user must act, for example to decide whether to show <TaxbitCuringDocumentation />.
import { useTaxbitStatus } from '@taxbit/react-sdk';
const { needsCuringDocumentation, isLoading } = useTaxbitStatus({ bearerToken });Parameters: bearerToken, onError, and region or proxyDomain + proxyHeaders, as for useTaxbit. It takes no questionnaire; the status covers every questionnaire.
Returns
| Return | Description |
|---|---|
error | Error | undefinedSet on a fetch or bearer-token error. |
isLoading | booleantrue while the status fetch is in flight. |
needsCuringDocumentation | booleantrue when there's at least one OPEN curable W-8 issue. |
refreshStatus | () => Promise<void>Re-fetches the status. Resolves when the fetch settles. |
statusData | ClientTaxDocumentationStatus | undefinedStatus for this Account Owner. |
Types
The TypeScript shapes referenced in the props and hook tables above. The SDK exports these, so you can import them for your own typing.
TaxbitScreenProps
7.x only. What a component you pass in config.display.screens receives. One component can draw every screen; screenKey says which one is being drawn.
type TaxbitScreenProps = {
screenKey: 'loading' | 'error' | 'finished';
text: { label: string; sublabel?: string }; // in the session's language
};const Screen = ({ screenKey, text }) => (
<div className={`my-screen my-screen--${screenKey}`}>
<p>{text.label}</p>
{text.sublabel && <p>{text.sublabel}</p>}
</div>
);
<TaxbitQuestionnaire
questionnaire="W-FORM"
bearerToken={token}
config={{ display: { screens: { loading: Screen, error: Screen } } }}
/><TaxbitCuringDocumentation/> takes loading and error screens only.
Submission fields added in 7.x
The document passed to onSubmit, and stored, can also carry these fields on the account holder or regarded owner:
| Field | Description |
|---|---|
usTinIsValid | optional booleantrue when the user confirmed a U.S. TIN the IRS check couldn't match. Pass it back in data to keep the confirmation. |
giinIsValid | optional booleantrue when the user confirmed a GIIN the IRS check couldn't match. Pass it back in data to keep the confirmation. |
passiveNffeUsSubstantialOwner | optional booleanA Passive NFFE's answer to "Does this Passive NFFE have substantial U.S. owners?": true when it has them, false when it doesn't. On the regarded owner when the regarded owner is the Passive NFFE. Before 7.x only the substantialUsOwners list showed the answer. |
7.x also submits a U.S. ZIP and a Canadian postal code without the dash or space (627011234, K1A0B1), as it already did for a TIN.
Progress
In 7.x, Progress also carries the page's level, pageKey, pageIndex, pageCount and title, and stepTitle is the step's heading as the page shows it, which can differ from 6.x's on steps whose heading follows the answers.
The object passed to your onProgress callback on every navigation event (Next, Back, Cancel, Submit). Use it to track where the user is in the flow.
type Progress = {
language: Locale;
percentComplete: number;
stepId: StepId;
stepIndex: number; // 0-based
stepNumber: number; // 1-based
stepTitle: string; // localized
steps: StepId[];
totalSteps: number;
};Common StepId values — the active sequence depends on the questionnaire and flow (Progress.steps lists what's actually shown).
| StepId | Appears in | Notes |
|---|---|---|
accountHolderClassification | All | |
accountHolderContactInformation | All | |
accountHolderTaxInformation | All | |
accountHolderTaxResidenciesConfirmation | SELF-CERT | Tax residences in high-risk jurisdictions. |
accountHolderCertifications | W-FORM | |
accountHolderTreatyClaims | W-FORM | W-8 treaty flows. |
accountHolderUsTinValidation | W-FORM | When real-time TIN validation runs. |
accountHolderAdditionalInfo | W-FORM | |
exemptions | W-FORM | |
regardedOwnerCertifications | W-FORM | Disregarded-entity (DRE) flows only. |
regardedOwnerContactInformation | W-FORM | DRE flows only. |
regardedOwnerTaxInformation | W-FORM | DRE flows only. |
regardedOwnerTreatyClaims | W-FORM | DRE flows only. |
regardedOwnerUsTinValidation | W-FORM | DRE flows only. |
substantialUsOwners | W-FORM | Passive NFFEs with substantial U.S. owners (FATCA). 5.x and later. |
confirmation | W-FORM | 6.x and earlier. No 7.x flow shows it. |
summary | All |
ClientTaxDocumentationStatus
Returned by useTaxbit().statusData. Each questionnaire key is undefined until data is submitted for that type.
type ClientTaxDocumentationStatus = {
dpsQuestionnaire?: {
dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
expirationDate?: string; // 3 years after last submission
needsResubmission?: boolean;
vatStatus?: VatStatus;
vatValidationDate?: string;
};
wFormQuestionnaire?: {
dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
type: 'W-9' | 'W-8BEN' | 'W-8BEN-E' | 'W-8IMY';
expirationDate?: string;
issues?: QuestionnaireIssue[];
needsResubmission?: boolean;
tinStatus?: TinStatus;
tinValidationDate?: string;
treatyClaimStatus?: 'VALID' | 'INVALID';
};
selfCertification?: {
dataCollectionStatus: 'COMPLETE' | 'INCOMPLETE';
issues?: QuestionnaireIssue[];
needsResubmission?: boolean;
};
};Curing types
Types used by <TaxbitCuringDocumentation/> and the curing read flow. See Reading curing statuses for how these surface in practice.
CurableIssueType
type CurableIssueType =
| 'US_INDICIA'
| 'TREATY_COUNTRY_MISMATCH'
| 'CARE_OF_PERMANENT_ADDRESS'
| 'PO_BOX_PERMANENT_ADDRESS';Which doc types each applies to:
| Issue type | W-8BEN | W-8BEN-E | W-8IMY |
|---|---|---|---|
US_INDICIA | ✓ | ✓ | ✓ |
TREATY_COUNTRY_MISMATCH | ✓ | ✓ | — |
CARE_OF_PERMANENT_ADDRESS | — | ✓ | ✓ |
PO_BOX_PERMANENT_ADDRESS | — | ✓ | ✓ |
ReasonableExplanationType
type ReasonableExplanationType =
| 'STUDENT'
| 'TEACHER_OR_TRAINEE'
| 'DIPLOMAT'
| 'SPOUSE_OR_CHILD'
| 'DO_NOT_MEET_SUBSTANTIAL_PRESENCE_TEST'
| 'CLOSER_CONNECTION_EXCEPTION';Only relevant when the user has an open US_INDICIA issue. The first four require no additional fields. DO_NOT_MEET_SUBSTANTIAL_PRESENCE_TEST adds the SPT day-count fields. CLOSER_CONNECTION_EXCEPTION adds the closer-connection fields.
ClientCuringSubmission
type ClientCuringSubmission = {
fileName?: string;
fileMimeType?: string;
reasonableExplanationData?: {
explanationType: ReasonableExplanationType;
signatureName?: string; // populated from the prior submission's accountHolder.name
signatureDate?: string; // ISO timestamp, stamped at submit
// Present only when explanationType === 'DO_NOT_MEET_SUBSTANTIAL_PRESENCE_TEST'
daysInCurrentYear?: number;
daysInFirstPrecedingYear?: number;
daysInSecondPrecedingYear?: number;
weightedTotal?: number;
// Present only when explanationType === 'CLOSER_CONNECTION_EXCEPTION'
usPresentDaysCertified?: boolean;
closerConnectionCountryCode?: string;
closerConnectionReason?: string;
};
};Same shape across demo onSubmit and production onSuccess / onSettled.
Status enums
The string values that appear on the status fields above (tinStatus, vatStatus, and questionnaire issues). Match against them to decide what to show or do next.
TinStatus
IRS TIN validation; W-9 only.
| Value | Meaning |
|---|---|
PENDING | Submitted, not yet validated. |
VALID_SSN_MATCH | SSN matches IRS records. |
VALID_EIN_MATCH | EIN matches IRS records. |
VALID_SSN_EIN_MATCH | Both SSN and EIN match. |
MISMATCH | Name/TIN doesn't match IRS records. |
TIN_NOT_ISSUED | TIN not issued by the IRS. |
INVALID_DATA | Data malformed or incomplete for validation. |
FOREIGN | Foreign TIN — not validated against IRS. |
ERROR | IRS validation errored. |
VatStatus
VIES VAT validation; DPS only.
| Value | Meaning |
|---|---|
PENDING | Submitted, not yet validated with VIES. |
VALID | VIES confirms valid for the country. |
INVALID | VIES reports invalid. |
INSUFFICIENT_DATA | Not enough data to validate. |
NOT_REQUIRED | User indicated VAT not required or not issued. |
NON_EU | User outside the EU — VAT validation does not apply. |
Issue status
The status field on a curable W-8 issue is its current remediation state ('OPEN' | 'IN_REVIEW' | 'RESOLVED'). See Reading curing statuses.
| Value | Meaning |
|---|---|
OPEN | The issue still needs to be addressed. |
IN_REVIEW | The issue is being reviewed. |
RESOLVED | The issue no longer applies. |
Transitions: OPEN → IN_REVIEW (filer submits), IN_REVIEW → RESOLVED (reviewer accepts), IN_REVIEW → OPEN (reviewer rejects / requests more). RESOLVED is terminal.
QuestionnaireIssue
Found on wFormQuestionnaire.issues and selfCertification.issues.
type QuestionnaireIssue = {
issueType: IssueType;
status: 'OPEN' | 'IN_REVIEW' | 'RESOLVED'; // present on curable W-8 issues
createdAt: string;
details: { field: string; description: string }[];
};| issueType | Applies to | Meaning |
|---|---|---|
CARE_OF_PERMANENT_ADDRESS | W-FORM | Permanent address uses a c/o format. |
PO_BOX_PERMANENT_ADDRESS | W-FORM | Permanent address is a PO Box. |
US_PERMANENT_ADDRESS | W-FORM | W-8 filer has a US permanent address. |
TREATY_COUNTRY_MISMATCH | W-FORM | Treaty claim country doesn't match residency. |
US_INDICIA | W-FORM, SELF-CERT | Indicators of US-person status detected. |
WITHHOLDING_DOCUMENTATION | W-FORM | Withholding documentation is incomplete. |
CHANGE_IN_CIRCUMSTANCES | W-FORM, SELF-CERT | A change in circumstances requires new documentation. |
INCOMPLETE_DATA | All | Missing required fields. |
INCONSISTENT_DATA | All | Contradictory information. |
INCOMPLETE_ADDRESS | W-FORM, SELF-CERT | Address information is incomplete. |
INCOMPLETE_CLASSIFICATION | W-FORM | Account holder classification is incomplete. |
INCOMPLETE_US_TIN | W-FORM | US TIN is missing or incomplete. |
INCOMPLETE_TREATY_CLAIM | W-FORM | Treaty claim information is incomplete. |
CBI_RBI_CONFIRMATION | SELF-CERT | CBI/RBI confirmation is required. |
INCOMPLETE_GIIN | SELF-CERT | GIIN is missing or incomplete. |
SDK ↔ API endpoint mapping
The SDK makes these calls for you — useful for debugging and monitoring. Every call goes to the region's API host, or to your proxyDomain when one is set.
| SDK action | API behavior | When |
|---|---|---|
| Component mounts / hook initializes | GET /tax-documentation-status | On load — checks for existing submissions. |
| Component mounts (data exists) | GET /tax-documentation/submissions | On load — fetches prior data for pre-fill. |
| Real-time TIN check | Posts the name and TIN for an inline match | When real-time TIN validation is on (config.wForm.realTimeTinValidation in 7.x, realTimeTinValidation before). |
| GIIN check | Posts the GIIN for an inline check | When FATCA collects a GIIN. |
| User submits the form | Posts form data to the submission endpoint | On a valid submit. In 7.x, after onSubmit resolves, and not in a dry run. |
| Usage telemetry | Posts usage events | 6.2.0+, unless telemetry is off (config.telemetry: false in 7.x, telemetry={false} in 6.x) or there's no token (6.x demo mode). Failures are ignored. |
generateDocumentUrl() request | Posts a generate-document request; returns a documentId (PROCESSING) | When you call it. |
generateDocumentUrl() polling | Polls (~3s) until FINISHED and a URL is available | Automatic after the request. |
The documentUrl is short-lived; the hook re-polls about every 4 minutes to refresh it before it expires.
Curing makes these calls. It sends no usage telemetry:
| SDK action | API behavior | When |
|---|---|---|
| Component mounts | GET /tax-documentation-status | On load — checks for OPEN curable issues. |
| Component mounts | GET /tax-documentation/submissions | On load — reads the prior W-8 for the signature name. Skipped when collectSignatureName is true. |
| User clicks Submit | POST /account-owner-documents (multipart) | On submit. data part is the snake_case wire body; the uploaded file is the second multipart part. |
Content-Type is left to fetch so the multipart boundary survives — don't override it.
Stylesheets
The form is semantic HTML with taxbit- namespaced classes. Import at most one built-in stylesheet, then override classes in your own CSS.
| Stylesheet | Label position | Description |
|---|---|---|
inline.css | beside the input | Full Taxbit default styling — layout, inputs, buttons, badges. |
basic.css | above the input | Same as inline.css, with each label on its own line above the field. |
minimal.css | your choice | Structure only — form width, field spacing, status colors. Best base when you intend to restyle. |
index.css | — | Demo-app stylesheet. Styles :root and html, so it affects your whole page. Not for production. |
Same as 6.x, including the --taxbit-color-* tokens and taxbit-required on required rows. basic.css, inline.css and minimal.css also draw the download link (a.taxbit-button) as the primary button, and inputs and selects in basic.css and inline.css sit on white.
inline.css and basic.css declare their colors as --taxbit-color-* custom properties on :root; minimal.css declares only the four status colors. Override the tokens to theme the form.
The step actions render the primary button (Next, Submit) before Back in the DOM, inside .taxbit-primary-actions and .taxbit-secondary-actions. The required indicator is a <span class="taxbit-required-marker" aria-hidden="true"> beside the label. From 6.3.0, the row of every required question also carries taxbit-required.
No --taxbit-color-* tokens: theme the form by re-declaring .taxbit-* class rules. The required indicator is an asterisk appended to the label text, and Back renders before Next in the DOM.
Same as 5.x: stylesheets and taxbit-* class names did not change between 4.0.0 and 5.0.1.
For the token list, the full class reference and override patterns, see Customizing look and feel.
Supported languages
config.locale.language (7.x) or the language prop (6.x and earlier) accepts any tag in the Locale type — the 53 codes below. The account owner can also switch language in-form (hide the dropdown with CSS). The in-form picker shows a subset: roughly 45 in DPS and Self-Certification flows and 19 in W-Form. Defaults are en-us (W-Form) and en-gb (DPS, Self-Certification).
From 6.0.0, only the displayed language is downloaded. Switching language fetches the new one once and keeps the current one on screen until it arrives; if the fetch fails, the current language stays.
Locale tags (53)
Locale tags (53)| Code | Language | Code | Language | Code | Language |
|---|---|---|---|---|---|
bg | Bulgarian | fr | French | no | Norwegian |
cs | Czech | fr-ca | French (Canada) | pl | Polish |
da | Danish | fr-fr | French (France) | pt | Portuguese |
de | German | fr-lu | French (Luxembourg) | pt-br | Portuguese (Brazil) |
de-at | German (Austria) | ga | Irish | pt-pt | Portuguese (Portugal) |
de-de | German (Germany) | hr | Croatian | ro | Romanian |
el | Greek | hu | Hungarian | ru | Russian |
el-cy | Greek (Cyprus) | id | Indonesian | sk | Slovak |
el-gr | Greek (Greece) | it | Italian | sl | Slovenian |
en | English | ja | Japanese | sv | Swedish |
en-gb | English (UK) | ko | Korean | th | Thai |
en-nz | English (NZ) | lt | Lithuanian | tr | Turkish |
en-us | English (US) | lv | Latvian | uk | Ukrainian |
es | Spanish | ms | Malaysian | vi | Vietnamese |
es-es | Spanish (Spain) | mt | Maltese | zh | Chinese |
es-mx | Spanish (Mexico) | nl | Dutch | zh-cn | Chinese (Simplified) |
et | Estonian | nl-be | Dutch (Belgium) | zh-tw | Chinese (Traditional) |
fi | Finnish | nl-nl | Dutch (Netherlands) |
W-Form in-form options (19)
| Code | Language | Code | Language |
|---|---|---|---|
de | German | nl | Dutch |
en-us | English (US) | pl | Polish |
es-mx | Spanish (Mexico) | pt-br | Portuguese (Brazil) |
fr-ca | French (Canada) | ro | Romanian |
id | Indonesian | ru | Russian |
it | Italian | th | Thai |
ja | Japanese | tr | Turkish |
ko | Korean | vi | Vietnamese |
ms | Malaysian | zh-cn | Chinese (Simplified) |
zh-tw | Chinese (Traditional) |
Compatibility
@taxbit/react-sdk supports React 18 and 19 (declared as a peer dependency); React 16 and 17 are no longer supported. TypeScript type definitions are bundled with the package. import gets the ES build and require gets a CommonJS build; both load each language from its own file beside the entry, so if you copy the entry file by hand, copy every .js file in dist/ with it. There is no UMD build: a page that loaded it through a <script> tag needs a bundler.
@taxbit/react-sdk supports React 16 through 19 (declared as a peer dependency). TypeScript type definitions are bundled with the package — no separate @types install needed. They resolve under every moduleResolution setting, including node16 / nodenext and CommonJS require, and type-check with skipLibCheck: false. The ES build loads each language from its own file beside the entry in dist/; a bundler handles this, but if you copy the entry file by hand, copy every .js file in dist/ with it. The UMD build is one file.
@taxbit/react-sdk supports React 16 through 19 (declared as a peer dependency). TypeScript type definitions are bundled with the package. The ES build and the UMD build are each one file.
@taxbit/react-sdk supports React 16 through 19 (declared as a peer dependency). TypeScript type definitions are bundled with the package. The ES build and the UMD build are each one file.
For upgrade notes between versions, see the Upgrade guide.
Updated 2 days ago
