NG Kit

Buttons

Custom button directives built on top of Angular Material buttons. ng-kit adds ready-made button types — primary, success, edit, delete, export and more — each with additional styling, icons and loading state on top of the shared BaseButtonDirective. Pick a button from the navigation to see its live demo and source.

A BaseButtonDirective provides common functionality and styling for all button types; every ng-kit button extends this base. Apply a button directive to any existing HTML element for cleaner markup and more flexibility:

html
<button ariaLabel="Submit" (click)="onSubmit()" primaryButton mat-raised-button>Submit</button>

API

All buttons share the inputs and outputs of the base button. Directive selectors are attribute-based (e.g. primaryButton).

Common inputs

NameTypeDefaultDescription
labelstring'Save'Text shown on the button (per-button defaults vary)
iconstringper buttonMaterial icon name rendered before the label
showIconbooleantrueWhether the leading icon is rendered
disabledbooleanfalseDisables the button
loadingbooleanfalseShows a spinner and the loading label; disables the button
loadingLabelstring'Saving...'Text shown while loading is true
type'button' | 'submit''button'Native button type

The base directive exposes icon, label, loading and loadingLabel.

Outputs

NamePayloadDescription
onClickMouseEventButton was clicked
onFocus / onBlurFocusEventButton gained / lost focus
onKeyDown / onKeyUpKeyboardEventKey pressed / released while focused