Skip to content
Knowns UI
Get ProSign in

Role Picker

Pick one role. Built-in roles come first, custom ones after, each with a short line of what it can do and how many people hold it. A role you cannot give stays in the list with the reason.

On this page
Used for
  • Member rows
  • Invite forms
  • Project access
  • Sharing dialogs
  • Admin tables

Examples

Size

In a table row

In an invite form

Installation

npx knowns-ui@latest add role-picker
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

Props

rolesrequired
Role[]
{ id, name, description?, builtIn?, memberCount?, permissions?, disabled?, disabledReason? }.
value / onValueChangerequired
string | null / (id | null) => void
The picked role id. null is the none entry, or nothing picked.
noneOption
{ label, description? }
A first entry that picks null, e.g. No project role.
catalog
PermissionGroup[]
To write each role's line from its permissions, e.g. "Edit any issue, Manage labels +12".
size
"sm" | "md"
Default"md"
sm is 28px for table rows (160px wide), md 32px for forms (full width).
disabled
boolean
Defaultfalse
The whole field.
placeholder
string
Default"Pick a role"
Shown when nothing is picked.
aria-label
string
Name it after what it sets: "Atlas role for Tomas Lindqvist".
className
string
On the field.

Accessibility

  • It is a Combobox: a button with aria-haspopup="listbox", arrow keys through the roles, type-ahead, Enter to pick and Escape to close.
  • A role you cannot give is aria-disabled and its reason is part of its description, so it is read with the name.
  • On phones the list opens as a sheet titled with the field's label.

What it handles

  1. 01Lists built-in roles first and custom ones after, with small headers when both kinds are there.
  2. 02Gives every role a second line: its strongest permissions from the catalog (or its description) and how many members hold it.
  3. 03Keeps a role you cannot give in the list, off, with the reason as its second line.
  4. 04Adds an optional first entry such as No project role that picks null, and turns search on from seven entries.

States

Open
The list fades in under the field
120ms, ease out
Pick
The field shows the role at once
none
Reduced motion
The list appears at once
0ms

Works with

When to use

When to use

  • Giving a person one role in a member row, an invite form or a share dialog.
  • A project role that can fall back to the workspace role, with a No project role entry.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Role Picker to my app and wire it to my own data.
  • I need giving a person one role in a member row, an invite form or a share dialog. Set that up with the Knowns UI Role Picker.
  • Which Role Picker props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "role-picker" }) and search_docs({ query: "role picker" }).

Need help?

Stuck on Role Picker, or found something off? We read every message.