๐Ÿ“ฆ ionic-team / ionic-docs

๐Ÿ“„ back-button.md ยท 67 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67---
title: 'ion-back-button'
---

import Props from '@ionic-internal/component-api/v7/back-button/props.md';
import Events from '@ionic-internal/component-api/v7/back-button/events.md';
import Methods from '@ionic-internal/component-api/v7/back-button/methods.md';
import Parts from '@ionic-internal/component-api/v7/back-button/parts.md';
import CustomProps from '@ionic-internal/component-api/v7/back-button/custom-props.mdx';
import Slots from '@ionic-internal/component-api/v7/back-button/slots.md';

<head>
  <title>ion-back-button: Custom Menu Back Button for Applications</title>
  <meta
    name="description"
    content="The ion-back-button is a custom menu icon for Android, iOS, and Progressive Web Apps. Use Ionic Framework components to easily build applications."
  />
</head>

import EncapsulationPill from '@components/page/api/EncapsulationPill';

<EncapsulationPill type="shadow" />

The back button navigates back in the app's history when clicked. It is only displayed when there is history in the navigation stack, unless [`defaultHref`](#default-back-history) is set. The back button displays different text and icon based on the mode, but this can be customized.

## Basic Usage

import Basic from '@site/static/usage/v7/back-button/basic/index.md';

<Basic />

## Custom Back Button

By default, the back button will display the text `"Back"` with a `"chevron-back"` icon on `ios`, and an `"arrow-back-sharp"` icon on `md`. This can be customized per back button component by setting the `icon` or `text` properties. Alternatively, it can be set globally using the `backButtonIcon` or `backButtonText` properties in the global config. See the [Config docs](../developing/config) for more information.

import Custom from '@site/static/usage/v7/back-button/custom/index.md';

<Custom />

## Default Back History

Occasionally an app may need to show the back button and navigate back when there is no history. This can be done by setting the `defaultHref` on the back button to a path. In order to use `defaultHref`, the app must contain a router with paths set.

## Properties

<Props />

## Events

<Events />

## Methods

<Methods />

## CSS Shadow Parts

<Parts />

## CSS Custom Properties

<CustomProps />

## Slots

<Slots />