Code

Show source code in a standardized way. Want to display shell code snippets? try Snippet.

General

Basic inline codes.

Preview
See code

Run npm i @bolio-ui/core to install.

Or run yarn add @bolio-ui/core to install.

Code Block

Multi line code display.

Preview
See code
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;

Width

Specify width manually, or other styles.

Preview
See code
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;

Name

Specify the file name for the code block.

Preview
See code
/Components/WaitTime.jsx
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;

Classic Style

The classic design style with a line border instead of a background.

Preview
See code
/Components/WaitTime.jsx
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;

APIs

Code.Props

AttributeDescriptionTypeAccepted valuesDefault
blockshow code in preboolean-false
nametext displayed at the top of the code blockstring--
classicdisplay with classic styleboolean-false
...native propsHTMLAttributes'className', ...-
Edit this page on GitHub

Previous

Checkbox

Next

Collapse

MADE & DESIGNED WITHBY BRUNO ANDRADE
docs background gradient blue
docs background gradient violet