-
Notifications
You must be signed in to change notification settings - Fork 3.2k
docs(badge, tab-bar): add playground to show usage of badges in tab-bar #4045
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6961aa0
docs(badge, tab-bar): add playground to show usage of badges in tab-bar
thetaPC e40fbf2
Update docs/api/tab-bar.md
thetaPC 83580a4
Update docs/api/badge.md
thetaPC 5ad9d13
Update docs/api/badge.md
thetaPC b6cda19
Update docs/api/tab-bar.md
thetaPC d911ff3
docs(bagdge): add plain tab button
thetaPC 445d70d
docs(badge): add label for consistency
thetaPC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
static/usage/v8/badge/inside-tab-bar/angular/example_component_html.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
```html | ||
<ion-tab-bar color="light"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge color="danger"></ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
<ion-label>Music</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="calendar"></ion-icon> | ||
<ion-label>Calendar</ion-label> | ||
<ion-badge color="danger">47</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
``` |
23 changes: 23 additions & 0 deletions
23
static/usage/v8/badge/inside-tab-bar/angular/example_component_ts.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
```ts | ||
import { Component } from '@angular/core'; | ||
import { IonBadge, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/angular/standalone'; | ||
import { addIcons } from 'ionicons'; | ||
import { heart, calendar, musicalNote } from 'ionicons/icons'; | ||
|
||
@Component({ | ||
selector: 'app-example', | ||
templateUrl: 'example.component.html', | ||
styleUrls: ['./example.component.css'], | ||
imports: [IonBadge, IonTabBar, IonTabButton, IonIcon, IonLabel], | ||
}) | ||
export class ExampleComponent { | ||
constructor() { | ||
/** | ||
* Any icons you want to use in your application | ||
* can be registered in app.component.ts and then | ||
* referenced by name anywhere in your application. | ||
*/ | ||
addIcons({ heart, calendar, musicalNote }); | ||
} | ||
} | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Badge</title> | ||
<link rel="stylesheet" href="../../common.css" /> | ||
<script src="../../common.js"></script> | ||
<script type="module" src="https://cdn.jsdelivr.net/npm/@ionic/core@8/dist/ionic/ionic.esm.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ionic/core@8/css/ionic.bundle.css" /> | ||
|
||
<style> | ||
ion-tab-bar { | ||
flex: 1; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-content> | ||
<div class="container"> | ||
<ion-tab-bar color="light"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge color="danger"></ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
<ion-label>Music</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="calendar"></ion-icon> | ||
<ion-label>Calendar</ion-label> | ||
<ion-badge color="danger">47</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
</div> | ||
</ion-content> | ||
</ion-app> | ||
</body> | ||
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Playground from '@site/src/components/global/Playground'; | ||
|
||
import javascript from './javascript.md'; | ||
import react from './react.md'; | ||
import vue from './vue.md'; | ||
|
||
import angular_example_component_html from './angular/example_component_html.md'; | ||
import angular_example_component_ts from './angular/example_component_ts.md'; | ||
|
||
<Playground | ||
version="8" | ||
code={{ | ||
javascript, | ||
react, | ||
vue, | ||
angular: { | ||
files: { | ||
'src/app/example.component.html': angular_example_component_html, | ||
'src/app/example.component.ts': angular_example_component_ts, | ||
}, | ||
}, | ||
}} | ||
src="usage/v8/badge/inside-tab-bar/demo.html" | ||
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
```html | ||
<ion-tab-bar color="light"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon name="heart"></ion-icon> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge color="danger"></ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon name="musical-note"></ion-icon> | ||
<ion-label>Music</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon name="calendar"></ion-icon> | ||
<ion-label>Calendar</ion-label> | ||
<ion-badge color="danger">47</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
```tsx | ||
import React from 'react'; | ||
import { IonBadge, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/react'; | ||
import { heart, calendar, musicalNote } from 'ionicons/icons'; | ||
|
||
function Example() { | ||
return ( | ||
<> | ||
<IonTabBar color="light"> | ||
<IonTabButton tab="tab1"> | ||
<IonIcon icon={heart} /> | ||
<IonLabel>Favorites</IonLabel> | ||
<IonBadge color="danger"></IonBadge> | ||
</IonTabButton> | ||
<IonTabButton tab="tab2"> | ||
<IonIcon icon={musicalNote} /> | ||
<IonLabel>Music</IonLabel> | ||
</IonTabButton> | ||
<IonTabButton tab="tab3"> | ||
<IonIcon icon={calendar} /> | ||
<IonLabel>Calendar</IonLabel> | ||
<IonBadge color="danger">47</IonBadge> | ||
</IonTabButton> | ||
</IonTabBar> | ||
</> | ||
); | ||
} | ||
export default Example; | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
```html | ||
<template> | ||
<ion-tab-bar color="light"> | ||
<ion-tab-button tab="1"> | ||
<ion-icon :icon="heart" /> | ||
<ion-label>Favorites</ion-label> | ||
<ion-badge color="danger"></ion-badge> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="2"> | ||
<ion-icon :icon="musicalNote" /> | ||
<ion-label>Music</ion-label> | ||
</ion-tab-button> | ||
|
||
<ion-tab-button tab="3"> | ||
<ion-icon :icon="calendar" /> | ||
<ion-label>Calendar</ion-label> | ||
<ion-badge color="danger">47</ion-badge> | ||
</ion-tab-button> | ||
</ion-tab-bar> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { IonBadge, IonTabBar, IonTabButton, IonIcon, IonLabel } from '@ionic/vue'; | ||
import { heart, calendar, musicalNote } from 'ionicons/icons'; | ||
import { defineComponent } from 'vue'; | ||
|
||
export default defineComponent({ | ||
components: { | ||
IonBadge, | ||
IonTabBar, | ||
IonTabButton, | ||
IonIcon, | ||
IonLabel, | ||
}, | ||
setup() { | ||
return { heart, calendar, musicalNote }; | ||
}, | ||
}); | ||
</script> | ||
``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.