Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Next-Level UI Development with PrimeNG

You're reading from   Next-Level UI Development with PrimeNG Master the versatile Angular component library to build stunning Angular applications

Arrow left icon
Product type Paperback
Published in Mar 2024
Publisher Packt
ISBN-13 9781803249810
Length 356 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dale Nguyen Dale Nguyen
Author Profile Icon Dale Nguyen
Dale Nguyen
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Introduction to PrimeNG
2. Chapter 1: Introducing Angular and PrimeNG: A Powerful Combination FREE CHAPTER 3. Chapter 2: Setting Up Your Development Environment 4. Chapter 3: Utilizing Angular’s Features and Improvements 5. Chapter 4: Integrating PrimeNG into Your Angular Project 6. Part 2: UI Components and Features
7. Chapter 5: Introducing Input Components and Form Controls 8. Chapter 6: Working with Table, List, and Card Components 9. Chapter 7: Working with Tree, TreeTable, and Timeline Components 10. Chapter 8: Working with Navigation and Layout Components 11. Part 3: Advanced Techniques and Best Practices
12. Chapter 9: Customizing PrimeNG Components with Theming 13. Chapter 10: Exploring Optimization Techniques for Angular Applications 14. Chapter 11: Creating Reusable and Extendable Components 15. Chapter 12: Working with Internationalization and Localization 16. Chapter 13: Testing PrimeNG Components 17. Part 4: Real-World Application
18. Chapter 14: Building a Responsive Web Application 19. Index 20. Other Books You May Enjoy

Creating reusable and extendable components

As a developer, one of our key goals is to write clean, maintainable, and reusable code. In this section, we will explore the concept of creating reusable and extendable components. We’ll take an example of a block from PrimeBlocks and discuss how we can make it more flexible and adaptable for different use cases.

Here is the Stats block from PrimeBlocks with four different stats:

Figure 11.6 – PrimeBlocks Stats

Figure 11.6 – PrimeBlocks Stats

After clicking the Code button, we can see that there are four different elements for four stats, which can be reduced and reused:

Figure 11.7 – PrimeBlocks Stats code

Figure 11.7 – PrimeBlocks Stats code

The provided image showcases four stats in the UI (labeled from 1 to 4), each created using nearly identical HTML blocks. This approach results in repetition and makes maintenance challenging. For instance, if you need to make styling changes, you would have to modify the code in...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime