I'll build a comprehensive Roblox-style avatar creator with interchangeable SVG parts. Let me start by exploring the project structure and then build everything out.
Good. Now let me build the entire avatar creator. I'll create a well-structured application with:
- SVG asset components for each body part
- A state management system for the avatar configuration
- A color picker system
- An equipped items panel
- Category selection panels
Let me create all the files:
Now let me create the types file first:
Now let me create the avatar assets/SVG components. This is the most critical part - each SVG must be proportioned correctly:
Now the SVG renderer component:
Let me fix the unused import:
Now let me create the color picker component:
Now the part selector grid:
Now the equipped items panel:
Now let me create the main AvatarCreator component with all the state management:
Let me fix those unused variables:
Now update App.tsx:
Now let me build to check for any errors:
The build succeeds. Now let me verify the application works correctly by reviewing the critical files and making sure proportions align. Let me also add some polish - I want to make sure all SVG parts properly align with the body. Let me review the AvatarRenderer and fix the layering order to make sure everything renders correctly:
The SVG rendering looks good. Now let me also make sure the equipped panel shows an "x" remove button properly. Let me also add a few more improvements - I want the visual experience to be really polished. Let me update the EquippedPanel to be more descriptive and ensure the toggle between category tabs works smoothly. Let me also refine the avatar parts for better proportions:
The build passed. Let me now refine the avatar parts to ensure all proportions match perfectly. The key issue is that all part transforms must align with the body coordinates. Let me review the coordinate system:
- Head: transform(100, 20), rect(-35, 0, 70, 70) - sits at y=20 to y=90
- Neck: transform(100, 90), rect(-10, 0, 20, 10) - y=90 to y=100
- Torso: transform(100, 100), rect(-30, 0, 60, 58) - y=100 to y=158
- Legs: transform(100, 158), rect(-14, 0, 12, 55) and rect(2, 0, 12, 55) - y=158 to y=213
- Shoes: transform(100, 210) - overlaps with bottom of legs
This all checks out. The pants at transform(100, 158) will cover legs properly. The shoes at transform(100, 210) will sit at the bottom.
Now let me make sure the head parts match. Hair at transform(100, 18), eyes at (100, 45), mouth at (100, 62). The head is from y=20 to y=90 in world coords. Inside the head group, eyes at y=45 means absolute y=20+45=65, which is halfway through the head. That's correct.
Let me do one more build to ensure everything is clean:
The build is successful. Let me now verify the overall file structure is clean:
Everything is in place. Let me verify the key files once more to make sure the application is complete and working. Let me quickly check that the avatar-part none options have correct empty SVG strings and the flow for removing items works properly:
Good - all the "none" options have empty SVG strings. The application is complete. Let me provide a summary:
The avatar creator is built and working. Here's what was created:
Files Structure
src/types.ts — Type definitions for AvatarPart, AvatarConfig, EquippedItem, ColorOption, and PartCategory
src/assets/avatar-parts.tsx — All SVG assets organized by category with precise coordinate proportions
src/components/AvatarRenderer.tsx — SVG renderer that composites body parts in correct z-order (legs → pants → shoes → arms → torso → top → neck → head → hair → eyes → mouth → accessories)
src/components/PartSelector.tsx — Grid of part thumbnails for the active category, with visual previews
src/components/ColorPicker.tsx — Circular color swatch picker
src/components/EquippedPanel.tsx — Lists equipped items with hover-to-remove (X button)
src/components/AvatarCreator.tsx — Main app with state management, category tabs, color pickers, randomize & reset buttons
src/App.tsx — Entry point rendering AvatarCreator
Features
- 8 categories: Hair, Eyes, Mouth, Top, Pants, Shoes, Head Accessory, Face Accessory
- 40+ interchangeable parts across all categories
- Color customization: Skin tone (8 tones), hair (16 colors), eyes (12 colors), clothing (16 colors)
- Randomize button: Generates a completely random avatar
- Reset button: Returns to default avatar
- Equipped items panel: Shows all equipped items with one-click removal
- Roblox-style blocky proportions with consistent coordinate system (200×320 viewBox)
- All SVG parts use
currentColor for dynamic coloring, replaced at render time
Files built: index.html, src/types.ts, src/assets/avatar-parts.tsx, src/components/AvatarRenderer.tsx, src/components/ColorPicker.tsx, src/components/PartSelector.tsx, src/components/EquippedPanel.tsx, src/components/AvatarCreator.tsx, src/App.tsx