Skip to content

open-rpc/docs-react

Folders and files

NameName
Last commit message
Last commit date
Apr 23, 2019
Apr 15, 2021
Mar 22, 2019
Mar 31, 2020
Mar 25, 2019
May 7, 2020
Jan 4, 2021
Jan 4, 2021
Jan 4, 2021
Jan 4, 2021
Apr 1, 2019

Repository files navigation

docs-react

OpenRPC documentation as a react component

What is this?

This is a react component that will render documentation for a given OpenRPC document.

Screenshot:

image

How do I use this?

Installation:
npm install --save @open-rpc/docs-react
Usage:
import Documentation from "@open-rpc/docs-react";

and then use it somewhere:

<Documentation schema={schema} />
Example in a new project:
create a new typescript project with create-react-app
npx create-react-app <appname> --typescript
cd <appname>
npm install .
npm install @open-rpc/docs-react @open-rpc/meta-schema --save
index.ts
import React from 'react';
import ReactDOM from 'react-dom';
import Documentation from "@open-rpc/docs-react";
import { OpenrpcDocument } from '@open-rpc/meta-schema';

const schema: OpenrpcDocument = {
  openrpc: "1.2.4",
  info: {
    "version": "0.0.0-development",
    "title": "My New API"
  },
  methods: []
};

ReactDOM.render(<Documentation schema={schema} />, document.getElementById("root"));

screenshot

image