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
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
bearerToken | string | Yes* | — | Account-owner-scoped token for API communication. Not required when demoMode is true. |
questionnaire | "W-FORM" | "DPS" | "SELF-CERT" | Yes | — | Which questionnaire to render. See Overview for guidance on choosing. |
data | ClientTaxDocumentation | No | — | Pre-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. |
language | string | No | "en-us" (W-FORM), "en-gb" (DPS, SELF-CERT) | Pre-selects the form language. See supported languages. |
treatyClaims | boolean | No | false | W-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. |
realTimeTinValidation | boolean | No | false | W-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. |
demoMode | boolean | No | false | Renders 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. |
loadingComponent | ReactNode | No | Text: "Retrieving interview status..." | Custom component displayed while the SDK fetches status from the server. |
poweredByTaxbit | boolean | No | false | When true, shows "Powered by Taxbit" at the bottom of the form. |
onProgress | (progress: Progress) => void | No | — | Called when the user navigates (Next, Back, Cancel, Submit). Receives a Progress object. |
onSubmit | (data: ClientTaxDocumentation) => void | No | — | Called when the user clicks Submit, before the API request completes. |
onSuccess | (data: ClientTaxDocumentation) => void | No | — | Called after the API confirms successful submission. |
onError | (error: Response) => void | No | Throws | Called when the API returns an error during submission. Receives the HTTP Response object. If omitted, the error is thrown. |
onSettled | (data: ClientTaxDocumentation) => void | No | — | Called after either onSuccess or onError. |
Resubmission behavior
The component automatically fetches previously submitted data for the specified questionnaire type:
| Previous status | Behavior |
|---|---|
COMPLETE | Shows the summary screen immediately. The user can review and edit for resubmission. |
INCOMPLETE | Walks through each screen with previous data pre-filled. |
| Data prop + server data | The 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
| Parameter | Type | Required | Description |
|---|---|---|---|
bearerToken | string | Yes | Account-owner-scoped bearer token. |
questionnaire | "W-FORM" | "DPS" | "SELF-CERT" | Yes | Which questionnaire's data to access. |
onError | (error: Error) => void | No | Error handler. If omitted, errors are logged to console. |
Return values
| Field | Type | Description | Source endpoint |
|---|---|---|---|
statusData | ClientTaxDocumentationStatus | undefined | Current status of tax documentation for this account owner. undefined if no data submitted yet. | GET /tax-documentation-status |
serverData | ClientTaxDocumentation | undefined | Last submitted tax documentation data. Used to pre-populate the UI. | GET /tax-documentation-data |
error | Error | undefined | Populated if there's an error fetching data or with the bearer token. | — |
canGetDocumentUrl | boolean | true 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 | () => void | Triggers PDF URL generation. See PDF generation flow for details. | — |
isGeneratingDocumentUrl | boolean | true after generateDocumentUrl is called and before the URL is available. | — |
documentUrl | string | undefined | Temporary 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
| StepId | Appears in | Notes |
|---|---|---|
accountHolderClassification | All | |
accountHolderContactInformation | All | |
accountHolderTaxInformation | All | |
accountHolderTaxResidenciesConfirmation | SELF-CERT | Only for individuals with tax residencies in high-risk countries. Per-controlling-person variants also exist (controllingPerson1TaxResidenciesConfirmation through controllingPerson5TaxResidenciesConfirmation). |
exemptions | W-FORM | |
regardedOwnerClassification | W-FORM | Disregarded entity (DRE) flows only. |
regardedOwnerContactInformation | W-FORM | DRE flows only. |
regardedOwnerTaxInformation | W-FORM | DRE flows only. |
confirmation | W-FORM | |
summary | All |
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.
| Value | Meaning |
|---|---|
PENDING | TIN has been submitted but 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 IRS records. |
MISMATCH | Name/TIN combination does not match IRS records. |
TIN_NOT_ISSUED | TIN has not been issued by the IRS. |
INVALID_DATA | Submitted data is malformed or incomplete for validation. |
FOREIGN | Foreign TIN — not validated against IRS. |
ERROR | IRS validation encountered an error. |
VatStatus
VAT number validation via the VIES system. Only applies to DPS questionnaires.
| Value | Meaning |
|---|---|
PENDING | VAT has been submitted but not yet validated with VIES. |
VALID | VIES confirms the VAT number is valid for the given country. |
INVALID | VIES reports the VAT number is invalid. |
INSUFFICIENT_DATA | Not enough data to perform validation. |
NOT_REQUIRED | End user indicated VAT is not required or not issued. |
NON_EU | End 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
| 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 | W-FORM, SELF-CERT, DPS | Submitted data is missing required fields. |
INCONSISTENT_DATA | W-FORM, SELF-CERT, DPS | Submitted data contains 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 | Global 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
| Stylesheet | Import | Description |
|---|---|---|
inline.css | import '@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.css | import '@taxbit/react-sdk/style/basic.css'; | Minimal structural styling. Good base when you want full control over visual design. |
minimal.css | import '@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)
| 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 (~20 languages)
| 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) |
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 action | API behavior | When |
|---|---|---|
| Component mounts / hook initializes | Fetches 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 Submit | Posts form data to the tax documentation submission endpoint | On submit — sends collected form data |
generateDocumentUrl() (request) | Posts a generate-document request; receives a documentId with status PROCESSING | When you call the function |
generateDocumentUrl() (polling) | Polls the document endpoint (~5s interval) until status is FINISHED and a URL is available | Automatic 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.
Updated 20 days ago
