sliceit

A CLI tool to generate React components with custom templates (JS, JSX, TSX, CSS, SCSS, Styled Components)

๐Ÿงฉ sliceit โ€“ React Component Generator CLI

sliceit is a lightweight and powerful CLI tool for generating complete React component slices โ€” including JSX, CSS, and optional test files โ€” in seconds.
Save time, stay consistent, and boost your productivity while building modern React apps.


๐Ÿš€ Features

  • ๐Ÿ”ง Quickly scaffold React components
  • ๐ŸŽจ Includes a CSS file with basic structure
  • ๐Ÿงช Optionally generate a Jest/RTL test
  • ๐Ÿ“ Creates everything in its own component folder
  • ๐Ÿ’ก Easy to use, minimal setup

๐Ÿ“ฆ Installation

npm install -g sliceit

๐Ÿ› ๏ธ Usage

sliceit create <ComponentName> [--jsx | --tsx | --js] [--css | --scss | --styled] [--with-test]
sliceit create <ComponentName> - this asks for prompt creation

๐Ÿ“Œ Notes

  • ๐Ÿ“ The component folder will be created in the current working directory.
  • โœ… Make sure you're in the correct folder before running the command.

๐Ÿ“„ Example

sliceit create Button --jsx --styled --with-test

Generates:

Button/
โ”œโ”€โ”€ Button.jsx
โ”œโ”€โ”€ Button.styled.js
โ”œโ”€โ”€ __tests__/
โ”‚   โ””โ”€โ”€ Button.test.jsx

โš™๏ธ Configuration

You can optionally configure sliceit with a config file in your project root to avoid passing flags each time.

โž• Example: sliceit.config.json

{
"template": "tsx",
"style": "scss",
"withTest": true
}

Default command will pick up tags from config file. If there is no config file it will start default prompt.

sliceit create Button

๐Ÿ™Œ Support

If you find SliceIt helpful, consider supporting its development:

Buy Me A Coffee

Thank you for your support!

๐Ÿง  Future Plans

๐Ÿ—‚๏ธ Choose between different folder structures or templates

๐Ÿ“ฆ Component export indexing

๐Ÿงฉ VS Code Extension

๐Ÿ”Œ Plugin system for advanced customization

๐Ÿ“š Storybook generation (planned for v2)