Skip to content
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

feat: allow IonTabs to be used without a router outlet #25184

Closed
3 tasks done
sean-perkins opened this issue Apr 25, 2022 · 8 comments
Closed
3 tasks done

feat: allow IonTabs to be used without a router outlet #25184

sean-perkins opened this issue Apr 25, 2022 · 8 comments
Labels
package: angular @ionic/angular package package: react @ionic/react package package: vue @ionic/vue package type: feature request a new feature, enhancement, or improvement

Comments

@sean-perkins
Copy link
Contributor

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

@riderx
Copy link

riderx commented Apr 25, 2022

@sean-perkins it seems the IonTabBar also need the router to get the active tab.
Should both have this option?
And that mean they need a way to init to the right tab ?

@riderx
Copy link

riderx commented Apr 25, 2022

@sean-perkins i made a PR for changes in Vue

@liamdebeasi liamdebeasi added type: feature request a new feature, enhancement, or improvement package: core @ionic/core package labels Apr 27, 2022
@ionitron-bot ionitron-bot bot removed the triage label Apr 27, 2022
@liamdebeasi liamdebeasi added package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package and removed package: core @ionic/core package labels Apr 27, 2022
@sean-perkins
Copy link
Contributor Author

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.

@riderx
Copy link

riderx commented Apr 29, 2022

@sean-perkins seems a got solution to me, to auto-detect, but if that not the happy path I tend to say that better to have it explicit set to prevent support question etc

@KANekT
Copy link

KANekT commented Jun 1, 2022

@sean-perkins
if use no-outlet - I know what I'm doing and not need an extra error & auto-detect.
in my case, i need use in different layout, not in ion-tabs.

@kevinclarkadstech
Copy link

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

@creolio
Copy link

creolio commented May 20, 2024

Any update on this?

rugoncalves pushed a commit that referenced this issue Sep 5, 2024
Issue number: resolves #25184

---------

Co-authored-by: Brandy Carney <[email protected]>
Co-authored-by: Sean Perkins <[email protected]>
brandyscarney added a commit that referenced this issue Sep 5, 2024
Issue number: resolves #25184

---------

Co-authored-by: Brandy Carney <[email protected]>
Co-authored-by: Sean Perkins <[email protected]>
@thetaPC
Copy link
Contributor

thetaPC commented Sep 11, 2024

This feature was released in v8.3.0! Make sure to update to the latest version to access it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: angular @ionic/angular package package: react @ionic/react package package: vue @ionic/vue package type: feature request a new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

7 participants