Published onA very common and useful directive that we can create is a simple debounce directive. If you’re not familiar with debouncing, it essentially will discard events or values until a specified time has ellapsed between the emission of those events/values. This is commonly used to prevent spam button clicks or spamming an API call from a autocomplete/search input. We’re going to create two debounce directives, one to debounce key up events that will be used on input elements and another to debounce button clicks.
Angular Component Library
Published onWe can use the same process as we did with the toggle to create other form controls as well. We’ll create a similar control to the toggle but it will visually resemble a checkbox. A full screen demo of we’re going to build Prerequisites Install Node Install Angular CLI Creating an Angular Component Library - Workspace Setup OR Clone this github repository Generating Our Checkbox For our checkbox we will need to generate a module, component and several enum values which we will use to provide different values to customize our checkbox based on size, shape, color and label position.
Published onA common recurring component that is used quite often are toggle switches. A toggle switch functions similar to a checkbox, where we essentially have two state, on/of, checked/unchecked, etc. This will be one of many form controls we will create for our library. We are also going to learn about Angular’s ControlValueAccessor interface and see how we can create custom form controls to work with both template driven and reactive forms.
Published onThe next component we going to look at building is a button component. Our button component will be an attribute component that provides styling to an existing HTML element. A full screen demo of what we’re going to build. Prerequisites Install Node Install Angular CLI Creating an Angular Component Library - Workspace Setup OR Clone this github repository Generate Our Button For our button we will need to generate a module, a component, a few different enums for configurations, and a few additional SCSS files for our stylings.
Published onAnother useful component that you might commonly see is a slide out side panel. Right now at my current position we’re using Monday for project/task management and communication. If you’ve ever used Monday, clicking on a task item will slide out a side panel from the right where all communication for that task is displayed. This has inpsired me to recreate this feature as an reusable Angular component. A full screen demo of what we’re going to build.
Published onAnother simple component we can build for our library is a overlay loader component. This is a component you might use when first loading a page or loading new data for a page and want to disable the entire screen while the page/data is loading. A full screen demo of what we’re going to build. Prerequisites Install Node Install Angular CLI Creating an Angular Component Library - Workspace Setup OR Clone this github repository Generate Our Overlay Loader First we will generate a new module and a component for our page loader.
Published onIn the last post we created a very basic card component. Now we’re going to expand on that card component and create a more interactive flip card. You can think of a flip card as a index/flash card where you might have some content on the front side, then can be toggled/flipped over with additional content on the back side of the card. We will make our flip card have a configuration where we can set the axis we want the card to flip around, X or Y.
Published onA card component is something that you might use quite a bit in a project. We are going to build a very basic card component that doesn’t really do anything fancy to start. It will be made up of a header, body, and footer. In subsequent post will expand on our card component and create a couple fancier forms of cards using animations. A full screen demo of what we’re going to build
Published onThe next component we are going to create for our component library is a toaster. A toaster is essentially a component where can give the use feedback in a non disruptive way. A small message will appear on the screen with a notification message. Generally toast messages appear in one of the corners of screen. Our approach for this component will be similar to how we created a progress bar. We will use a service to push new toast messages to our toaster component.
Published onAnother common component you might use in an application is a progress bar. There are a few types of progress bars one being the general bootstrap style. Another one that I’m starting to see more frequently is the style positioned to the top of the page with an animation spanning the full width of the page similar to YouTube. This is the type we’re going to create. A full screen demo of what we’re going to build