This document defines the rules for writing consistent and maintainable UI components.
- Use PascalCase for component files (e.g.,
NavBar.tsx,UserCard.tsx). - Group components inside the
/componentsdirectory. - Avoid unnecessary abbreviations (
Btn❌ →Button✅).
- Component names must match their file names.
- Always use PascalCase for React components (
ProfileCard,DashboardLayout). - Keep component names descriptive and meaningful.
- Use Tailwind CSS for styling.
- Maintain consistent spacing and sizing (
p-4,m-2,text-lg). - Avoid mixing Tailwind with inline styles unless necessary.
- Reuse utility classes instead of writing custom CSS when possible.
- Use clear, descriptive names (
isOpen,onSubmit,userData). - Boolean props should start with
isorhas(isVisible,hasError). - Keep prop lists minimal and focused.
- Keep components small and reusable.
- Separate logic from presentation where possible.
- Follow consistent formatting with Prettier/ESLint.
- Use meaningful commit messages when updating UI components.