GithubHelp home page GithubHelp logo

Comments (2)

khotcholava avatar khotcholava commented on September 10, 2024

Hi @markywilson,
Can you clarify your desired icon tab bar behaviour?
Switch content areas (current functionality)?
Navigate between routes (like fd-tabs)?
Let me know if you have questions or prefer a different approach.

from fundamental-ngx.

markywilson avatar markywilson commented on September 10, 2024

Hi @khotcholava
Thanks for picking this up.

The FdTabs have the functionality of defining own template with routerLink (highlighting and selecting the tab based on routerLink directly from the template).

<nav fd-tab-nav>
    <div fd-tab-item>
        <a fd-tab-link [active]="rla1.isActive" [routerLink]="'tab1'" routerLinkActive #rla1="routerLinkActive">
            <span fd-tab-tag>Link 1</span>
        </a>
    </div>
    <div fd-tab-item>
        <a fd-tab-link [active]="rla2.isActive" [routerLink]="'tab2'" routerLinkActive #rla2="routerLinkActive">
            <span fd-tab-tag>Link 2</span>
        </a>
    </div>
    <div fd-tab-item>
        <a fd-tab-link [active]="rla3.isActive" [routerLink]="'tab3'" routerLinkActive #rla3="routerLinkActive">
            <span fd-tab-tag>Link 3</span>
        </a>
    </div>
</nav>

However this functionality isn't available in icon tab bar.

We mitigated that by adding extra code in the class

<fd-dynamic-page>
	<fdp-icon-tab-bar #tabs (iconTabSelected)="navigate($event)">
		<fdp-icon-tab-bar-tab [active]="activeTab === 'tab1'" label="Link 1" id="tab1"></fdp-icon-tab-bar-tab>
		<fdp-icon-tab-bar-tab [active]="activeTab === 'tab2'" label="Link 2" id="tab2"></fdp-icon-tab-bar-tab>
	
	    <ng-container fdpIconTabBarFreeContent>
	        <fd-dynamic-page-content>
	            <router-outlet></router-outlet>
	        </fd-dynamic-page-content>
	    </ng-container>
	</fdp-icon-tab-bar>
</fd-dynamic-page>

And in the class

public activeTab: string;

constructor(
    private activatedRoute: ActivatedRoute,
    private router: Router
) {}

public ngOnInit(): void {
	this.activeTab = this.router.url.split('/').pop();
}

public navigate(item: IconTabBarItem): void {
    void this.router.navigate([item.id], {relativeTo: this.activatedRoute});
}

from fundamental-ngx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.