1.3.9 • Published 1 year ago

react-demo-tab v1.3.9

Weekly downloads
4
License
MIT
Repository
github
Last release
1 year ago

React DemoTab 📑

npm version CI semantic-release prettier TypeScript

React component to easily create demos of other components

Demo

Install

npm install react-demo-tab

Example

npm.io

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

const demoCode = `
import React from 'react';
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!

1.3.9

1 year ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.8

2 years ago

1.2.0

2 years ago

1.0.2

2 years ago

1.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.9

2 years ago

1.3.5

2 years ago

1.0.8

2 years ago

1.3.4

2 years ago

1.0.7

2 years ago

1.3.3

2 years ago

1.0.6

2 years ago

1.3.2

2 years ago

1.0.5

2 years ago

1.3.1

2 years ago

1.0.4

2 years ago

1.3.0

2 years ago

1.0.3

2 years ago

1.0.10

2 years ago

1.2.18

4 years ago

1.2.17

4 years ago

1.2.16

4 years ago

1.2.15

4 years ago

1.2.14

4 years ago

1.2.13

4 years ago

1.2.1

4 years ago