Solid SDK
The Solid SDK connects Solid applications to UploadThing file routes through typed upload helpers and reactive upload components. It turns route metadata into file-selection rules, upload progress, completion and error events, while keeping the UI aligned with the current upload state. See the Framework SDKs page for the wider family of integrations, and compare the Vue SDK, Svelte SDK, Nuxt SDK, and Expo SDK pages for other client environments.
Integration model
The integration has two layers. The upload factory supplies route-bound client behavior, while the components provide ready-to-use Solid interfaces for selecting and sending files. Both layers use the same UploadThing route contract, so an application can move from a built-in component to a custom interface without changing the server route it targets.
Typed client helpers
packages/…/create-uploadthing.ts is the main client boundary. generateSolidHelpers binds a file router to an UploadThing URL and fetch function, then exposes createUploadThing together with the shared client helpers. The router type ties endpoint names and endpoint input to the application’s server contract.
The factory can use the normal browser fetch function or a custom fetch function. This lets an application keep request behavior such as credentials or headers in one place. Generated button, dropzone, and uploader components apply the same URL and fetch choices without requiring each instance to repeat them.
References: packages/…/create-uploadthing.ts• L143-171 packages/…/index.tsx• L16-73 packages/…/types.ts• L20-50
Upload lifecycle
The Solid upload flow starts with route metadata and ends with application callbacks and reactive UI updates. Components obtain the permitted file information for the selected endpoint, collect files from a user action, and pass the files plus any typed endpoint input to the upload factory.
The following diagram shows how a Solid upload moves from route discovery to transfer and final application state.
flowchart LR
A[Solid component] --> B[Route metadata]
B --> C[File selection]
C --> D[Local file rules]
D --> E[UploadThing client]
E --> F[Storage transfer]
F --> G[Complete or error callback]
E --> H[Reactive progress and state]
H --> A
Upload state
The upload factory exposes isUploading as Solid state and reports one aggregate progress value for a group of files. The components use this information to show loading, ready, uploading, disabled, progress, cancel, and completion views without requiring application code to manage a second upload state model.
The factory also keeps the upload lifecycle separate from the view. Applications can change files before the server request, react when each file begins, observe progress, handle completion or errors, and cancel through an AbortSignal. An aborted upload is distinguished from other failures so components can call the dedicated abort callback.
References: packages/…/create-uploadthing.ts• L53-140 packages/…/types.ts• L52-119 packages/…/button.tsx• L88-137
Reactive components
The package exports UploadButton, UploadDropzone, and Uploader from packages/…/index.tsx. Each component is generic over the application file router and endpoint, which keeps its endpoint, input, and callback types aligned with the server route.
Button uploads
UploadButton provides a compact file-picker flow. In its default automatic mode, selecting files starts the upload at once. Manual mode holds the selected files until the user presses the upload button, and it adds a clear action for changing the selection before transfer.
The button reads the endpoint’s permitted types and quantity to configure the file picker and its supporting text. It can also accept pasted files when enabled. During transfer, the same control shows progress and gives the user a way to cancel the active upload.
References: packages/…/button.tsx• L48-87 packages/…/button.tsx• L118-177 packages/…/button.tsx• L217-308
Dropzone uploads
UploadDropzone provides a larger selection area for file dragging, dropping, choosing, and optional pasting. Its default manual mode lets users review the accepted files before upload. Automatic mode starts the upload after a valid drop or paste.
The dropzone checks file type, size, count, and multiple-file rules before it reports accepted files to the component. It also supports keyboard activation and prevents unrelated page-level drop behavior from taking over the browser window. The component reports selected files through onChange; onDrop remains as a deprecated compatibility callback.
References: packages/…/dropzone.tsx• L74-113 packages/…/dropzone.tsx• L142-224 packages/…/dropzone.tsx• L506-625
Combined uploader
Uploader is a convenience view that places a button flow and a dropzone flow on the same page. It is useful when an application wants both interaction styles for one typed endpoint without assembling the two components itself.
References: packages/…/uploader.tsx• L6-34 packages/…/index.tsx• L8-14
Selection utilities
The components rely on small Solid-aware utilities to keep browser events and route data inside the reactive upload flow. These utilities do not define a second upload protocol; they prepare route information and user-selected files for the shared client.
Route metadata resource
packages/…/createFetch.ts creates a Solid resource for endpoint metadata. It fetches the route description once for a URL, caches the result, and represents both fetched data and request errors as explicit resource states. The upload components use this resource to decide when they are ready and what file rules or labels to show.
References: packages/…/createFetch.ts• L7-51 packages/…/create-uploadthing.ts• L35-42 packages/…/button.tsx• L118-127
File selection bridge
createDropzone bridges browser file events to Solid state. It handles the file dialog, drag targets, keyboard input, paste support at the component level, and accepted-file state. The upload dropzone then uses that state to either wait for a manual action or start the shared upload flow.
References: packages/…/dropzone.tsx• L191-224 packages/…/dropzone.tsx• L432-504 packages/…/dropzone.tsx• L530-625
Styling and content
The Solid components provide a default UploadThing look while exposing controlled points for application-specific design. Styling and content are separate concerns: appearance changes classes or CSS values, while content changes the visible labels or elements.
Appearance and content customization
Both main components accept a class value and an appearance map for their visual parts. Appearance callbacks receive reactive context such as readiness, upload state, progress, permitted file types, drag activity, and selected files. This lets an application style the same component differently for each state.
The content map replaces built-in icons, labels, allowed-content text, button text, or the manual clear action. The config.cn option controls class merging when an application adds its own utility classes, and config.mode selects automatic or manual upload behavior.
References: packages/…/types.ts• L130-208 packages/…/button.tsx• L26-64 packages/…/dropzone.tsx• L49-97
Package stylesheet
The public entry point imports styles.css, which supplies the Tailwind layers used by the component styles. The package also exposes the stylesheet as @uploadthing/…/styles.css, so a build can include the style entry directly when its CSS setup needs an explicit import.
References: packages/…/index.tsx• L1-11 packages/…/styles.css• L1-3 packages/…/package.json• L89-99
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the router generic, endpoint input, and generated component prop types aligned. A change in one boundary can silently remove type safety from the others.
- Preserve the distinction between automatic and manual mode. Button and dropzone components have different defaults, and their selection callbacks must still lead to the intended upload trigger.
- Keep route metadata and local file checks consistent with the server route rules. Otherwise the UI can show permitted content that the dropzone does not accept.
- Keep the abort path distinct from ordinary upload errors. Components depend on that distinction to call
onUploadAbortedrather than the normal error path. - Keep the stylesheet export and the entry-point style import aligned with the built package exports.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The route metadata URL is missing or cannot be fetched | The component remains in its loading or unusable state because it cannot learn the endpoint rules | Set a valid UploadThing URL or provide a fetch function that reaches the route |
| A selected dropzone file fails type, size, or quantity rules | The file is not sent to UploadThing and the selection callback receives no accepted file for it | Configure the server route and component expectations from the same file rules |
| An upload is aborted through the component control or its signal | The upload ends without a normal completion result | Handle onUploadAborted when the application needs to restore its own state |
| A custom class merger does not preserve class precedence | Application styling can lose to the component’s default utility classes | Supply a class merger that understands the utility classes used by the component |
| The CSS entry is omitted from a build | The upload controls render without their expected base styles | Include the package stylesheet through the main entry or the styles.css export |
Key files
| File | Why to read it |
|---|---|
| packages/…/create-uploadthing.ts | Defines the typed upload factory, route metadata access, progress behavior, callbacks, and abort/error boundary |
| packages/…/types.ts | Describes the shared helper and component contracts, including endpoint input and customization options |
| packages/…/button.tsx | Shows the compact file-picker experience and automatic versus manual upload behavior |
| packages/…/dropzone.tsx | Shows drag-and-drop selection, local file checks, paste behavior, and reactive dropzone state |
| packages/…/uploader.tsx | Shows the convenience composition of button and dropzone interfaces |
| packages/…/createFetch.ts | Shows the reactive route metadata resource and its cache and error states |
| packages/…/index.tsx | Shows the public Solid exports and stylesheet entry point |
| packages/…/package.json | Shows the package-level Solid and UploadThing contract and the public stylesheet export |