dgangularbtn
v1.1.0
Published
A simple Angular standalone button component package for Angular 17.
Readme
Button Package
A simple Angular standalone button component package for Angular 17.
Installation
Install the package using npm:
npm install button-packageUsage
Import the Component
Since the button component is standalone, you can directly import it in your main.ts or any other component.
Example with Standalone Application:
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { ButtonComponent } from 'button-package';
bootstrapApplication(AppComponent, {
providers: [],
imports: [ButtonComponent],
});Example with Standalone Component:
import { Component } from '@angular/core';
import { ButtonComponent } from 'button-package';
@Component({
selector: 'app-root',
standalone: true,
template: `
<lib-button label="Submit" backgroundColor="#28a745" textColor="#fff"></lib-button>
`,
imports: [ButtonComponent],
})
export class AppComponent {}Template Usage
Add the <lib-button> component to your templates:
<lib-button label="Submit" backgroundColor="#28a745" textColor="#fff"></lib-button>Input Properties
| Property | Type | Default | Description |
|-----------------|----------|-------------|-----------------------------------------|
| label | string | "Click Me" | The text to display on the button. |
| backgroundColor | string | "#007bff" | Background color of the button. |
| textColor | string | "#fff" | Text color of the button. |
Output
The button logs a message ("Button clicked!") to the console when clicked.
Development
To modify the library, clone the repository and navigate to the project folder:
git clone <your-repo-url>
cd angular-button-packageBuild the Library
ng build button-packageRun a Test Application
You can create a test Angular app in the workspace to test the library locally.
License
This project is licensed under the MIT License. See the LICENSE file for details.
