Component and Hook Reference

Component and hook reference

Props, hooks, types, status enums, callbacks, and CSS customization for @taxbit/react-sdk.

TaxbitQuestionnaire

The primary component for collecting tax documentation. Import it from @taxbit/react-sdk and render it in your React application.

import '@taxbit/react-sdk/style/inline.css';
import { TaxbitQuestionnaire } from '@taxbit/react-sdk';

Props

PropTypeRequiredDefaultDescription
bearerTokenstringYes*Account-owner-scoped token for API communication. Not required when demoMode is true.
questionnaire"W-FORM" | "DPS" | "SELF-CERT"YesWhich questionnaire to render. See Overview for guidance on choosing.
dataClientTaxDocumentationNoPre-collected data to populate form fields. Overrides server-fetched data if both exist. See type definition.
adaptiveMode"full" | "skipLock" | "skipEdit"No"full"Controls how previously submitted data is handled. skipLock: read-only. skipEdit: editable. See Adaptive mode.
languagestringNo"en-us" (W-FORM), "en-gb" (DPS, SELF-CERT)Pre-selects the form language. See supported languages.
treatyClaimsbooleanNofalseW-FORM only (W-8 flows). When true, enables US FDAP Income treaty claim questions in W-8BEN and W-8BEN-E flows. Omit to exclude treaty claims entirely.
realTimeTinValidationbooleanNofalseW-FORM only (W-9). Validates the user's name and TIN against the IRS in real time. User can still proceed if no match. Requires RTT configuration. In demo mode, TINs containing 0 return valid, 6 return invalid, otherwise pending.
demoModebooleanNofalseRenders the form without server communication. No bearer token required. Useful for development. See Quickstart.
region"US" | "EU"No"US"Routes SDK API requests to the selected Taxbit region.
dateFormat"mdy" | "dmy" | "ymd"No"mdy"Order of date-of-birth select inputs when displayed.
loadingComponentReactNodeNoText: "Retrieving interview status..."Custom component displayed while the SDK fetches status from the server.
poweredByTaxbitbooleanNofalseWhen true, shows "Powered by Taxbit" at the bottom of the form.
onProgress(progress: Progress) => voidNoCalled when the user navigates (Next, Back, Cancel, Submit). Receives a Progress object.
onSubmit(data: ClientTaxDocumentation) => voidNoCalled when the user clicks Submit, before the API request completes.
onSuccess(data: ClientTaxDocumentation) => voidNoCalled after the API confirms successful submission.
onError(error: Response) => voidNoThrowsCalled when the API returns an error during submission. Receives the HTTP Response object. If omitted, the error is thrown.
onSettled(data: ClientTaxDocumentation) => voidNoCalled after either onSuccess or onError.

Resubmission behavior

The component automatically fetches previously submitted data for the specified questionnaire type:

Previous statusBehavior
COMPLETEShows the summary screen immediately. The user can review and edit for resubmission.
INCOMPLETEWalks through each screen with previous data pre-filled.
Data prop + server dataThe data prop takes priority over server-fetched data.

Use statusData.needsResubmission (from the useTaxbit hook) as the canonical signal for when to send a user back through the questionnaire. See Monitoring and remediation for how to build resubmission flows.

useTaxbit hook

Access the account owner's tax documentation status, server data, and PDF generation without rendering the questionnaire UI. Unlike the TaxbitQuestionnaire component, the hook has no demoMode — a valid bearerToken is always required.

import { useTaxbit } from '@taxbit/react-sdk';

const result = useTaxbit({ bearerToken, questionnaire, onError });

Parameters

ParameterTypeRequiredDescription
bearerTokenstringYesAccount-owner-scoped bearer token.
questionnaire"W-FORM" | "DPS" | "SELF-CERT"YesWhich questionnaire's data to access.
onError(error: Error) => voidNoError handler. If omitted, errors are logged to console.

Return values

FieldTypeDescriptionSource endpoint
statusDataClientTaxDocumentationStatus | undefinedCurrent status of tax documentation for this account owner. undefined if no data submitted yet.GET /tax-documentation-status
serverDataClientTaxDocumentation | undefinedLast submitted tax documentation data. Used to pre-populate the UI.GET /tax-documentation-data
errorError | undefinedPopulated if there's an error fetching data or with the bearer token.
canGetDocumentUrlbooleantrue if the user submitted a valid W-9, W-8BEN, W-8BEN-E, W-8IMY, or SELF-CERT. DPS does not support PDF download.
generateDocumentUrl() => voidTriggers PDF URL generation. See PDF generation flow for details.
isGeneratingDocumentUrlbooleantrue after generateDocumentUrl is called and before the URL is available.
documentUrlstring | undefinedTemporary URL for the generated PDF document. Expires in 5 minutes; auto-refreshed by the hook.

TypeScript types

Progress

type Progress = {
  language: Locale;
  percentComplete: number;
  stepId: StepId;
  stepIndex: number;      // 0-based
  stepNumber: number;     // 1-based
  stepTitle: string;      // localized
  steps: StepId[];
  totalSteps: number;
};

StepId values

StepIdAppears inNotes
accountHolderClassificationAll
accountHolderContactInformationAll
accountHolderTaxInformationAll
accountHolderTaxResidenciesConfirmationSELF-CERTOnly for individuals with tax residencies in high-risk countries. Per-controlling-person variants also exist (controllingPerson1TaxResidenciesConfirmation through controllingPerson5TaxResidenciesConfirmation).
exemptionsW-FORM
regardedOwnerClassificationW-FORMDisregarded entity (DRE) flows only.
regardedOwnerContactInformationW-FORMDRE flows only.
regardedOwnerTaxInformationW-FORMDRE flows only.
confirmationW-FORM
summaryAll

ClientTaxDocumentationStatus

Returned by useTaxbit().statusData. Each questionnaire key is undefined if no data has been 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;
  };
};

Status enums

TinStatus

US TIN validation status via IRS verification. Only applies to W-9 submissions.

ValueMeaning
PENDINGTIN has been submitted but not yet validated.
VALID_SSN_MATCHSSN matches IRS records.
VALID_EIN_MATCHEIN matches IRS records.
VALID_SSN_EIN_MATCHBoth SSN and EIN match IRS records.
MISMATCHName/TIN combination does not match IRS records.
TIN_NOT_ISSUEDTIN has not been issued by the IRS.
INVALID_DATASubmitted data is malformed or incomplete for validation.
FOREIGNForeign TIN — not validated against IRS.
ERRORIRS validation encountered an error.

VatStatus

VAT number validation via the VIES system. Only applies to DPS questionnaires.

ValueMeaning
PENDINGVAT has been submitted but not yet validated with VIES.
VALIDVIES confirms the VAT number is valid for the given country.
INVALIDVIES reports the VAT number is invalid.
INSUFFICIENT_DATANot enough data to perform validation.
NOT_REQUIREDEnd user indicated VAT is not required or not issued.
NON_EUEnd user is outside the EU — VAT validation does not apply.

QuestionnaireIssue

type QuestionnaireIssue = {
  issueType: IssueType;       // see table below
  createdAt: string;
  details: IssueDetail[];    // per-field validation details
};

type IssueDetail = {
  field: string;
  description: string;
};

issueType values

issueTypeApplies toMeaning
CARE_OF_PERMANENT_ADDRESSW-FORMPermanent address uses a c/o format.
PO_BOX_PERMANENT_ADDRESSW-FORMPermanent address is a PO Box.
US_PERMANENT_ADDRESSW-FORMW-8 filer has a US permanent address.
TREATY_COUNTRY_MISMATCHW-FORMTreaty claim country doesn't match residency.
US_INDICIAW-FORM, SELF-CERTIndicators of US person status detected.
WITHHOLDING_DOCUMENTATIONW-FORMWithholding documentation is incomplete.
CHANGE_IN_CIRCUMSTANCESW-FORM, SELF-CERTA change in circumstances requires new documentation.
INCOMPLETE_DATAW-FORM, SELF-CERT, DPSSubmitted data is missing required fields.
INCONSISTENT_DATAW-FORM, SELF-CERT, DPSSubmitted data contains contradictory information.
INCOMPLETE_ADDRESSW-FORM, SELF-CERTAddress information is incomplete.
INCOMPLETE_CLASSIFICATIONW-FORMAccount holder classification is incomplete.
INCOMPLETE_US_TINW-FORMUS TIN is missing or incomplete.
INCOMPLETE_TREATY_CLAIMW-FORMTreaty claim information is incomplete.
CBI_RBI_CONFIRMATIONSELF-CERTCBI/RBI confirmation is required.
INCOMPLETE_GIINSELF-CERTGlobal Intermediary Identification Number (GIIN) is missing or incomplete.

CSS customization

The SDK renders semantic HTML with namespaced CSS classes. You can style it to match your platform using one of three built-in stylesheets, or write your own CSS targeting the same class names.

Built-in stylesheets

StylesheetImportDescription
inline.cssimport '@taxbit/react-sdk/style/inline.css';Full styling with Taxbit defaults. Best starting point for customization — use it as a reference for all available class names.
basic.cssimport '@taxbit/react-sdk/style/basic.css';Minimal structural styling. Good base when you want full control over visual design.
minimal.cssimport '@taxbit/react-sdk/style/minimal.css';Bare minimum. Use when your app's global styles should take over.

Each question and screen has its own unique class name, namespaced to prevent conflicts with your app's styles. Override any class in your own CSS file to match fonts, colors, spacing, and layout to your platform.

For examples of branded integrations, see the Adaptive mode page.

Loading component

While the SDK fetches status from the server, it displays "Retrieving interview status..." by default. Customize this with the loadingComponent prop:

<TaxbitQuestionnaire
  bearerToken={token}
  questionnaire="W-FORM"
  loadingComponent={<div>Loading...</div>}
/>

Supported languages

The language prop accepts the locale codes below. End users can also switch language via a dropdown in the UI (hideable with CSS).

DPS and Self-Certification (53 languages)

CodeLanguageCodeLanguageCodeLanguage
bgBulgarianfrFrenchnoNorwegian
csCzechfr-caFrench (Canada)plPolish
daDanishfr-frFrench (France)ptPortuguese
deGermanfr-luFrench (Luxembourg)pt-brPortuguese (Brazil)
de-atGerman (Austria)gaIrishpt-ptPortuguese (Portugal)
de-deGerman (Germany)hrCroatianroRomanian
elGreekhuHungarianruRussian
el-cyGreek (Cyprus)idIndonesianskSlovak
el-grGreek (Greece)itItalianslSlovenian
enEnglishjaJapanesesvSwedish
en-gbEnglish (UK)koKoreanthThai
en-nzEnglish (NZ)ltLithuaniantrTurkish
en-usEnglish (US)lvLatvianukUkrainian
esSpanishmsMalaysianviVietnamese
es-esSpanish (Spain)mtMaltesezhChinese
es-mxSpanish (Mexico)nlDutchzh-cnChinese (Simplified)
etEstoniannl-beDutch (Belgium)zh-twChinese (Traditional)
fiFinnishnl-nlDutch (Netherlands)

W-FORM (~20 languages)

CodeLanguageCodeLanguage
deGermannlDutch
en-usEnglish (US)plPolish
es-mxSpanish (Mexico)pt-brPortuguese (Brazil)
fr-caFrench (Canada)roRomanian
idIndonesianruRussian
itItalianthThai
jaJapanesetrTurkish
koKoreanviVietnamese
msMalaysianzh-cnChinese (Simplified)
zh-twChinese (Traditional)

SDK ↔ API endpoint mapping

The SDK makes these API calls under the hood. You don't call these directly when using the SDK, but understanding the mapping helps with debugging and monitoring.

SDK actionAPI behaviorWhen
Component mounts / hook initializesFetches tax documentation status (GET /tax-documentation-status)On load — checks for existing submissions
Component mounts (if data exists)Fetches previously submitted data (GET /tax-documentation-data)On load — fetches previous data for pre-fill
User clicks SubmitPosts form data to the tax documentation submission endpointOn submit — sends collected form data
generateDocumentUrl() (request)Posts a generate-document request; receives a documentId with status PROCESSINGWhen you call the function
generateDocumentUrl() (polling)Polls the document endpoint (~5s interval) until status is FINISHED and a URL is availableAutomatic after the generate request

The documentUrl returned by the hook expires in 5 minutes. The hook auto-refreshes by re-polling when the URL nears expiration.