Skip to main content

Stegosaurus Stegosaurus

Use the 'stegosaurus' template to generate a table with all the component properties.

This table is very similar to the table generated by Storybook, with a few differences:

FeatureStegosaurusStorybookDescription
NameBoth in bold in the first column.
DescriptionBoth in the second column as first text.
TypeBoth as inline code block in the second column, under the description.
ParamsBoth as inline code block in the second column, under the type.
Default valueBoth as inline code block in the third column.
ControlIn the storybook the table is integrated with the story of the component. C2M's proposal is that this table can be used anywhere, so it needs to be platform independent.
RequiredBoth with a red asterisk next to the property name.
DeprecatedStegosaurus identifies the @deprecated tag and places an alert icon next to the property name and, if it has description, places the description text as the first paragraph in the second highlighted column.
SinceStegosaurus identifies the @since tag and places the version description in the second column.

Generated documentation:

References

How to generate this doc?

For learning purposes, below is the step used to generate the component documentation using this template.

At the root of the repository, just run the following command:

npx components-to-markdown@latest \
--output packages/website/demo/stegosaurus/demonstration \
--loglevel debug \
--template stegosaurus \
packages/example-react-components/src/lib packages/example-prop-types/src/lib

Change the output directory to an empty one if you want to see the file being created from scratch.

The packages/example-* are example projects that have components that will be documented.