Components
This section introduce how to use mdx components to enrich your docs content. We support most markdown applications.
Titles and headings
Best used for page headers.
# Your Page Header
How to Write | Rendered Output |
---|---|
# Heading level 1 | Heading level 1 |
## Heading level 2 | Heading level 2 |
### Heading level 3 | Heading level 3 |
#### Heading level 4 | Heading level 4 |
##### Heading level 5 | Heading level 5 |
###### Heading level 6 | Heading level 6 |
Text formatting
We support most markdown formatting.
Style | How to write | Rendered Output |
---|---|---|
Bold | **Bold text** | Bold text |
Italic | _Italic text_ | Italic text |
Strike | ~~Strikethrough~~ |
You can combine these to emphasize text with bold and italics at the same time. For example, you can write **_Bold with Italic_**
or __*Bold with Italic*__
to get Bold with Italic text.
If you want to write superscript or subscript text, you need to use HTML.
Style | How to write | Rendered Output |
---|---|---|
Superscript | <sup>superscript</sup> | superscript |
Subscript | <sub>subscript</sub> | subscript |
lists
You can order your content into ordered number lists or unrdered bulleted lists.
Number list
Best used for Number list.
1. First list
2. Second list
3. Third list
Bulleted list
You can add-
, *
, or+
in front of each line items to create bulleted lists.
Best used for bulleted list.
- First list
- Second list
- Third list
- First list
- Second list
- Third list
Links
Inorder to create a link, you can enclose the link text in brackets (e.g., [Docuo]) and then follow it immediately with the URL in parentheses (e.g., (https://www.spreading.ai/)).
I love using [Docuo](https://www.spreading.ai/) to generate online docs.
The rendered output looks like this: I love using Docuo to generate online docs.
Quotes
You can add a >
in front of a paragraph to create a quote.
> I love using Docuo to generate online docs.
The rendered output looks like this:
I love using Docuo to generate online docs.
Divider
Best used for divider.
---
Tables
We support the offical markdown table syntax.
To add a table, use three or more hyphens ---
to create each column’s header, and use pipes |
to separate each column. You should also add a pipe on either end of the row.
| Title | Description |
| ----- | ------------ |
| Item1 | Destription1 |
| Item2 | Destription2 |
The rendered output looks like this:
Title | Description |
---|---|
Item1 | Destription1 |
Item2 | Destription2 |
Callouts
There are four types of callouts prepared for you to match different needs, including <Check>
, <Tip>
, <Note>
, <Warning>
, and <Error>
.
- Check
<Check title="Check">This adds a check list to confirm</Check>
The rendered output looks like this:
- Tip
<Tip title="Tip">This suggests a helpful tip</Tip>
The rendered output looks like this:
- Note
<Note title="Note">This adds a note in the content</Note>
The rendered output looks like this:
- Warning
<Warning title="Warning">This raises a warning to watch out for</Warning>
The rendered output looks like this:
- Error
<Error title="ERROR">This raises a error to watch out for</Error>
The rendered output looks like this:
Cards
Single Card
<Card title="Card title" icon="./lightbulb-solid.svg" href="/overview/introduction">
This is a Card example with `href` prop. Clicking will navigate to the `href` refers to.
</Card>
This is a Card example with href
prop. Clicking me will navigate to the href
refers to.
Props
Prop | Prop type | Description |
---|---|---|
title | string | The title of the card. |
icon | string or svg | A local path of icon or SVG code in icon={}. |
href | string | The url that clicking on the card would navigate the user to. |
Card Groups
Use CardGroup
to show cards side by side in a grid format.
<CardGroup cols={2}>
<Card title="First Card">
Lorem ipsum dolor sit amet, consectetur adipiscing elit
</Card>
<Card title="Second Card">
Lorem ipsum dolor sit amet, consectetur adipiscing elit
</Card>
<Card title="Third Card">
Lorem ipsum dolor sit amet, consectetur adipiscing elit
</Card>
<Card title="Fourth Card">
Lorem ipsum dolor sit amet, consectetur adipiscing elit
</Card>
</CardGroup>
The CardGroup
component lets you group multiple Card components. It's most often used to put multiple cards in the same column.
Lorem ipsum dolor sit amet, consectetur adipiscing elit
Lorem ipsum dolor sit amet, consectetur adipiscing elit
Lorem ipsum dolor sit amet, consectetur adipiscing elit
Lorem ipsum dolor sit amet, consectetur adipiscing elit
Tabs
Toggle content using the Tabs component, supporting embedding other components. You can add any number of tabs.
<Tabs>
<Tab title="First Tab">
☝️ Welcome to the content that you can only see inside the first Tab.
</Tab>
<Tab title="Second Tab">
✌️ Here's the content that's only inside the second Tab.
</Tab>
<Tab title="Third Tab">
💪 Here's the content that's only inside the third Tab.
</Tab>
</Tabs>
The rendered outout looks like this:
Tab Props
Prop | Prop type | Description |
---|---|---|
title | string | The title of the tab. Short titles are easier to navigate. |
Accordion
A dropdown component for toggling content.
<Accordion title="I am an Accordion." defaultOpen="true">
You can put any content in here.
</Accordion>
The rendered outout looks like this:
Accordion Props
Prop | Prop type | Description |
---|---|---|
title | string | Title in the Accordion preview. |
defaultOpen | boolean | Whether the Accordion is open by default. |
Button
A clickable button that opens a link when clicked.
- External link
<Button href="https://docuo.spreading.io/editing-docs/components" primary-color="Green" target="_blank">Click me</Button>
- Internal link
<Button href="./Components.mdx" primary-color="Green" target="_blank">Click me</Button>
The rendered outout looks like this:
Button Props
Prop | Prop type | Description |
---|---|---|
href | string | The url that clicking on the button would navigate the user to. |
primary-color | PrimaryColor | Button theme color name, refer to the PrimaryColor enumeration below. |
target | string | How to open the link, the default _blank , reference https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/a#target. |
Primary Color
Name | Theme color |
---|---|
DarkGray | { "background": "#171717", "color": "#FFFFFF" } |
NavyBlue | { "background": "#587FFF", "color": "#FFFFFF" } |
Orange | { "background": "#FF9D00", "color": "#FFFFFF" } |
Tangerine | { "background": "#FF4400", "color": "#FFFFFF" } |
Red | { "background": "#FF0014", "color": "#FFFFFF" } |
Magenta | { "background": "#FF00FF", "color": "#FFFFFF" } |
Purple | { "background": "#8163F6", "color": "#FFFFFF" } |
LightBlue | { "background": "#00B5FF", "color": "#FFFFFF" } |
Turquoise | { "background": "#00CAE4", "color": "#FFFFFF" } |
Green | { "background": "#00BD46", "color": "#FFFFFF" } |
Lime | { "background": "#00A900", "color": "#FFFFFF" } |
Gray | { "background": "#777381", "color": "#171717" } |
White | { "background": "#FFFFFF", "color": "#171717" } |
Steps
Sequence content using the Steps component.
<Steps>
<Step title="First Step">
These are instructions or content that only pertain to the first step.
</Step>
<Step title="Second Step">
These are instructions or content that only pertain to the second step.
</Step>
<Step title="Third Step">
These are instructions or content that only pertain to the third step.
</Step>
</Steps>
Steps are the best way to display a series of actions of events to your users. You can add as many steps as desired.
These are instructions or content that only pertain to the first step.
These are instructions or content that only pertain to the second step.
These are instructions or content that only pertain to the third step.
Steps Props
Prop | Prop type | Description |
---|---|---|
titleSize | string | The size of the step titles. One of p , h2 and h3 . Default: p |
Individual Step Props
Prop | Prop type | Description |
---|---|---|
title | string | The title is the primary text for the step and shows up next to the indicator. |
icon | string or svg | A local path of icon or SVG code in icon={}. |
stepNumber | number | The number of the step. |
titleSize | string | The size of the step titles. One of p , h2 and h3 . This value would override titleSize of Steps . |
Code blocks
Inline code blocks
You can enclose the inline code in backticks (e.g., Docuo
)
Add a `inline code block` in a sentence.
The rendered output looks like this:
Add a inline code block
in a sentence.
Single Code blocks
You can use fenced code blocks by enclosing code in three backticks.
```
helloWorld();
```
The rendered output looks like this:
helloWorld();
You can put the name of your programming language after the first three backticks to get syntax highlighting. Or you can indicate the lines to be highlighted in curly brackets.
```jsx {1,4-6,11}
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
```
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
You can add more text after the programming language to set the name of your code example. The text can be anything as long as its all in one line.
```javascript helloWorld.js
console.log("Hello World");
```
console.log("Hello World");
Code blocks show line numbers by default. If you want to hide line numbers, you can add hideLineNumbers
at the end of the first three backticks.
```jsx helloWorld.js {1,4-6,11} hideLineNumbers
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
```
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
Code groups
Use <CodeGroup>
to aggregate multiple code blocks into one code group.
<CodeGroup>
```javascript helloWorld.js
console.log("Hello World");
```
```python hello_world.py
print('Hello World!')
```
```java HelloWorld.java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
</CodeGroup>
The rendered output looks like this:
console.log("Hello World");
print('Hello World!')
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Images
We support displaying images through repository path or by adding image path
<Frame width="300" height="auto" caption="image description text">
<img src="/path/image.jpg" />
</Frame>
Index | Index type | Description |
---|---|---|
width | value greater than 0, or "auto" | The width of the image. If "aoto" is set, the image width will adapt to the page. |
height | value greater than 0, or "auto" | The width of the image. If "aoto" is set, the image height will adapt to the page. |
caption | string | Text description at the bottom of the image. |
Videos
We support displaying Youtube,vimeo, and Loom online videos.
<Video src="https://youtube.com/xxxxxx"/>