Doc Blocks

Doc Blocks are the building blocks of Storybook documentation pages. By default, DocsPage uses a combination of the blocks below to build a page for each of your components automatically.

Custom addons can also provide their own doc blocks.


Storybook Docs automatically generates component args tables for components in supported frameworks. These tables list the arguments (args for short) of the component, and even integrate with controls to allow you to change the args of the currently rendered story.

This is extremely useful, but it can be further expanded. Additional information can be added to the component to better document it:

By including the additional information, the args table will be updated. Offering a richer experience for any stakeholders involved.


To use the ArgsTable in DocsPage, export a component property on your stories metadata:


To use the ArgsTable block in MDX, add the following:


ArgsTables are automatically inferred from your components and stories, but sometimes it's useful to customize the results.

ArgsTables are rendered from an internal data structure called ArgTypes. When you declare a story's component metadata, Docs automatically extracts ArgTypes based on the component's properties.

You can customize what's shown in the ArgsTable by customizing the ArgTypes data. This is currently available for DocsPage and <ArgsTable story="xxx"> construct, but not for the <ArgsTable of={component} /> construct.

NOTE: This API is experimental and may change outside of the typical semver release cycle

The API documentation of ArgTypes is detailed in a separate section, but to control the description and default values, use the following fields:

nameThe name of the property
type.requiredThe stories to be show, ordered by supplied name
descriptionA Markdown description for the property
table.type.summaryA short version of the type
table.type.detailA short version of the type
table.defaultValue.summaryA short version of the type
table.defaultValue.detailA short version of the type
controlSee addon-controls README

For instance:

This would render a row with a modified description, a type display with a dropdown that shows the detail, and no control.

If you find yourself writing the same definition over and over again, Storybook provides some convenient shorthands, that help you streamline your work.

For instance you can use:

  • number, which is shorthand for type: {name: 'number'}
  • radio, which is a shorhand for control: {type: 'radio' }


To customize argTypes in MDX, you can set an mdx prop on the Meta or Story components:


The controls inside an ArgsTable are configured in exactly the same way as the controls addon pane. In fact you’ll probably notice the table is very similar! It uses the same component and mechanism behind the scenes.


Storybook Docs displays a story’s source code using the Source block. The snippet has built-in syntax highlighting and can be copied with the click of a button.

Docs blocks with source


In DocsPage, the Source block appears automatically within each story’s Canvas block.

To customize the source snippet that’s displayed for a story, set the docs.source.code parameter:


You can also use the Source block in MDX. It accepts either a story ID or code snippet. Use the language for syntax highlighting.


Storybook Docs shows a component’s description extracted from the source code or based on a user-provided string.

Docs blocks with description


In DocsPage, a component’s description is shown at the top of the page. For supported frameworks, the component description is automatically extracted from a docgen component above the component in its source code. It can also be set by the docs.description parameter.


In MDX, the Description shows the component’s description using the same heuristics as the DocsPage. It also accepts a markdown parameter to show any user-provided Markdown string.


Stories (component examples) are the basic building blocks in Storybook. In Storybook Docs, stories are rendered in the Story block.

Docs blocks with stories


In DocsPage, a Story block is generated for each story in your CSF file, it's wrapped with a Canvas wrapper that gives it a toolbar on top (in the case of the first “primary” story) and a source code preview underneath.


In MDX, the Story block is not only a way of displaying stories, but also the primary way to define them. Storybook looks for Story instances with the name prop, either defined at the top level of the document, or directly beneath a Canvas block defined at the top level:

You can also reference existing stories in Storybook by ID:

Inline rendering

In Storybook’s Canvas, all stories are rendered in the Preview iframe for isolated development. In Storybook Docs, when inline rendering is supported by your framework, inline rendering is used by default for performance and convenience. However, you can force iframe rendering with docs: { inlineStories: false } parameter, or inline={false} in MDX.


Storybook Docs’ Canvas block is a wrapper that provides a toolbar for interacting with its contents, and also also provides Source snippets automatically.

Docs block with a story preview


In DocsPage, every story is wrapped in a Canvas block. The first story on the page is called the primary, and it has a toolbar. The other stories are also wrapped with Canvas, but there is no toolbar by default.

Docs blocks preview toolbar


In MDX, Canvas is more flexible: in addition to the DocsPage behavior, it can show multiple stories in one:

You can also place non-story content inside a Canvas block:

This renders the JSX content exactly as it would if you’d placed it directly in the MDX, but it also inserts the source snippet in a Source block beneath the block.