Navigation/DSTabs

DSTabs

navigation
since v1.0

Tab bar with icon, label, and badge support. Uses spring animations for the active indicator.

iOS 17+macOS 14+

Purpose

Top-level navigation between 2–5 primary sections of an app.

Props

PropTypeDefaultDescription
itemsreq[DSTabItem]Tab items with id, label, and icon.
selectedreqBinding<String>ID of the active tab.
styleDSTabStyle.bar.bar (bottom) or .underline (top).

Examples

Primary app navigation

4-tab bottom navigation.

swift
DSTabs(
    items: [
        DSTabItem(id: "home",     label: "Home",     icon: "house.fill"),
        DSTabItem(id: "search",   label: "Search",   icon: "magnifyingglass"),
        DSTabItem(id: "projects", label: "Projects", icon: "folder.fill"),
        DSTabItem(id: "profile",  label: "Profile",  icon: "person.fill"),
    ],
    selected: $selectedTab
)

Related Components