Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 1.67 KB

File metadata and controls

53 lines (37 loc) · 1.67 KB

Scalar API Reference React Component

Version Downloads License Discord

Installation

npm install @scalar/api-reference-react

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.