> ## Documentation Index
> Fetch the complete documentation index at: https://embedded-apps.rollout.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add the marketplace

> Let users turn apps on for themselves or their org, with mountEmbeddedAppMarketplace().

![A settings page listing three apps as cards, each with switches to enable it for me or for my org.](https://mintcdn.com/rollout-embedded-apps/I1umzqggy_PAdPKI/images/marketplace.png?fit=max\&auto=format\&n=I1umzqggy_PAdPKI\&q=85\&s=18143262c6aa34c64137677038630f7f)

mountEmbeddedAppMarketplace() lists your approved apps as cards, with a switch for each scope the user may turn apps on for.

## Mount the marketplace

Put it on a settings or integrations page, with the marketplace token:

```js theme={null}
import { mountEmbeddedAppMarketplace } from "https://universal.rollout.com/api/embedded-apps/host-v1.js";

const marketplace = mountEmbeddedAppMarketplace(document.querySelector("#marketplace"), {
  marketplaceId: "YOUR_MARKETPLACE_ID",
  getToken: () => fetch("/rollout/marketplace-token").then((r) => r.text()),
  // On a page that also shows the apps, show the change there.
  onEnablementChange: () => apps?.refresh(),
});
```

It lists every approved app as a card with its icon, name, tagline,
description, support and privacy policy links, and switches:

* **Enable for me**, when your marketplace allows **For themselves**.
* **Enable for my org**, when your marketplace allows **For their org** and the
  token has `embed:enable_org` and an `embed.org`.

An app the user's org turned on shows as on, with "Enabled by your org", and the
user can't turn it off for themselves. Only an org admin can turn it off for
the org. An app still on in a scope your marketplace stopped allowing keeps
its switch, so it can be turned off.

### Options

| Option | |
| - | - |
| `marketplaceId` | Your marketplace id. Required. |
| `getToken` | `() => Promise<string>`: returns a user token with `embed:enable`, and `embed:enable_org` for an org admin. Called on mount and when Rollout refuses a token. Required. |
| `scopes` | The switches to show: `["user"]`, `["org"]` or `["user", "org"]`. It can only narrow what your marketplace allows and the token grants. All of those by default. |
| `appId` | Show one app's card only, for example on your own page about that app. |
| `layout` | `"grid"` (default) or `"list"`. |
| `onEnablementChange` | `({ appId, scope, enabled }) => void`, where `scope` is `user` or `org`. |
| `onError` | `({ code, message }) => void`: see [Errors](https://embedded-apps.rollout.com/reference/errors.md). |

### Handle methods

| Method | |
| - | - |
| `refresh()` | Lists the apps again. |
| `unmount()` | Removes the cards. |

## Style it to match your product

Unlike the apps, the marketplace renders directly in your page, in a shadow
root on an element it adds to your container. It inherits your page's font
and text colour. Tune the rest with these CSS custom properties, set on the
container or any ancestor:

| Property | Default |
| - | - |
| `--rollout-border-color` | The text colour at 18% |
| `--rollout-muted-color` | The text colour at 65% |
| `--rollout-accent` | The browser's link and control colours |
| `--rollout-card-background` | `transparent` |
| `--rollout-radius` | `8px` |
| `--rollout-gap` | `12px` |
| `--rollout-card-min-width` | `260px`, in the grid layout |

For anything else, style its parts with `::part()`: `apps`, `empty`, `card`,
`icon`, `name`, `tagline`, `description`, `links`, `link`, `toggles`,
`toggle`, `toggle-label` and `note`.

```css theme={null}
#marketplace {
  --rollout-accent: #0b6bcb;
  --rollout-radius: 12px;
}
#marketplace ::part(card) {
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}
```

## Or build your own

To show the marketplace in your own design system, or to turn apps on from your
server, for example when you onboard an office, call the
[marketplace API](https://embedded-apps.rollout.com/reference/marketplace-api.md) directly. It's what the component
is built on.

## Next

[Review the apps](https://embedded-apps.rollout.com/build/review-apps.md) publishers list in your marketplace.


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