Code
Show source code in a standardized way. Want to display shell code snippets? try Snippet.
General
Basic inline codes.
Code Block
Multi line code display.
Width
Specify width manually, or other styles.
Name
Specify the file name for the code block.
Tabs
Show more than one code in the same block. Set the names in tabs and change the code when onTabChange is called.
Classic Style
The classic design style with a line border instead of a background.
APIs
Code.Props
| Attribute | Description | Type | Accepted values | Default |
|---|---|---|---|---|
| block | show code in pre | boolean | - | false |
| name | text displayed at the top of the code block | string | - | - |
| classic | display with classic style | boolean | - | false |
| tabs | names of the tabs, in place of name | string[] | - | [] |
| activeTab | index of the active tab | number | - | 0 |
| onTabChange | called with the index of the chosen tab | (index: number) => void | - | - |
| ... | native props | HTMLAttributes | 'className', ... | - |