CustomButtons component renders a list of customizable buttons.

app-custom-buttons

true

[CommonModule, FormsModule, FontAwesomeModule]

buttons - Array of button configurations. Each button configuration includes properties such as:

  • action: Function executed on button click.
  • show: Boolean or function determining button visibility.
  • backgroundColor: Background color of the button.
  • disabled: Boolean to disable button if set to true.
  • icon: Optional FontAwesome icon displayed on the button.
  • iconStyle: Style applied to the icon.
  • text: Text displayed on the button.
  • textStyle: Style applied to the text.
  • customComponent: A custom Angular component or HTML element rendered within the button.
  • injector: Injector used for providing dependencies to the custom component.
<app-custom-buttons [buttons]="buttonsArray"></app-custom-buttons>
const buttonsArray: CustomButton[] = [
{
action: () => console.log('Button 1 clicked'),
show: true,
backgroundColor: 'blue',
disabled: false,
icon: faCoffee,
iconStyle: { color: 'white' },
text: 'Button 1',
textStyle: { color: 'white' },
customComponent: <CustomComponent />,
injector: Injector.create({
providers: [{ provide: 'customProp', useValue: 'customValue' }]
}),
},
];

CustomButtons

mergeStyles - Merges default styles with user-provided custom styles.

isCustomComponentConfig - Type guard to check if an object is of type CustomComponent.

Accessors

Constructors

Methods

Properties

buttons: CustomButton[]
faSpinner: IconDefinition = faSpinner