View all files | ||||
React component for AsyncAPI specification. Available also as a Web Component, but not only.
The official React component for AsyncAPI specification. It allows you to render the documentation of your asynchronous API provided in the AsyncAPI specification format and validate this specification. You can fully restyle the component using your own styles.
Run this command to install the component in your project:
Check out this sandbox application that uses the React component:
Check a simple example which shows passing the inline AsyncAPI specification with custom configurations:
To check how to use web-component or use a component in other technologies see:
The list of props for the AsyncAPI React component includes:
schema: string | AsyncAPIDocument | object | FetchingSchemaInterface
The schema property is required and contains AsyncAPI specification. Use the string type, the AsyncAPIDocument type, parsed specification as JS object from AsyncAPI Parser or the FetchingSchemaInterface object to fetch the schema from an external resource. For more information on what it contains and what it should look like, read AsyncAPI Specification.
config?: Partial<ConfigInterface>
The config property is optional and contains configuration for the AsyncAPI component. For more information on the available configuration options, read the Configuration Modification document. This property is concatenated with the default configuration.
NOTE: The Partial<T> type means that every field in the T type is optional.
For a list and description of features offered by the AsyncAPI React component, see this directory.
To use default styles import them as follows:
The AsyncAPI React component does not set any global fonts. This component allows the usage of your custom font-family and other styling.
This can be done by defining the styles in a file or inline using a <style> tag in the <head> section of the page where you are using AsyncAPI React component.
Example custom styles (defined in the styles/custom.css file):
If you are using the component in a project that uses a bundler like Webpack, don't forget to import the custom styles.
If you are using the standalone bundle, you can put the custom styles as a style sheet link or as an inline style in the <head> section of the HTML code:
The AsyncAPI component supports the option to use a custom logo. By using the x-logo custom extension in the InfoObject, a logo will be shown in the top left corner.
NOTE: The logo will only appear if the sidebar option is enabled.
This repository comes in with a Playground application. Test it to see the component in action and play with it before you use it in your application.
You can also run the Playground application locally by following this instruction from the development guide.
The @asyncapi/react-component package has 3 crafted JS modules to be used in various environments:
For information on how to set up a development environment, write and run tests, follow the naming and architecture convention defined for the project in the Development Guide.
If you have a feature request, add it as an issue or propose changes in a pull request (PR). If you create a feature request, use the dedicated Feature request issue template. When you create a PR, follow the contributing rules described in the CONTRIBUTING.md document.
If you have a bug to report, reproduce it in an online code editor. For example, use CodeSandbox. Attach the link to the reproduced bug to your issue. Log the bug using the Bug report template.
The project was originally developed under the Kyma project, in 2019 it was moved under AsyncAPI Initiative.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!