@scalar/api-reference-react
v0.4.5
Published
The react client only integration for api references
Downloads
35,630
Readme
Scalar API Reference React Component
Installation
npm install @scalar/api-reference-react
Compatibility
This package is compatible with React 19 and is untested on React 18. If you want guaranteed React 18 support please use
version 1.0.107
of this package.
Usage
The API Reference package is written in Vue. That shouldn’t stop you from using it in React, though. We have created a client side wrapper in React:
[!WARNING]
This is untested on SSR/SSG!
import { ApiReferenceReact } from '@scalar/api-reference-react'
import '@scalar/api-reference-react/style.css'
function App() {
return (
<ApiReferenceReact
configuration={{
spec: {
url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml',
},
}}
/>
)
}
export default App
We wrote a detailed integration guide for React, too.
Example
You can find an example in this repo under examples/react
Props
ApiReference only takes one prop which is the configuration object.
configuration: ReferenceProps
You can find the full configuration options under packages/api-reference.
Community
We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar
License
The source code in this repository is licensed under MIT.