Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add component guidelines #9

Draft
wants to merge 1 commit into
base: library/primeng
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions component-guidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Component Guidelines

Guidelines with the 🤖 emoji are enforced through CI checks.

- Keep custom components/CSS to a minimum.
- Use [PrimeNG](https://primeng.org/) components whenever possible
- A design might contain something that, with a few tweaks, could use a PrimeNG component instead of a custom one. Always prefer to push for and suggest those tweaks.
- Use [Tailwind](https://tailwindcss.com) utility classes instead of (s)css files
- When creating new components, delete the automatically generated (s)css files
- Follow the tailwind recommendations for [reusing styles](https://tailwindcss.com/docs/reusing-styles)
- Delete auto-generated spec files unless they are meaningful
- 🤖 All components must be standalone
- 🤖 All components must use the "OnPush" change detection strategy, to support [zoneless change detection](https://angular.dev/guide/experimental/zoneless)
- Use the [new syntax for control flow](https://angular.dev/guide/templates/control-flow) rather than structural directives
- ie. prefer @if and @for over NgIf and NgFor
- Do not abstract by default
- ie. only pull out a component into a separate file when you are certain it will be re-used, or when you are trying to re-use it in a different component
- Nest page-specific components & services within the page folder