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

AttributeDescriptionTypeAccepted valuesDefault
blockshow code in preboolean-false
nametext displayed at the top of the code blockstring--
classicdisplay with classic styleboolean-false
tabsnames of the tabs, in place of namestring[]-[]
activeTabindex of the active tabnumber-0
onTabChangecalled with the index of the chosen tab(index: number) => void--
...native propsHTMLAttributes'className', ...-
Edit this page on GitHub