# `PhoenixKitWeb.Components.ProfileSettingsTabs`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v2.64.1/lib/phoenix_kit_web/components/profile_settings_tabs.ex#L1)

The tabs of the signed-in user's own settings, `/profile/settings/<tab>`.

One URL per tab, and a tab is offered only when it has something to show
for this user:

  * `account` — who you are: avatar and name, custom fields, email, and
    the start page
  * `security` — password and connected sign-in accounts
  * `sessions` — signed-in devices and recent sign-in attempts
  * `notifications` — which notifications you get (when any types exist)
  * `integrations` — your own service connections, for holders of the
    opt-in `integrations` permission. Its own LiveView at
    `/profile/settings/integrations`.
  * `media` — how media behaves for you: the annotation-tools section
    (open-in-editor switch, tool reset), and — while user libraries are
    on and you hold the `"storage"` permission — your storage libraries
    and their members (`PhoenixKitWeb.Live.Components.LibrarySettings`;
    the end-user surface for those is `phoenix_kit_photos`). The tab is
    offered to everyone, because the annotation section applies to
    anyone who can open the media viewer; the library card inside keeps
    its own gate.

A host or a module adds tabs of its own (`PhoenixKit.ProfileSettingsTab`):
each links to a page of its own, placed with `after:`, offered by its
`permission:` / `visible:` check.

`/profile/settings` opens the first tab. Every section of
`PhoenixKitWeb.Live.Components.UserSettings.default_sections/0` is on
exactly one tab (a section on none would be one nobody can reach).

## Hiding sections

An admin can hide sections a site does not use (Settings → Users →
Profile page). What is stored is the list of HIDDEN sections, in the
`user_settings_hidden_sections` setting — so a section added in a later
release shows up on existing sites instead of staying invisible. A tab
whose sections are all hidden is not offered. `:identity` (name and
avatar) cannot be hidden. `:google_email` is the Google address field
inside the identity form, hideable on its own.

# `all_sections`

```elixir
@spec all_sections() :: [atom()]
```

Every section some tab shows.

# `default_tab`

```elixir
@spec default_tab() :: String.t()
```

The tab `/profile/settings` opens on.

# `google_email_shown?`

```elixir
@spec google_email_shown?() :: boolean()
```

Whether the Google address field shows in the identity form.

# `hidden_sections`

```elixir
@spec hidden_sections() :: [atom()]
```

The sections an admin has hidden. Unknown names are ignored.

# `hideable_sections`

```elixir
@spec hideable_sections() :: [atom()]
```

The sections (and the `:google_email` field) an admin may hide.

# `path`

```elixir
@spec path(String.t()) :: String.t()
```

The path of a tab.

# `profile_tabs`

The tab strip. `active` is the tab being shown; `scope` decides which tabs
are offered. Tabs rendered by the same LiveView patch; the integrations
tab and the registered ones, each a LiveView of its own, navigate. A
registered tab's page renders the strip with its own id as `active`.

## Attributes

* `active` (`:string`) (required)
* `scope` (`:any`) (required)

# `rendered_here?`

```elixir
@spec rendered_here?(String.t()) :: boolean()
```

Whether `ProfileSettings` renders the tab itself (every tab but integrations).

# `sections`

```elixir
@spec sections(String.t()) :: [atom()] | nil
```

The `UserSettings` sections a tab rendered by `ProfileSettings` shows, or
nil for a tab that is not one of them (integrations has a page of its own).

# `set_section_hidden`

```elixir
@spec set_section_hidden(atom(), boolean(), keyword()) :: :ok | {:error, term()}
```

Hides or shows `section` for every user. `section` must be hideable.
`opts` reach the setting write (`actor_uuid:`, `source:`), so the change
is attributed like any other settings save.

# `tab_icon`

```elixir
@spec tab_icon(String.t()) :: String.t()
```

The icon of a tab, core's or a registered one.

# `tab_ids`

```elixir
@spec tab_ids(PhoenixKit.Users.Auth.Scope.t() | nil) :: [String.t()]
```

The ids of the tabs `scope` is offered, in order: core's and the registered ones.

# `tab_label`

```elixir
@spec tab_label(String.t()) :: String.t()
```

The label of a tab, core's or a registered one; the id for one that is neither.

---

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