mkosir/react-demo-tab

πŸ“‘ Easily create React demo components

47

stars

254

commits

TypeScript

primary language

May 12, 2025

updated

demozap.github.io/react-demo-tab/
demo-tab
demotab
react
react-demo
react-demo-tab

README

React DemoTab πŸ“‘

npm version CI semantic-release TypeScript

Easily create React demo components

Demo

Install

npm install react-demo-tab

Example

import ReactDOM from 'react-dom';
import DemoTab from 'react-demo-tab';
import DemoComponent from './ButtonGreen';

const demoCode = `
import './ButtonGreen.css';

const ButtonGreen = () => <button className="btn-green">Green Button</button>;
export default ButtonGreen;`;

const demoStyle = `
.btn-green {
  background-color: green;
  font-size: 14px;
  padding: 12px 26px;
  border-radius: 6px;
}`;

const App = () => {
  return (
    <DemoTab code={demoCode} style={demoStyle}>
      <DemoComponent />
    </DemoTab>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));

Props

Create demo of component that is passed as a child.

Below is the complete list of possible props and their options:

β–ΆοΈŽ indicates optional prop with default value

code: string
Demo code. Required.

style: string β–ΆοΈŽ undefined
Demo style.

codeExt: 'jsx' | 'tsx' β–ΆοΈŽ jsx
Code file extension for image to be displayed.

styleExt: 'css' | 'scss' β–ΆοΈŽ css
Style file extension for image to be displayed.

Create demos with CLI

Instead of manually creating demos, automate the process with DemoZap CLI.

Development

Easily set up a local development environment!

Build project and start storybook on localhost:

  • clone
  • npm install
  • npm start

Start coding! πŸŽ‰

Built with DemoTab

Contributing

All contributions are welcome!

Contributors

mkosir

254 commits

mkosir/react-demo-tab

πŸ“‘ Easily create React demo components

47

stars

254

commits

TypeScript

primary language

May 12, 2025

updated

demozap.github.io/react-demo-tab/
demo-tab
demotab
react
react-demo
react-demo-tab

README

React DemoTab πŸ“‘

npm version CI semantic-release TypeScript

Easily create React demo components

Demo

Install

npm install react-demo-tab

Example

import ReactDOM from 'react-dom';
import DemoTab from 'react-demo-tab';
import DemoComponent from './ButtonGreen';

const demoCode = `
import './ButtonGreen.css';

const ButtonGreen = () => <button className="btn-green">Green Button</button>;
export default ButtonGreen;`;

const demoStyle = `
.btn-green {
  background-color: green;
  font-size: 14px;
  padding: 12px 26px;
  border-radius: 6px;
}`;

const App = () => {
  return (
    <DemoTab code={demoCode} style={demoStyle}>
      <DemoComponent />
    </DemoTab>
  );
};

ReactDOM.render(<App />, document.getElementById('root'));

Props

Create demo of component that is passed as a child.

Below is the complete list of possible props and their options:

β–ΆοΈŽ indicates optional prop with default value

code: string
Demo code. Required.

style: string β–ΆοΈŽ undefined
Demo style.

codeExt: 'jsx' | 'tsx' β–ΆοΈŽ jsx
Code file extension for image to be displayed.

styleExt: 'css' | 'scss' β–ΆοΈŽ css
Style file extension for image to be displayed.

Create demos with CLI

Instead of manually creating demos, automate the process with DemoZap CLI.

Development

Easily set up a local development environment!

Build project and start storybook on localhost:

  • clone
  • npm install
  • npm start

Start coding! πŸŽ‰

Built with DemoTab

Contributing

All contributions are welcome!

Contributors

mkosir

254 commits

Languages

TypeScript

71.7%

JavaScript

23.8%

SCSS

2.9%

CSS

1.6%