Create New Component
Create a new React component following project conventions.
Initialization
When invoked:
- •Read
.claude/docs/component-reference.mdto check if a Common component already handles the need - •Read
.claude/docs/project-rules.mdfor project conventions
Instructions
- •Parse the component name from
$ARGUMENTS - •Determine the file path:
- •If name includes
/, treat the first part as a subfolder - •Create in
src/components/
- •If name includes
- •Before creating: Check
docs/component-reference.mdto verify no existing Common component handles this use case - •Create the component file with:
- •Proper TypeScript types for props
- •Functional component using React hooks if needed
- •MUI styling patterns (use theme values, never hardcoded colors/fonts)
- •Named export (not default)
- •If the component needs types, add them to
src/types/or inline
Template
tsx
import { type FC } from "react";
import { Box } from "@mui/material";
interface ComponentNameProps {
// Add props here
}
export const ComponentName: FC<ComponentNameProps> = (props) => {
return <Box>{/* Component content */}</Box>;
};
Conventions
- •Use
CommonButton(not rawButton),CTAButtonfor blockchain actions - •Use Common input components (not raw
TextField) - •Use theme palette references for colors (
color="text.secondary") - •Use Typography variants for text (never inline
fontSize/fontWeight) - •Use
NumberFormatterordisplayNumberfor formatted numbers
Verification
After creating the component:
bash
yarn typecheck && yarn lint && yarn prettier && yarn build