Show source code in a standardized way. Want to display shell code snippets? try Snippet.
Basic inline codes.
Run npm i @bolio-ui/core
to install.
Or run yarn add @bolio-ui/core
to install.
Multi line code display.
import React, { useState } from "react";
const App = () => {
const [wait, showWaitTime] = useState(0);
setTimeout(() => showWaitTime(wait + 1), 1000);
return <div>You've been waiting since {wait} seconds!</div>;
};
export default App;
Specify width manually, or other styles.
import React, { useState } from "react";
const App = () => {
const [wait, showWaitTime] = useState(0);
setTimeout(() => showWaitTime(wait + 1), 1000);
return <div>You've been waiting since {wait} seconds!</div>;
};
export default App;
Specify the file name for the code block.
import React, { useState } from "react";
const App = () => {
const [wait, showWaitTime] = useState(0);
setTimeout(() => showWaitTime(wait + 1), 1000);
return <div>You've been waiting since {wait} seconds!</div>;
};
export default App;
The classic design style with a line border instead of a background.
import React, { useState } from "react";
const App = () => {
const [wait, showWaitTime] = useState(0);
setTimeout(() => showWaitTime(wait + 1), 1000);
return <div>You've been waiting since {wait} seconds!</div>;
};
export default App;
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 |
... | native props | HTMLAttributes | 'className', ... | - |
Previous
Checkbox
Next
Collapse