question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: allow IonTabs to be used without a router outlet

See original GitHub issue

Prerequisites

Describe the Feature Request

Each framework wrapper couples the ion-router-outlet within ion-tabs, prevent developers from using ion-tabs in a standalone context or passing in another router solution.

ion-tab implementations through our framework wrappers, should support a new flag/option to disable coupling the ion-router-outlet.

The web component implementation allows for this behavior, the framework wrappers do not; there shouldn’t be a forced opinionation for using the base component.

Describe the Use Case

Applications that want to display content within their app, in a tabbed experience, without the complexities of routing or the need for routing; should be able to do so.

If I wanted to create an application that:

  1. Displays a tab-like experience within a modal (separate from URL navigation)
  2. Creates a learning module that uses tabs to separate the content, without navigation events when clicking through the tab

Describe Preferred Solution

<ion-tabs no-outlet>

  <ion-tab tab="tab-one">
    Tab 1 content
  </ion-tab>

  <ion-tab tab="tab-two">
    Tab 2 content
  </ion-tab>

  <ion-tab-bar slot="bottom">
    <ion-tab-button tab="tab-one">
      <ion-label>Tab One</ion-label>
    </ion-tab-button>

    <ion-tab-button tab="tab-two">
      <ion-label>Tab Two</ion-label>
    </ion-tab-button>

  </ion-tab-bar>

</ion-tabs>

Describe Alternatives

Alternatives would include creating your own tabs component, that brings in ion-tab-bar and sets up all the opinionated styling of ion-tabs.

Related Code

No response

Additional Information

Similar issues/requests: #24991

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
sean-perkinscommented, Apr 29, 2022

Offline thought/conversation; we should be able to detect this based on the tab containing an outlet or not. It may be possible to drop the no-outlet complexity altogether and have it be automatic. Would just need to think through developer experience here. Typically we like to warn developers when they are missing a required configuration. If there is no flag to indicate you are trying to do something custom, we won’t be able to provide those warnings back to the developer.

1reaction
kevinclarkadstechcommented, Jul 6, 2022

This definitely needs to be an option…It is allowed if just using vanilla JavaScript or Stencil, but React throws an error. Sometimes you just want simple, non-routeable tabs like what is actually shown in the example docs:

https://github.com/ionic-team/ionic-docs/tree/main/static/demos/api/tabs/index.html

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it allowed to use child routes without router outlets? (tab ...
In the routing module I have specified tabs paths as children of parent route and seems it is working. But I am not...
Read more >
How to set up React Router in Ionic | Modus Create - YouTube
Ionic React tutorial teaches how to adds tabs and routing to a sample ReactJS application. This hands-on tutorial course helps you learn ...
Read more >
Ion-Tabs: Tab-Based Component for App Top-Level Navigation
Tabs are top-level components to implement tab-based navigation. Ion-tabs have no styling & work as router outlets for navigation that behaves like native ......
Read more >
routing without router-outlet : r/Angular2 - Reddit
Cannot use @input and @output with router outlet , now please don't ask me to use service , please just tell me how...
Read more >
In-app navigation: routing to views - Angular
Each Route maps a URL path to a component. There are no leading slashes in the path. The router parses and builds the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found