According their docs, you can pass content directly using the spec props:

spec: PropTypes.object

An OpenAPI document respresented as a JavaScript object, JSON string, or YAML string for Swagger UI to display.

Don't use this in conjunction with url - unpredictable behavior may occur.

Example:

<SwaggerUI spec={jsonData} />
Answer from indyteo on Stack Overflow
🌐
npm
npmjs.com › package › swagger-ui-react
swagger-ui-react - npm
2 weeks ago - If set to true, uses the mutated request returned from a requestInterceptor to produce the curl command in the UI, otherwise the request before the requestInterceptor was applied is used. ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance.
      » npm install swagger-ui-react
    
Published   Apr 07, 2026
Version   5.32.2
🌐
GitHub
github.com › swagger-api › swagger-ui › issues › 10243
React 19 Compatibility with swagger-ui-react · Issue #10243 · swagger-api/swagger-ui
December 24, 2024 - Hello, I'm planning to upgrade my project to React 19, but I am unable to proceed due to compatibility issues with the swagger-ui-react package. Do you have plans to support React 19 in the nea...
Author   huraim
🌐
Swagger
swagger.io › docs › open-source-tools › swagger-ui › usage › installation
Installation | Swagger Docs
We publish three modules to npm: swagger-ui, swagger-ui-dist and swagger-ui-react.
🌐
Swagger
swagger.io › docs › open-source-tools › swagger-editor-next
SwaggerEditor | Swagger Docs
window.React = ui.React; 19 · </script> 20 · <script src="//unpkg.com/swagger-editor@5.0.0-alpha.86/dist/umd/swagger-editor.js"></script> 21 · <script> 22 · SwaggerUIBundle({ 23 · url: 'https://petstore3.swagger.io/api/v3/openapi.json', 24 · dom_id: '#swagger-ui', 25 ·
🌐
CodeSandbox
codesandbox.io › examples › package › swagger-ui-react
swagger-ui-react examples - CodeSandbox
Use this online swagger-ui-react playground to view and fork swagger-ui-react example apps and templates on CodeSandbox.
🌐
GitHub
github.com › swagger-api › swagger-ui › issues › 10212
Getting UNSAFE_componentWillReceiveProps error when using Next.js 15 / React 19 · Issue #10212 · swagger-api/swagger-ui
November 11, 2024 - Swagger-UI version: 5.18.2 · Swagger/OpenAPI version: Swagger 2.0, OpenAPI 3.1.0 · I'm using a vanilla Swagger Page inside a Next.js 15 / React 19 application: "use client"; import { useEffect, useState } from "react"; import SwaggerUI from "swagger-ui-react"; import "swagger-ui-react/swagger-ui.css"; function SwaggerPage() { const [spec, setSpec] = useState<any>(null); useEffect(() => { fetch("/api/swagger") .then((response) => response.json()) .then((data) => setSpec(data)); }, []); if (!spec) { return <div>Loading...</div>; } return <SwaggerUI spec={spec} />; } export default SwaggerPage; I'm seeing the following error starting in Swagger-UI 5.18.0 and continuing through 5.18.2 on my Swagger page: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code.
Author   petergoldstein
🌐
Maven Central
central.sonatype.com › artifact › org.mvnpm › swagger-ui-react
org.mvnpm:swagger-ui-react - Maven Central
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>org.mvnpm</groupId> <artifactId>swagger-ui-react</artifactId> <version>5.31.0</version> <name>swagger-ui-react</name> <description>[![NPM version](https://badge.fury.io/js/swagger-ui-react.svg)](http://badge.fury.io/js/swagger-ui-react)</description> <url>https://github.com/swagger-api/swagger-ui</url> <organi
🌐
npm
npmjs.com › package › swagger-ui › v › 5.19.0
swagger-ui - npm
February 17, 2025 - swagger-ui-react is Swagger UI packaged as a React component for use in React applications.
      » npm install swagger-ui
    
Published   Dec 11, 2025
Version   5.19.0
Find elsewhere
🌐
Remult
remult.dev › docs › adding-swagger
Adding Swagger and openApi | Remult
// src/app/api-doc/react-swagger.tsx 'use client' import SwaggerUI from 'swagger-ui-react' import 'swagger-ui-react/swagger-ui.css' type Props = { spec: Record<string, any> } function ReactSwagger({ spec }: Props) { return <SwaggerUI spec={spec} /> } export default ReactSwagger
🌐
Swagger
swagger.io › docs › open-source-tools › swagger-ui › customization › overview
Plugin system overview | Swagger Docs
If you don’t want to set up a build pipeline capable of translating JSX to JavaScript, take a look at React without JSX (reactjs.org). You can use our system.React reference to leverage React without needing to pull a copy into your project. The system is the heart of the Swagger UI application.
🌐
Medium
medium.com › @techxp › create-basic-api-using-nextjs-15-and-react-19-e9a6462c7848
Create Basic API Using NextJS 15 and React 19 with Swagger Documentation | by Tech Explorer | Medium
January 23, 2025 - Create Basic API Using NextJS 15 and React 19 with Swagger Documentation NextJS provides ability to create Full-Stack applications which means, you can write front-end as well as back-end as a …
🌐
Packagist
packagist.org › packages › swagger-api › swagger-ui
swagger-api/swagger-ui - Packagist.org
dev-issue-10243--react-19-initial-support · dev-issue-9158 · dev-dependabot/npm_and_yarn/body-parser-2.2.0 · dev-bug/fix-allof-when-switching-openapi-version · dev-char0n/cd-final-touches · dev-char0n/docker-build-push · dev-char0n/swagger-ui-packagist ·
🌐
Snyk
security.snyk.io › snyk vulnerability database › npm
swagger-ui-react vulnerabilities | Snyk
Further analysis of the maintenance status of swagger-ui-react based on released npm versions cadence, the repository activity, and other data points determined that its maintenance is Healthy.
🌐
GitHub
github.com › swagger-api › swagger-ui › tree › master › flavors › swagger-ui-react
swagger-ui/flavors/swagger-ui-react at master · swagger-api/swagger-ui
It has a few differences from the main version of Swagger UI: Declares react and react-dom as peerDependencies instead of production dependencies
Author   swagger-api
🌐
Catalin's Tech
catalins.tech › generate-swagger-documentation-next-js-api
Generate Swagger Documentation For a Next.js API
June 9, 2025 - It contains information such as: ... On the other hand, Swagger Documentation (Swagger UI is the correct name) is part of a suite of open-source tools used to interact with the OpenAPI Specification.