> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cskn.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Platform menu

> Show the visitor's own cskn menu on a user page: their apps, Marketplace, Studio, their page, follows and log out.

On a user page (`<username>.cskn.my/<slug>`), the platform can draw the **visitor's** own menu over your app. It belongs to the platform, not to your app:

* signed in: an avatar button that opens the visitor's apps as a grid, Marketplace, Studio, their own page, their followers and following, and Log out
* signed out: a "Sign in" button

The menu is drawn in its own shadow DOM, so your CSS can't break it and its CSS can't leak into your app. Its code loads only when a page first shows it.

> [!NOTE]
>
> **The menu is hidden by default.** Nothing appears until your app asks for it.

## Show it

With @cskn/ui, render [`<PlatformMenu />`](https://docs.cskn.dev/ui/components/navigation#platformmenu). It shows the menu while it is mounted and dresses it in your app's theme. Without the UI kit, use the SDK:

```ts theme={null}
import { platformMenu } from '@cskn/sdk';

platformMenu.configure({
  visible: true,
  placement: 'top-left',
  style: { accent: '#7c3aed', radius: 18 },
  sections: { studio: false },
  items: [{ id: 'settings', label: 'Settings', icon: '⚙️' }],
});

const stop = platformMenu.onSelect(({ id }) => {
  if (id === 'settings') openSettings();
});
```

### Outside a user page

On your app page (`<slug>.cskn.app`), inside a shell, or on a dev server there is no menu. `platformMenu.isAvailable()` returns `false` and every call is a no-op, so you can call it unconditionally.

On a user page opened inside a shell, a signed-out visitor sees nothing: signing in is the shell's job.

## Methods

**isAvailable()** `boolean`

Whether this page has the menu at all.

**configure(options)** `void`

Merge options into the menu's. `items`, `sections`, `style` and `labels` replace what you set before.

**show() / hide()** `void`

Same as `configure({ visible: true | false })`.

**open() / close() / toggle()** `void`

Open or close the panel. Opening needs the menu to be visible and the visitor to be signed in.

**onSelect(fn)** `() =\> void`

One of your `items` was chosen: `fn({ id, item })`. Returns the unsubscribe function.

**onOpen(fn) / onClose(fn)** `() =\> void`

The panel opened or closed. Returns the unsubscribe function.

**getState()** `PlatformMenuState`

`{ visible, open, placement, signedIn }`.

## Options

**visible** `boolean` (default: false)

Show the menu.

**placement** `'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'slot'` (default: 'top-right')

A corner of the viewport, or `slot`: inside an element of yours.

**slot** `Element | string | null`

For `placement: 'slot'`, the element (or a selector for it) the button goes into, such as a spot in your header.

**offset** `number` (default: 16)

Distance from the viewport edges for a corner placement, in px.

**zIndex** `number`

Stacking order. The default is very high, so the menu sits above your app.

**colorScheme** `'auto' | 'light' | 'dark'` (default: 'auto')

`auto` follows the system.

**size** `number` (default: 40)

The avatar button's size, and the Sign in button's height, in px.

**variant** `'floating' | 'flat'` (default: 'floating')

`floating` has a shadow and an outlined Sign in button. `flat` has no shadow and a Sign in button filled with `accent`, for a menu that sits in a toolbar.

**style** `PlatformMenuStyle`

Colors and shape. See below.

**sections** `PlatformMenuSections`

Which built-in parts show. All are on unless set to `false`: `apps` (the visitor's identity and apps grid), `marketplace`, `studio`, `profile` ("My page"), `follows`, `logout`.

**items** `PlatformMenuItem[]`

Your app's own entries. See below.

**labels** `Record\<string, string\>`

Override any built-in string by key, such as `signIn`, `myApps` or `logout`. The menu is in English or Turkish, following `<html lang>`.

### Style

Every key takes any CSS value. Unset keys keep the menu's own light or dark palette.

| Key | What it colors |
| - | - |
| `background` | The panel |
| `surface` | Inputs, app tiles, the button behind the avatar |
| `text`, `muted` | Text and secondary text |
| `border` | Borders and separators |
| `accent`, `accentText` | Primary buttons and checkboxes |
| `danger` | Log out |
| `hover` | Row hover |
| `ring` | Focus ring |
| `radius` | The panel's corners; a number is px |
| `buttonRadius` | The Sign in button's corners; a number is px. Default: a pill |
| `font`, `shadow` | Font family and panel shadow |

### Items

```ts theme={null}
platformMenu.configure({
  items: [
    { id: 'pinned', label: 'Pinned', icon: 'link', group: 'start' },
    { id: 'help', label: 'Help', icon: '❓', href: 'https://example.com/help', target: '_blank' },
    { id: 'reset', label: 'Reset app', destructive: true },
  ],
});
```

**id** `string` *required*

Passed to `onSelect`.

**label** `string` *required*

The text shown.

**icon** `string`

An emoji or other glyph, an image URL, or one of `store`, `grid`, `user`, `users`, `logout`, `lock`, `search`, `link`.

**href / target** `string / '_blank' | '_self'`

Makes the item a link. Without `href` the item only fires `onSelect` and closes the menu.

**group** `'start' | 'end'` (default: 'end')

`start` puts the item above everything else. `end` puts it just before Log out.

**destructive** `boolean`

Draw it in the `danger` color.

## Behavior

* Below 640 px the panel opens as a bottom sheet.
* Escape closes the panel and returns focus to the avatar button. Arrow keys move between items.
* Log out asks for confirmation first, with an option to end every session on the device.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.