Component โ
Skaya's AI-powered component generator accelerates UI development with smart, context-aware scaffolding. Generate production-ready components with integrated testing, styling, and documentation in seconds.
Prerequisites
This guide assumes knowledge of:
- Basic Skaya project initialization
- Fundamental React concepts
Key Features โ
Feature | Description |
---|---|
๐ค AI-Powered | Context-aware generation with dynamic prop/state suggestions |
๐ Language Support | TypeScript (tsx ) with strict typing enforcement |
๐จ Styling Options | CSS | SCSS | styled-components | Tailwind |
๐งช Test Coverage | Auto-generated Jest/Vitest + Storybook stories |
๐ Dependency Import | Seamlessly import existing components and APIs |
Every component includes:
- โ Core component file with TypeScript interface
- โ Storybook integration for visual testing
- โ Unit tests with sample test cases
- โ Style file (CSS/SCSS) or CSS-in-JS setup
Creating Components โ
Interactive Mode โ
bash
skaya create
# Follow the interactive prompts
Direct Generation โ
bash
skaya create component --project frontend --filename WalletButton
Quick Start with npx โ
bash
npx skaya create component -p frontend -f WalletButton
Advanced Configuration
Custom Template Setup (Coming in v2.0) โ
skaya create component --template path/to/template.json
Example Workflow with Custom imports โ
1: Initiate Creation โ
bash
skaya create component -f WalletButton
2: Configuration โ
bash
โ Enter the folder where you want to create the component for Walletbutton:
myapp/src/components
โ Use AI to generate the component? Yes
? Select which required components you would like to import:
(Press <space> to select, <a> to toggle all, <i> to invert selection)
โ component
โฏ โฏ api
You can select existing components or APIs to import into your newly generated component, allowing for seamless integration and reusability. For instance, you might want to import a Walletbutton
component and a Login
API into a new NftCard
component.
- Learn how to create Apis in our Api Create Guide.
3. Import Custom Selection โ
A. Import BuiltIn Componenet โ
bash
โ Select which required components you would like to import: component, api
? Select component components to import:
(Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)
โฏโ Walletbutton
B. Import BuiltIn Apis โ
bash
โ Select component components to import: Walletbutton
? Select api components to import:
โฏโ Login
4. Ai Prompt Specification For Component Generation โ
bash
โ Select component components to import: Walletbutton
โ Select api components to import: Login
--- Dependencies to be imported ---
Dependencies (component):
- Walletbutton
Dependencies (api):
- Login
-------------------------------------------------
? Enter AI Prompt on how the files and code should work: Import the walletconenctbutton and use login api to create a nftcard
5. File Generation Output โ
bash
โ
component file created at myapp/src/components/Walletbutton/Walletbutton.tsx
โ
component file created at myapp/src/components/Walletbutton/Walletbutton.stories.tsx
โ
component file created at myapp/src/components/Walletbutton/Walletbutton.test.tsx
โ
component file created at myapp/src/components/Walletbutton/Walletbutton.css
Key Notes โ
1. When using AI generation: โ
- You can import existing components if needed, fostering a modular and reusable codebase.
- Provide clear, specific prompts for best results, especially when defining how imported components or APIs should interact.
- Generated files include tests and stories by default.
2. Folder structure: โ
- Components are created in PascalCase
- Test/story files are automatically paired
- CSS modules are generated by default
Import Behavior โ
- Automatic Props Binding: Imported components' props are automatically wired
- API Hook Generation: Required API hooks are generated with proper typing
- Dependency Tracking: All imports are tracked in the component's metadata
Updating Components โ
Learn how to modify existing components in our Component Update Guide.