Skip to content
v13.0
GitHub

Quickstart

  1. Create an HTML file that loads RapiDoc and points <rapi-doc> at your spec:

    index.html
    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
    <style>
    body { margin: 0; }
    rapi-doc { height: 100vh; }
    </style>
    </head>
    <body>
    <rapi-doc spec-url="https://petstore.swagger.io/v2/swagger.json"></rapi-doc>
    </body>
    </html>
  2. Open it in a browser. You get navigation, search, schemas and a Try console that calls the API.

  3. Replace spec-url with the URL of your own OpenAPI 3.x or Swagger 2.0 file, in JSON or YAML. If the spec is on another domain, that server must allow cross-origin requests (see Loading Your Spec).

With a bundler, install the package and import it once in your entry file. The import registers <rapi-doc>; use it in your markup as above.

npm install rapidoc
import 'rapidoc';

For production, pin a version (https://unpkg.com/rapidoc@12/dist/rapidoc-min.js) or serve the file from your own site.

A few attributes cover most needs:

<rapi-doc
spec-url="/openapi.yaml"
theme="cobalt"
color-scheme="light"
render-style="view"
allow-try="false"
></rapi-doc>
Attribute Values Default
theme ember, carbon, cobalt, jade, indigo, or a #hex brand color ember
color-scheme dark, light, system dark
render-style read (one long page), view (expandable sections), focused (one operation at a time) read
show-header true, false true
allow-try true, false: show or hide the Try console true

Every attribute, method, event and slot is listed in the API reference.