Orbit-monstra is a simple docs generator from ts declaration files for @kiwicom/orbit-components project
Available commands:
-
docs: creates README.md files in component folder with table of props, subcomponents and description
example:
monstra docs --path='src/*/'
How to document component:
-
To create basic description add to
index.d.ts
next comment block:/* DOCS: <your description> */
example:
/* DOCS: # AirportIllustration To implement AirportIllustration component into your project you'll need to add the import: import AirportIllustration from "@kiwicom/orbit-components/lib/AirportIllustration"; After adding import into your project you can use it simply like: <AirportIllustration name="Accommodation" size="small" /> */
Note: (same with
/* FunctionalSpec: */
)
-
When you run
docs
command it creates table with Name and Type like:Name Type Optional Description size [
enum](#enum)
name Name
in order to add description and default value, you have to add
comment lines
inindex.d.ts
file of component in JSDoc format:export interface Props extends Globals, SpaceAfter { /** The size of the AirportIllustration */ /** default: "small" */ readonly size?: "extraSmall" | "small" | "medium" | "large" | "display"; readonly name: Name; readonly alt?: string; }