suiss/uim · Block

Roles Editor

An admin screen for editing role permissions, with a role list beside grouped permission switches.

Roles Editor is an open-source mobile screen from suiss/uim for React Native and Expo, with SwiftUI and Jetpack Compose versions built from the same design tokens. The @esuiss/uim CLI copies its source into your project, so you own the code.

iOS
Roles Editor on iOS in light mode

A SplitView lists the Editor, Support and Viewer roles with their member counts, and the detail pane shows the selected role's permissions grouped into ItemGroup lists, each with a Switch. Revert and Save buttons appear once a switch changes, and a New Role Button sits under the list. An admin TabBar switches between Users, Roles, Activity and Settings; sections other than Roles show a placeholder. On wide screens the list and detail sit side by side.

Installation

$ pnpm dlx @esuiss/uim@latest add roles-editor

The CLI also adds what it builds on: Button, Icon, Item, Screen, Split View, Switch, Tab Bar, Text.

Manual

  1. Install the dependencies:
npx expo install phosphor-react-native react-native-reanimated react-native-svg react-native-worklets
  1. Add the pieces it builds on: Button, Icon, Item, Screen, Split View, Switch, Tab Bar, Text.

  2. Copy the source into components/blocks/roles-editor.tsx:

uniwind/components/blocks/roles-editor.tsx
import {
  ChartBarIcon,
  GearIcon,
  type Icon as PhosphorIcon,
  PlusIcon,
  ShieldIcon,
  UsersIcon,
} from "phosphor-react-native"
import * as React from "react"
import { useWindowDimensions, View } from "react-native"
import { FadeInDown, ReduceMotion } from "react-native-reanimated"
import {
  SplitView,
  SplitViewDetail,
  SplitViewItem,
  SplitViewList,
  1. Update the import paths to match your project.

Usage

import { RolesEditor } from "@/components/blocks/roles-editor"
<RolesEditor />

Replace GROUPS, ROLES, MEMBERS and DEFAULTS with your permissions and grants. Use onTogglePermission, onSave, onRevert, onNewRole and onNavigate to persist changes and route between sections.