UI Kit components
Jira UI Kit components
UI Kit hooks
Forge bridge APIs
Jira bridge APIs
Upgrade UI Kit versions
Previous versions

User picker

To add the UserPicker component to your app:

1
2
import { UserPicker } from "@forge/react";

Description

A dropdown field that allows users to search and select users from a list.

Props

NameTypeRequiredDescription
isMultibooleanNoWhether the user can select multiple users from the list. Defaults to false.
isRequiredbooleanNoIndicates to the user whether or not a value is required in this field to submit the form. If a field is required, an asterisk appears at the end of that field’s label.
labelstringYesThe label text to display.
namestringYesThe key to which the input value is assigned in the returned form object. If isMulti is true, the submitted value is an array of strings; otherwise, it is a string.
defaultValuestringNoThe initial user to display. The value should be an Atlassian account ID.
descriptionstringNoThe text description of the user picker field.
placeholderstringNoThe placeholder helper text.
onChange
1
2
(user: {
  id: string;
  type: string;
  avatarUrl: string;
  name: string;
  email: string;
}) => void
NoAn event handler that can be asynchronous. Allows you to read values from the component without having to submit as part of a Form.

Examples

Default

A field for selecting a user.

Example image of rendered User picker

1
2
const App = () => {
  return (
    <UserPicker
      label="Assignee"
      placeholder="Select a user"
      name="user"
      description="The selected user will be assigned to this task"
      onChange={(user) => console.log(user)}
    />
  );
};

The returned object from onChange contains the Atlassian account ID and various other information of the selected user.

1
2
{
    "id": "1a2345bc6789012d3e45f67",
    "type": "user",
    "avatarUrl": "...",
}

Multi

Multiple users can be selected when the isMulti prop is applied.

Example image of rendered User picker

1
2
const App = () => {
  return (
    <UserPicker
      label="Project owner(s)"
      placeholder="Select people or teams"
      name="project-owners"
      description="The selected people or teams will be the project owner"
      onChange={(users) => console.log(users)}
    />
  );
};

Rate this page: