# new BackButtonComponent()
The BackButtonComponent provides a standardized back navigation button with customizable appearance and behavior. It supports both traditional browser back navigation and custom navigation logic through function callbacks. The component integrates with Angular's Location service for browser history management and provides event emission capabilities for external components to react to navigation actions.
Key features include:
- Customizable appearance with Ionic color schemes
- Prevention of default navigation behavior for custom handling
- Event emission for external component integration
- Support for custom navigation targets (URLs or functions)
- Configurable text display alongside the icon
- Integration with browser history API
Back button component for navigation within Angular applications.
Example
```html
<!-- Basic back button -->
<app-back-button></app-back-button>
<!-- Custom colored back button with text -->
<app-back-button
color="secondary"
showText="true"
text="Go Back">
</app-back-button>
<!-- Back button with custom navigation -->
<app-back-button
[link]="customBackFunction"
preventDefault="true">
</app-back-button>
<!-- Back button that navigates to specific URL -->
<app-back-button
link="/dashboard"
direction="forward">
</app-back-button>
```
Members
ElementRef
# component
Provides direct access to the native DOM element of the component through Angular's ViewChild decorator. This reference can be used to manipulate the DOM element directly, apply custom styles, or access native element properties and methods. The element is identified by the 'component' template reference variable.
Reference to the component's native DOM element.
boolean
# protected isDarkMode
When enabled, the component will automatically detect the system's dark mode preference using the media service and apply appropriate styling classes. This flag controls whether the component should respond to dark mode changes and apply the dark palette class to its DOM element. By default, dark mode support is disabled.
Flag to enable or disable dark mode support for the component.
- Default Value:
- false
View Source app/components/back-button/back-button.component.ts, line 111