Retrieve the list of available roles for your application. Roles can be imported using the cli and then consumed by the application using this property.

The property is an observable. See Examples below for how to consume it.

Roles can be used when sharing data with other users by adding an entry into the members table and set the roles attribute of the member.


Observable of {[roleId: string]: Role}

Example (React)

import { useObservable } from "dexie-react-hooks";
import { db } from "./db.js";

function MyComponent() {
  const roles = useObservable(db.cloud.roles);

  return (
        {Object.keys(roles).map((roleId) => (
          <li key={roleId}>{roles[roleId].displayName}</li>

This component would render the current roles

See useObservable()

Example (Svelte)

  import { db } from "./db.js";

  let oRoles = db.cloud.roles;

  {#each Object.keys($oRoles) as roleId}

See Also

db.cloud properties

Table of Contents