mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-15 17:42:15 +08:00
chore(react): fix tabs docs (#19995)
This commit is contained in:
@ -176,34 +176,38 @@ will match the following tab:
|
|||||||
### React
|
### React
|
||||||
|
|
||||||
```tsx
|
```tsx
|
||||||
import React from 'react';
|
|
||||||
import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel, IonBadge } from '@ionic/react';
|
|
||||||
|
|
||||||
export const TabsExample: React.FC = () => (
|
export const TabsExample: React.FC = () => (
|
||||||
<IonTabs>
|
<IonTabs>
|
||||||
<IonTabBar slot="bottom">
|
<IonRouterOutlet>
|
||||||
<IonTabButton tab="schedule">
|
<Redirect exact path="/" to="/tabs/schedule" />
|
||||||
<IonIcon name="calendar" />
|
{/*
|
||||||
<IonLabel>Schedule</IonLabel>
|
Using the render method prop cuts down the number of renders your components will have due to route changes.
|
||||||
<IonBadge>6</IonBadge>
|
Use the component prop when your component depends on the RouterComponentProps passed in automatically.
|
||||||
</IonTabButton>
|
*/}
|
||||||
|
<Route path="/tabs/schedule" render={() => <SchedulePage />} exact={true} />
|
||||||
<IonTabButton tab="speakers">
|
<Route path="/tabs/speakers" render={() => <SpeakerList />} exact={true} />
|
||||||
<IonIcon name="contacts" />
|
<Route path="/tabs/map" render={() => <MapView />} exact={true} />
|
||||||
<IonLabel>Speakers</IonLabel>
|
<Route path="/tabs/about" render={() => <About />} exact={true} />
|
||||||
</IonTabButton>
|
</IonRouterOutlet>
|
||||||
|
<IonTabBar slot="bottom">
|
||||||
<IonTabButton tab="map">
|
<IonTabButton tab="schedule" href="/tabs/schedule">
|
||||||
<IonIcon name="map" />
|
<IonIcon icon={calendar} />
|
||||||
<IonLabel>Map</IonLabel>
|
<IonLabel>Schedule</IonLabel>
|
||||||
</IonTabButton>
|
</IonTabButton>
|
||||||
|
<IonTabButton tab="speakers" href="/tabs/speakers">
|
||||||
<IonTabButton tab="about">
|
<IonIcon icon={contacts} />
|
||||||
<IonIcon name="information-circle" />
|
<IonLabel>Speakers</IonLabel>
|
||||||
<IonLabel>About</IonLabel>
|
</IonTabButton>
|
||||||
</IonTabButton>
|
<IonTabButton tab="map" href="/tabs/map">
|
||||||
</IonTabBar>
|
<IonIcon icon={map} />
|
||||||
</IonTabs>
|
<IonLabel>Map</IonLabel>
|
||||||
|
</IonTabButton>
|
||||||
|
<IonTabButton tab="about" href="/tabs/about">
|
||||||
|
<IonIcon icon={informationCircle} />
|
||||||
|
<IonLabel>About</IonLabel>
|
||||||
|
</IonTabButton>
|
||||||
|
</IonTabBar>
|
||||||
|
</IonTabs>
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user