# Profile

A surface you navigate: a column of pages beside the page each one opens, as tabs. When narrow, the nav becomes a select on the page title, then a sheet on a phone. Inside a `Dialog` it adds the close control.

## Use for

- a user or organization profile with several pages
- a settings surface with side navigation
- a tabbed page layout that collapses on small screens
- a page that opens sub-pages with a back button

## Practices

- Do: Render a `Profile.Title`. It names the nav, and stays visually hidden.
- Do: Give each `Profile.NavItem` a `value` that matches a `Profile.ContentPanel`, and start each page with a `Panel.Title`, its page title.
- Do: Pass a string as a `Profile.NavItem` child, so it names the option when the nav is a select.
- Do: For a page with sub-pages, give its `Profile.ContentPanel` a `label`, `subPage` and `onSubPageChange`, and wrap every view in a `Profile.SubPage`, the page itself as `value={null}`.
- Do: Open a sub-page from a panel through a callback prop, such as `onManagePasskeys`, so the panel also works on its own.
- Don't: Wrap a sub-page in your own `Flow`. `Profile.ContentPanel` moves between its sub-pages and focuses the new title.

## API reference

### Profile.Root

Holds the selected page and the nav layout. Renders a `div`, or the `render` element.

Slot: `cl-profile`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The selected page. |
| `onValueChange` | `(value: string) => void` |  | Called with the page the user picks. |
| `orientation` | `TabsProps['orientation']` | `'vertical'` | Tab arrow-key direction. |
| `activationMode` | `TabsProps['activationMode']` |  | Whether focusing a tab selects it. The sheet nav always uses `manual`. |
| `renderBranding` | `boolean` | `true` | Shows Clerk branding in the wide layout. |
| `elevation` | `ProfileElevation` | `'card'` | `card` draws a card. `flush` sits inline in the page; inside a `Dialog` it stays `card`. |

### Profile.Title

A visually hidden heading at the current level that names the profile and its nav.

Slot: `cl-profile-title`

### Profile.Nav

A `nav` of `Profile.NavItem`s or `Profile.NavGroup`s. Renders as a tablist, the options of the page title select, or a tablist in a sheet.

Slot: `cl-profile-nav`

### Profile.NavGroup

A labelled run of nav items. As tabs the label describes each item; as options it names the group.

Slot: `cl-profile-nav-group`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `React.ReactNode` |  | The group name, shown above its items. |

### Profile.NavItem

One page in the nav, as a tab or an option.

Slot: `cl-profile-nav-item`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The page it opens. |
| `icon` | `React.ReactNode` |  | A leading icon, hidden from assistive tech. |
| `badge` | `React.ReactNode` |  | A trailing `Badge`. Badges in it default to `neutral`. |
| `disabled` | `boolean` |  | Disables the item. |

### Profile.Content

The scrolling page area. Each page's `Panel.Title` is its page title, and the navigation's trigger on compact layouts.

Slot: `cl-profile-content`

### Profile.ContentPanel

One page, shown while its `value` is selected. Sets the heading level one below the page title.

Slot: `cl-profile-content-panel`

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string` |  | The page it shows for. Matches a `Profile.NavItem` value. |
| `label` | `string` |  | The page's name, shown on the back button of each of its sub-pages. Required with `subPage`. |
| `subPage` | `string \| null` |  | The open sub-page, or `null` for the page itself. Matches a `Profile.SubPage` value. Leave it out for a page without sub-pages. |
| `onSubPageChange` | `(subPage: string \| null) => void` |  | Called with `null` when the user goes back to the page. Required with `subPage`. |

### Profile.SubPage

One view of a `Profile.ContentPanel` with sub-pages, shown while its `value` is the open `subPage`, in a `Flow.Step`. A sub-page's `Panel.Title` gets a small back button above it, read as "Back to {label}", and never opens the navigation on compact layouts.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `string \| null` |  | The sub-page it shows for, or `null` for the page itself. |

## Examples

### A two-page profile

```tsx
<Profile.Root value={page} onValueChange={setPage}>
  <Profile.Title>User profile</Profile.Title>
  <Profile.Nav>
    <Profile.NavItem value='account'>Account</Profile.NavItem>
    <Profile.NavItem value='security'>Security</Profile.NavItem>
  </Profile.Nav>
  <Profile.Content>
    <Profile.ContentPanel value='account'>
      <Panel.Root>
        <Panel.Title>Account</Panel.Title>
        …
      </Panel.Root>
    </Profile.ContentPanel>
    <Profile.ContentPanel value='security'>…</Profile.ContentPanel>
  </Profile.Content>
</Profile.Root>
```

### A page with a sub-page

```tsx
<Profile.ContentPanel value='security' label='Security' subPage={subPage} onSubPageChange={setSubPage}>
  <Profile.SubPage value={null}>
    <SecurityPanel onManagePasskeys={() => setSubPage('passkeys')} />
  </Profile.SubPage>
  <Profile.SubPage value='passkeys'>
    <PasskeysPanel />
  </Profile.SubPage>
</Profile.ContentPanel>
```

## Related

- [Panel](https://mosaic.clerk.com/docs/components/panel.md)
- [Dialog](https://mosaic.clerk.com/docs/components/dialog.md)
- [Tabs](https://mosaic.clerk.com/docs/components/tabs.md)
