# `PhoenixKit.Dashboard.TabHelpers`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.165/lib/phoenix_kit/dashboard/tab_helpers.ex#L1)

Shared helper functions for dashboard sidebar navigation.

Extracted from `AdminSidebar` and `Sidebar` to eliminate duplication.
Import this module in sidebar components to use these functions in HEEX templates.

# `add_active_state`

```elixir
@spec add_active_state([PhoenixKit.Dashboard.Tab.t()], String.t()) :: [map()]
```

Sets the `:active` key on each tab based on path matching.

# `filter_top_level`

```elixir
@spec filter_top_level([PhoenixKit.Dashboard.Tab.t()]) :: [
  PhoenixKit.Dashboard.Tab.t()
]
```

Filters to only top-level tabs (no parent).

# `get_subtabs_for`

```elixir
@spec get_subtabs_for(atom(), [PhoenixKit.Dashboard.Tab.t()]) :: [
  PhoenixKit.Dashboard.Tab.t()
]
```

Gets subtabs for a given parent tab ID, sorted by priority.

# `group_tabs`

```elixir
@spec group_tabs([PhoenixKit.Dashboard.Tab.t()]) :: %{
  optional(atom()) =&gt; [PhoenixKit.Dashboard.Tab.t()]
}
```

Groups tabs by their `:group` field.

# `sorted_groups`

```elixir
@spec sorted_groups([map()], map()) :: [map()]
```

Filters to groups that have tabs and sorts by priority.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
