Components Buttons Base Button

Base Button

The Base Button component provides the foundation for all button components in ng-kit. It encapsulates common button logic, accessibility, and styling.

Description

The Base Button is a reusable, accessible button component that supports custom content, ARIA attributes, and keyboard interactions. All other button components extend this base.

Usage

The Base Button is not intended to be used directly. Instead, extend it to create custom button components with specific styles and behaviors.

API Reference

The Base Button component exposes the following inputs and outputs

Inputs

All of these are Angular signal inputs.

NameTypeDefaultDescription
loadingbooleanfalseShow loading state (disables button, shows spinner)
disabledbooleanfalseDisable the button
type'button' | 'submit''button'Button type attribute
loadingLabelstring'Saving...'Label to show when loading
labelstring'Save'Button label
iconstring'save'Material icon name to display
showIconbooleantrueShow/hide icon
styleanynullInline style object
classesstring'btn'CSS classes to apply
dataCystring'save-button'data-cy attribute for testing

Outputs

NameTypeDescription
onClickMouseEventEmits when button is clicked
onFocusFocusEventEmits when button is focused
onBlurFocusEventEmits when button is blurred
onKeyDownKeyboardEventEmits when key is pressed down on button
onKeyUpKeyboardEventEmits when key is released on button