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

DEPRECATION NOTICE UI Kit 1 is now in the deprecation period. This version will no longer be supported or functional after 28 Feb 2025

To support your upgrade, please use the following guides:

We highly recommend using the latest version of UI Kit to quickly build your user interface with its updated library of components.

This page is about the previous version of UI Kit.

We highly recommend upgrading to and utilizing the latest version. Get started with UI Kit's latest library of components to quickly build your user interface.

UI Kit 1

Avatar

In UI kit version 0.15.0 and later, the Avatar component has been removed and is replaced by the User component.

A visual representation of a user (subject to their privacy settings). A row of avatars is displayed in an AvatarStack.

Avatar picture and name of Atlassian user

Usage notes

You can access the current user's Atlassian account ID with the useProductContext UI hook.

Import statement

1
2
import ForgeUI, { Avatar } from '@forge/ui';

Props

NameTypeRequiredDescription
accountIdstringYesThe Atlassian account ID of the user.

Example

1
2
<Avatar accountId="5a1234bc8d12345e3f1g11hi" />

AvatarStack

In UI kit version 0.15.0 and later, the AvatarStack component has been removed and is replaced by the UserGroup component.

A stack of multiple avatars (name and profile picture) for users, subject to their privacy settings.

Avatar stack with seven Atlassian users

Import statement

1
2
import ForgeUI, { AvatarStack } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<Avatar>YesThe Atlassian account IDs for the users whose avatars are displayed in the AvatarStack. See Avatar for further details on the props.

Example

1
2
import ForgeUI, {render, AvatarStack, Avatar} from '@forge/ui';

const App = () => {
    return (
        <AvatarStack>
            <Avatar accountId="5a1234bc8d12345e3f1g11hi"/>
            <Avatar accountId="2a98a42dbc7ab42e12ee360d"/>
            <Avatar accountId="5d8732lq8jg85a0e3f1g90as"/>
            <Avatar accountId="2h98a10dbl5ab93e62hja23z"/>
            <Avatar accountId="7b20f0bc2d05325e3f1g43ty"/>
            <Avatar accountId="2p72s42dbc7ab42e90gf252d"/>
            <Avatar accountId="2l01x78mf4pqw42e84fg40ad"/>
        </AvatarStack>
    );
};

export const run = render (<App/>);

Badge

An inline visual indicator of a numeric value like a score or number of notifications.

Image of badges

Import statement

1
2
import ForgeUI, { Badge } from '@forge/ui';

Props

NameTypeRequiredDescription
textstringYesThe text within the badge.
appearancestringThe appearance of the badge. Valid values are added, default, important, primary, and removed. Defaults to default.

Example

A badge with a source-lines-of-code diff count.

1
2
<Text>
  <Badge appearance="removed" text="-10" />
  <Badge appearance="added" text="+27" />
  <Badge appearance="primary" text="5K" />
</Text>

Button

A button that triggers an event or action. A row of buttons is displayed in a ButtonSet.

Screenshot of what the rendered button should look like

Import statement

1
2
import ForgeUI, { Button } from '@forge/ui';

Props

NameTypeRequiredDescription
onClick() => void | Promise<void>YesAn event handler that can be asynchronous. You can execute state updates inside this function.
textstringYesThe button's label text.
appearancestringThe appearance of the button. Valid values are danger, default, link, subtle, subtle-link, and warning. Defaults to default.
disabledbooleanWhether the user interaction is disabled. Defaults to false.
iconstringAn icon to display with the button's text. Valid values are icons from @atlaskit/icon. For example, "add-circle" or "graph-line".
iconPosition"before" | "after"Where to render the icon relative to the text. Defaults to "before".

Example

1
2
<Button
     text="Sign up"
     onClick={async () => {
       await postSignup(data);
     }}
/>

ButtonSet

A layout container for multiple buttons.

Screenshot of what the rendered button set should look like

Import statement

1
2
import ForgeUI, { ButtonSet } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<Button>YesThe buttons to display in the set. On large-width devices, the buttons are rendered in a row that wraps to fit. On mobile devices, the buttons are full-width.

Example

1
2
<ButtonSet>
  <Button text="Allow" onClick={handleAllow} />
  <Button text="Deny" onClick={handleDeny} />
</ButtonSet>

Checkbox

See CheckboxGroup.

CheckboxGroup

A logical group of Checkbox components.

Screenshot of rendered checkbox group example

Usage notes

  • This component can only be used within a Form or a MacroConfig component.
  • All Checkbox components must be contained within a CheckboxGroup.

Import statement

1
2
import ForgeUI, { CheckboxGroup, Checkbox } from "@forge/ui";

Props

CheckboxGroup

NameTypeRequiredDescription
childrenArray<Checkbox>YesThe checkbox components.
labelstringYesThe label text that describes the checkbox group.
namestringYesThe name of the property when submitted.
descriptionstringThe text description of the checkbox group.

Checkbox

NameTypeRequiredDescription
defaultCheckedbooleanWhether the checkbox is initially checked. Defaults to false.
isRequiredbooleanIndicates to the user whether or not this checkbox must be selected to submit the form.
labelstringYesThe label text.
valuestringYesThe value of the property when submitted. Empty if not selected.

Example

1
2
<CheckboxGroup label="Products" name="products">
  <Checkbox value="jira" label="Jira" />
  <Checkbox value="confluence" label="Confluence" />
</CheckboxGroup>

Selected values are structured in an array. If the user selects “Jira”, it is passed to onSubmit:

1
2
{
  // ...other form data
  product: ["jira"];
}

Code

An entire block of formatted code, highlighted in the body text.

Screenshot of what the rendered code component should look like

Import statement

1
2
import ForgeUI, { Code } from '@forge/ui';

Props

NameTypeRequiredDescription
textstringYesThe code to be formatted.
languagestringThe language in which the code is written.

Supported languages

The code component currently supports the following programming languages:

"abap", "actionscript", "ada", "arduino", "autoit", "c", "c++", "coffeescript", "csharp", "css", "cuda", "d", "dart", "delphi", "elixir", "erlang", "fortran", "foxpro", "go", "graphql", "groovy", "haskell", "haxe", "html", "java", "javascript", "json", "julia", "kotlin", "latex", "livescript", "lua", "mathematica", "matlab", "objective-c", "objective-j", "objectpascal", "ocaml", "octave", "perl", "php", "powershell", "prolog", "puppet", "python", "qml", "r", "racket", "restructuredtext", "ruby", "rust", "sass", "scala", "scheme", "shell", "smalltalk", "sql", "standardml", "swift", "tcl", "tex", "text", "typescript", "vala", "vbnet", "verilog", "vhdl", "xml", "xquery"

Example

1
2
const App = () => {
  const exampleCodeBlock = `  // React Component
    class HelloMessage extends React.Component {
      render() {
        return (
          <div>
            Hello {this.props.name}
          </div>
        );
      }
    }

    ReactDOM.render(
      <HelloMessage name="Taylor" />,
      mountNode
    );
  `;
  return (
    <Code text={exampleCodeBlock} language="javascript" />
  );
};

DateLozenge

An inline component that displays a calendar date.

Screenshot of the rendered date

Import statement

1
2
import ForgeUI, { DateLozenge } from '@forge/ui';

Props

NameTypeRequiredDescription
valuenumberYesThe date represented as the number of milliseconds elapsed since Unix epoch.

Example

A text component with a nested DateLozenge component.

1
2
<Text>
  <DateLozenge value={new Date('07-29-1988').getTime()} />
</Text>

DatePicker

A form that lets users select a calendar date.

Screenshot of rendered datePicker example

Usage notes

  • The value displayed is in the user’s locale (i.e. 'DD-MM-YYYY' for en-NZ).
  • Can only be used inside a Form or a MacroConfig component.

Import statement

1
2
import ForgeUI, { DatePicker } from "@forge/ui";

Props

NameTypeRequiredDescription
defaultValuestringThe initial date value to display. It should be formatted as 'YYYY-MM-DD'.
isRequiredbooleanIndicates to the user whether or not a value in this field is required to submit the form.
labelstringYesThe label to display.
namestringYesThe key the input value is assigned to in the form object returned.
descriptionstringThe text description of the date picker.
placeholderstringThe placeholder helper text.

Example

A date picker to book an appointment.

1
2
<DatePicker name="date" label="Appointment Date" description="Appointment must be made 1 day in advance"/>

The submitted form data. The submitted date is always formatted as 'YYYY-MM-DD'.

1
2
{
  //... other form data
  date: "2019-11-01";
}

Form

A form that contains a list of components, a submit button, and a function that handles the submit event.

Screenshot of what the rendered Form should look like

Usage notes

Can contain any other component, except another Form component.

Import statement

1
2
import ForgeUI, { Form } from "@forge/ui";

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesAny component, except for a Form. Form components are controlled automatically and have their values added to the onSubmit call.
onSubmitformData => void | Promise<void>YesAn event handler that can be asynchronous. The argument, formData, is an object of input field keys to their values (see example). See the component documentation for details about values. You can execute state updates inside this function.
submitButtonAppearancestringThe appearance of the submit button. Valid values are default and primary. Defaults to default. See examples of appearance values.
submitButtonTextstringThe label text displayed on the form’s submit button. Defaults to Submit.
actionButtonsArray<Button>The array of the Button component. These buttons align to the right of the Submit button, letting you have additional form behaviors.

Example

1
2
import ForgeUI, {
  render,
  Button,
  Form,
  Fragment,
  TextField,
  CheckboxGroup,
  Checkbox,
  Macro,
  useState,
  Text,
} from "@forge/ui";

const App = () => {
  // useState is a UI kit hook we use to manage the form data in local state
  const [formState, setFormState] = useState(undefined);

  // Handles form submission, which is a good place to call APIs, or to set component state...
  const onSubmit = async (formData) => {
    /**
     * formData:
     * {
     *    username: 'Username',
     *    products: ['jira']
     * }
     */
    setFormState(formData);
  };

  const goBack = () => {};
  const cancel = () => {};

  // The array of additional buttons.
  // These buttons align to the right of the submit button.
  const actionButtons = [
    <Button text="Go back" onClick={goBack} />,
    <Button text="Cancel" onClick={cancel} />,
  ];

  return (
    <Fragment>
      <Form onSubmit={onSubmit} actionButtons={actionButtons}>
        <TextField name="username" label="Username" />
        <CheckboxGroup name="products" label="Products">
          <Checkbox defaultChecked value="jira" label="Jira" />
          <Checkbox value="confluence" label="Confluence" />
        </CheckboxGroup>
      </Form>
      {formState && <Text>{JSON.stringify(formState)}</Text>}
    </Fragment>
  );
};

export const run = render(<Macro app={<App />} />);

FormCondition

Display or hide a group of components based on a form field's value.

Screenshot of rendered FormCondition example hidden

Screenshot of rendered FormCondition example visible

Usage notes

Can only be used inside a Form.

Import statement

1
2
import ForgeUI, { FormCondition } from "@forge/ui";

Props

NameTypeRequiredDescription
whenstringYesThe name of the form field to switch on.
isstring | arrayYesThe value of the form field that causes the component to render its children.
childrenArray<ForgeComponent>YesAny component, except for a Form.

Example

1
2
<CheckboxGroup label="More options" name="JQLOption">
  <Checkbox label="Run a JQL Query" value="true" />
</CheckboxGroup>
<FormCondition when="JQLOption" is={['true']}>
  <TextField label="JQL Query" name="query" />
</FormCondition>

Heading

A piece of text at the top of a page or section.

Screenshot of what the rendered heading should look like

Import statement

1
2
import ForgeUI, { Heading } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenstringYesThe text of the heading.
size'small' | 'medium' | 'large'The size of the heading. Defaults to medium.

Example

1
2
<Heading size="large">Title</Heading>
<Text>
    Paragraph text goes here.
</Text>

Image

An image.

Gif of homer simpson retreating into bushes

Import statement

1
2
import ForgeUI, { Image } from '@forge/ui';

Image permissions

If you are using a URL for the image src, make sure that the image URL is added to the app's manifest file to load the image. For more information on how to declare image sources in an application's manifest file, see image permissions documentation.

Example to add an image URL in the manifest

1
2
permissions:
  external:
    images:
      - '<ImageURL>'

Props

NameTypeRequiredDescription
altstringYesThe alternative text displayed if the image is not loaded.
srcstringYesThe URL of the image.
size'xsmall' | 'small' | 'medium' | 'large' | 'xlarge'The size of the image. Defaults to xlarge.

Example

1
2
<Image
  src="https://media.giphy.com/media/jUwpNzg9IcyrK/source.gif"
  alt="homer"
/>

InlineDialog

A dialog that displays outside a block of content in a Confluence page.

The ContextMenu:

Example of a Context menu

The InlineDialog:

Example of a Context menu

Example: Dictionary app

Usage notes

  • Usually used for small bits of information
  • InlineDialog is required for the confluence:contextMenu module

Import statement

1
2
import ForgeUI, { InlineDialog } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesThe content of the inline dialog

Example

1
2
import ForgeUI, { render, Text, ContextMenu, InlineDialog } from '@forge/ui';

const App = () => {
    return (
        <InlineDialog>
            <Text>Hello world!</Text>
        </InlineDialog>
    );
};

export const run = render(
    <ContextMenu>
        <App/>
    </ContextMenu>
);

An inline component that displays a link.

Screenshot of the rendered link

Import statement

1
2
import ForgeUI, { Link } from '@forge/ui';

Props

NameTypeRequiredDescription
hrefstringYes

The prop href behaves like an HTML href. You should include http(s):// for full URLs. Relative paths, such as /wiki, are also supported.

appearancestringThe appearance of the link. Valid values are link, button, and primary-button. Defaults to link.
openNewTabbooleanWhether or not the link should open in a new tab. Defaults to false.

Example

A text component with a nested link that displays as a button.

1
2
<Text>
  <Link appearance="button" href="https://atlassian.com">
    Go to Atlassian
  </Link>
</Text>

MacroConfig

A form that defines the configuration options of a macro.

Example of configuring a Forge macro

Usage notes

  • The MacroConfig component should be used only at the root of the macro config function.

  • The MacroConfig component only accepts the following components: CheckboxGroup, DatePicker, RadioGroup, Select, TextArea, TextField, and UserPicker.

  • Unlike a Form, the MacroConfig component does not have an onSubmit prop. Instead, you retrieve the values with the useConfig hook.

Use configuration to store general data, but not sensitive information. The configuration data is stored in plaintext, so other users and apps can access and modify the values.

Import statement

1
2
import ForgeUI, { MacroConfig } from "@forge/ui";

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesAny of CheckboxGroup, DatePicker, RadioGroup, Select, TextArea, TextField, and UserPicker.

Example

An app that displays information about a pet in a macro. The configuration, as defined by the MacroConfig component, enables users to specify the name and age of the pet, with default values Unnamed Pet and 0.

1
2
import ForgeUI, { render, MacroConfig, TextField } from "@forge/ui";

const defaultConfig = {
  name: "Unnamed Pet",
  age: "0"
};

const Config = () => {
  return (
    <MacroConfig>
      <TextField name="name" label="Pet name" defaultValue={defaultConfig.name} />
      <TextField name="age" label="Pet age" defaultValue={defaultConfig.age} />
    </MacroConfig>
  );
};

export const config = render(<Config />);

ModalDialog

A dialog that appears in a layer above the app’s UI and requires user interaction.

Screenshot of modal dialog

Import statement

1
2
import ForgeUI, { ModalDialog } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesThe content of the modal dialog.
headerstringYesThe title of the modal dialog.
onClose() => void | Promise<void>YesThe function that is called when the modal is closed.
appearance"danger" | "warning"Shows an icon next to the header and changes the appearance of the action button. If appearance is not specified, the default appearance is a primary button with no header icon.
closeButtonTextstringThe label text displayed on the modal's close button. Defaults to Cancel.
width"small" | "medium" | "large" | "x-large"The width of the modal dialog. This can range from a small popup to almost full-screen width. Defaults to "medium".

Example

The example app below shows a ModalDialog when a Button is clicked.

1
2
const App = () => {
  const [isOpen, setOpen] = useState(false);
  return (
    <Fragment>
      <Button text="Show modal" onClick={() => setOpen(true)} />
      {isOpen && (
        <ModalDialog header="My modal dialog" onClose={() => setOpen(false)}>
          <Text>Hello there!</Text>
        </ModalDialog>
      )}
    </Fragment>
  );
};

The example app below demonstrates how to use the Form and ModalDialog components to prompt the user for information.

1
2
const App = () => {
  const [isOpen, setOpen] = useState(false);
  const [size, setSize] = useState("medium");
  return (
    <Fragment>
      <Button
        text={`Your size is ${size}. Click to change.`}
        onClick={() => setOpen(true)}
      />
      {isOpen && (
        <ModalDialog header="My modal dialog" onClose={() => setOpen(false)}>
          <Form
            onSubmit={data => {
              setSize(data.size);
              setOpen(false);
            }}
          >
            <Select label="T-shirt size" name="size">
              <Option label="Small" value="small" />
              <Option label="Medium" value="medium" />
              <Option label="Large" value="large" />
            </Select>
          </Form>
        </ModalDialog>
      )}
    </Fragment>
  );
};

Radio

See RadioGroup.

RadioGroup

A group of Radio buttons.

Screenshot of rendered radio group example

Usage notes

Can only be used inside a Form or a MacroConfig component.

Import statement

1
2
import ForgeUI, { RadioGroup, Radio } from "@forge/ui";

Props

RadioGroup

NameTypeRequiredDescription
isRequiredbooleanIndicates to the user whether or not a radio button in this group must be selected to submit the form. Defaults to false.
labelstringYesThe label text to display.
namestringYesThe key the selected radio button value is assigned to in the returned form object.
descriptionstringThe text description of the radio group.
childrenArray<Radio>YesThe radio buttons in the group. Each Radio is defined by a label that sets the radio buttons text and the value to return if the radio button is selected. One can have a defaultChecked property set to true to be the selected on initial load.

Radio

NameTypeRequiredDescription
defaultCheckedbooleanWhether this radio is initially checked. Defaults to false.
labelstringYesThe label text to display.
valuestringYesThe value of the property when submitted. Empty if not selected.

Example

1
2
<RadioGroup name="flavor" label="Pick a flavor" description="Add a flavor to your recipe">
  <Radio defaultChecked label="Strawberry" value="strawberry" />
  <Radio label="Cinnamon" value="cinnamon" />
  <Radio label="Chocolate" value="chocolate" />
</RadioGroup>

In the form data, if the option was selected:

1
2
{
  //... other form values
  flavor: "strawberry";
}

Range

A slider control that allows the user to select from a range of values.

Screenshot of rendered Range example

Usage notes

Can only be used inside a Form component.

Import statement

1
2
import ForgeUI, { Range } from "@forge/ui";

Props

NameTypeRequiredDescription
isRequiredbooleanIndicates to the user whether or not a range value is required to submit the form.
labelstringYesThe label text to display.
namestringYesThe key the input value is assigned to in the form object returned.
defaultValuestringThe selected range value that’s initially displayed.
minstringThe minimum range value that the slider can slide to.
maxstringThe maximum range value that the slider can slide to.
stepstringThe stepping interval between the min and max values that the slider can snap to. Must be greater than 0.

Example

A range component offering the ability to select from numbers 1 to 10.

1
2
<Range
    label="Range"
    name="my-range-field"
    min={1}
    max={10}
    step={1}
/>

SectionMessage

A text callout to alert users to important information.

Screenshot of what the rendered section message should look like

Import statement

1
2
import ForgeUI, { SectionMessage } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<Text>YesThe content of the section message.
titlestringThe title of the section message.
appearance"info" | "warning" | "error" | "confirmation" | "change"Shows an icon next to the title and changes the appearance of the section message. If appearance is not specified, the default appearance is "info".

Example

1
2
<SectionMessage title="Heading" appearance="info">
  <Text>Some text content</Text>
  <Text>More content</Text>
</SectionMessage>

Select

A field for users to make a single selection or multiple selections from a list of options.

Screenshot of rendered select example

Usage notes

Can only be used inside a Form or a MacroConfig component.

Import statement

1
2
import ForgeUI, { Select, Option } from "@forge/ui";

Props

Select

NameTypeRequiredDescription
childrenArray<Option>YesThe select list items. Each Option is defined by a label, which is displayed in the list, and a value, which is the string returned if the item is selected. Each Option can also have a defaultSelected prop, to make it selected on initial load.
isMultibooleanWhether the user can select multiple items from the list. Defaults to false.
isRequiredbooleanIndicates to the user whether or not one item from the dropdown list must be selected to submit the form.
labelstringYesThe label text to display.
namestringYesThe key the user-submitted value is assigned to in the form object returned. If isMulti is true, the submitted value is an array of strings; otherwise, it is a string.
descriptionstringThe text description of the select field.
placeholderstringThe placeholder text to display when no options are selected. It defaults to “Select …”

Option

NameTypeRequiredDescription
defaultSelectedbooleanWhether this option is initially selected. Defaults to false.
labelstringYesThe label text to display.
valuestringYesWhen submitted, and if selected, it will be included in the value of the array property.

Example

A select component offering the ability to select a milestone.

1
2
<Select label="With a defaultSelected" name="milestone">
  <Option defaultSelected label="Milestone 1" value="one" />
  <Option label="Milestone 2" value="two" />
  <Option label="Milestone 3" value="three" />
</Select>

If Milestone 1 is selected, the returned form object contains:

1
2
milestone: "one";

If isMulti is true, the form returns an array:

1
2
// nothing selected
{
  milestone: [];
}

// multiple selections
{
  milestone: ["one", "two"];
}

StatusLozenge

A lozenge to show a status.

Screenshot of a status lozenge

Import statement

1
2
import ForgeUI, { StatusLozenge } from '@forge/ui';

Props

NameTypeRequiredDescription
textstringYesThe text content of the status lozenge.
appearancestringThe appearance of the status lozenge. Valid values are default, inprogress, moved, new, removed, and success. Defaults to default.

Example

A text component with text content and a nested StatusLozenge component.

1
2
<Text>
  You have 4 tickets: <StatusLozenge text="In progress" appearance="inprogress" />
</Text>

Tab

Props

NameTypeRequiredDescription
labelstringYesThe label text to display.
childrenForgeComponentYesThe contents to display in the tab.

Tabs

A visual divider, used to organize content by grouping similar information into tabs on the same page.

Tabs example

Import statement

1
2
import ForgeUI, { Tabs, Tab } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenTabYesThe tab components to be displayed.

Example

1
2
<Tabs>
    <Tab label="Tab 1">
        <Text>Hello</Text>
    </Tab>
    <Tab label="Tab 2">
        <Text>World!</Text>
    </Tab>
</Tabs>

Table

A table that displays data and other components.

Screenshot of a rendered table

Usage notes

This component can't contain another Table component within itself.

Import statement

1
2
import ForgeUI, { Table, Head, Row, Cell } from '@forge/ui';

Props

NameTypeRequiredDescription
TableHead | Array<Row>YesTop-level component of a table.
HeadArray<Cell>YesContainer of cells for the heading row of the table. A table can only contain one Head.
RowArray<Cell>YesContainer of cells for a row of the table.
rowsPerPagenumberNoMaximum number of rows shown in the table before pagination is automatically enabled. Defaults to 25. Set to 0 to disable automatic pagination.
CellForgeComponentYesCell can contain any value or component, except a Table component.

Example

1
2
import ForgeUI, { render, Macro, Table, Head, Cell, Text, Row } from '@forge/ui';

const issues = [
  {
    key: 'XEN-1',
    status: 'In Progress',
  },
  {
    key: 'XEN-2',
    status: 'To Do',
  },
];

const App = () => (
  <Table>
    <Head>
      <Cell>
        <Text>Issue Key</Text>
      </Cell>
      <Cell>
        <Text>Status</Text>
      </Cell>
    </Head>
    {issues.map(issue => (
      <Row>
        <Cell>
          <Text>{issue.key}</Text>
        </Cell>
        <Cell>
          <Text>{issue.status}</Text>
        </Cell>
      </Row>
    ))}
  </Table>
);

export const run = render(<Macro app={<App />} />);

Tag

A visual indicator for UI objects, for quick recognition and navigation.

Image of a tag

Import statement

1
2
import ForgeUI, { Tag } from '@forge/ui';

Props

NameTypeRequiredDescription
textstringYesThe text content to display.
colorstringThe color of the tag. Valid values are green, blue, red, purple, grey, teal, yellow, green-light, blue-light, red-light, purple-light, grey-light, teal-light, and yellow-light. Defaults to light-grey.

Example

1
2
<Tag text="decision" />
<Tag text="spec" color="blue-light" />

TagGroup

A layout container for multiple tags.

Image of tag group

Import statement

1
2
import ForgeUI, { Tag, TagGroup } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<Tag>YesThe tag components to be displayed. See Tag for further details on the props.

Example

A simple group of two tag components.

1
2
<TagGroup>
    <Tag text="tag 1" />
    <Tag text="tag 2" />
</TagGroup>

Text

A piece of plain text with basic text formatting options.

It can also include inline components such as Badge, DateLozenge, and StatusLozenge.

Screenshot of what the rendered text should look like

Deprecation notice

Markdown syntax has been deprecated and removed on 23 March 2021 in the @forge/ui@0.9.0 release. Apps that use @forge/ui must use markup components.

Usage notes

The text formatting options are listed here.

Import statement

1
2
import ForgeUI, { Text } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenstring | ForgeInlineComponentYesThe text and inline components to display.

Example

1
2
import ForgeUI, { Text, Strong } from '@forge/ui';

<Text>
  Some <Strong>bold text</Strong>
</Text>

TextArea

A field for users to enter multiple lines of text.

Screenshot of rendered text area example

Usage notes

Can only be used inside a Form component.

Import statement

1
2
import ForgeUI, { TextArea } from "@forge/ui";

Props

NameTypeRequiredDescription
defaultValuestringThe initial text value of the field.
isMonospacedbooleanWhether or not to style the text as monospaced.
isRequiredbooleanIndicates to the user whether or not a value in this field is required to submit the form.
labelstringYesThe label text to display.
namestringYesThe key the input value is assigned to in the form object returned.
descriptionstringThe text description of the text area input.
placeholderstringThe placeholder helper text.
spellCheckbooleanThe HTML attribute that determines whether the text should be checked for spelling errors. Defaults to false.

Example

A text area for a message.

1
2
<TextArea label="Message" name="message" />

The submitted form data.

1
2
{
  //... other form data
  message: "user input";
}

TextField

A field for users to enter a single line of text.

Screenshot of rendered text-field example

Usage notes

Can only be used inside a Form or a MacroConfig component.

Import statement

1
2
import ForgeUI, { TextField } from "@forge/ui";

Props

NameTypeRequiredDescription
labelstringYesThe label text to display.
namestringYesThe key the input value is assigned to in the form object returned.
defaultValuestringThe initial text value of the field.
isRequiredbooleanIndicates to the user whether or not a value in this field is required to submit the form.
descriptionstringThe text description of the field.
placeholderstringThe placeholder helper text.
type"text" | "number" | "email" | "tel" | "password"The input type of the field.
autoComplete"off"Optionally disable HTML autocomplete.

Example

A field for entering a name.

1
2
<TextField label="Name" name="name" />

Toggle

A toggle for viewing or switching between enabled or disabled states.

Screenshot of rendered toggle example

Import statement

1
2
import ForgeUI, { Toggle } from "@forge/ui";

Props

NameTypeRequiredDescription
labelstringYesThe label text to display.
namestringYesThe key the input value is assigned to in the form object returned.
defaultCheckedbooleanWhether the toggle is initially checked. Defaults to false.

Example

1
2
<Toggle label="Show section" name="isSectionVisible" />

Tooltip

A tooltip that displays when hovering over another component.

Screenshot of tooltip component

Import statement

1
2
import ForgeUI, { Tooltip } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenForgeElementYesThe component to wrap the tooltip around.
textstringYesThe message to display in the tooltip.

Example

A tooltip wrapping a button component. Hovering over the button will display the tooltip with Hello World.

1
2
<Tooltip text="Hello World">
    <Button
       text="Hover over me"
       onClick={() => console.log("Hello World")}
    />
</Tooltip>

User

A component that represents a user, displaying details such as name and profile picture, subject to the user's privacy settings.

User picture and name of Atlassian user

The User component can also be used within a Text component, appearing as a lozenge with the name of the user when used within this context.

Import statement

1
2
import ForgeUI, { User } from '@forge/ui';

Props

NameTypeRequiredDescription
accountIdstringYesThe Atlassian account ID of the user.

Example

Display a user.

1
2
<User accountId="5a1234bc8d12345e3f1g11hi" />

Note, you can access the current user's Atlassian account ID in the app product context.

UserGroup

A stack of multiple users (name and profile picture), subject to their privacy settings.

User group with seven Atlassian users

The UserGroup component can also be used within a Text component, appearing as lozenges with the names of the users when used within this context.

Import statement

1
2
import ForgeUI, { UserGroup } from '@forge/ui';

Props

NameTypeRequiredDescription
childrenArray<User>YesThe users (specified by Atlassian account ID) whose avatars and/or names are displayed in the UserGroup. See User for further details on the props.

Example

A simple group of seven users using the UserGroup component.

1
2
import ForgeUI, { render, UserGroup, User } from '@forge/ui';

const App = () => {
    return (
        <UserGroup>
            <User accountId="5a1234bc8d12345e3f1g11hi"/>
            <User accountId="2a98a42dbc7ab42e12ee360d"/>
            <User accountId="5d8732lq8jg85a0e3f1g90as"/>
            <User accountId="2h98a10dbl5ab93e62hja23z"/>
            <User accountId="7b20f0bc2d05325e3f1g43ty"/>
            <User accountId="2p72s42dbc7ab42e90gf252d"/>
            <User accountId="2l01x78mf4pqw42e84fg40ad"/>
        </UserGroup>
    );
};

export const run = render (<App/>);

UserPicker

A dropdown that lists a selectable range of users on the site.

Screenshot of rendered UserPicker example

Usage notes

  • This component can only be used inside a Form component.
  • This component is not supported on workspace-based products such as Bitbucket.

Import statement

1
2
import ForgeUI, { UserPicker } from "@forge/ui";

Props

NameTypeRequiredDescription
isMultibooleanWhether the user can select multiple users from the list. Defaults to false.
isRequiredbooleanIndicates to the user whether or not a value in this field is required to submit the form.
labelstringYesThe label text to display.
namestringYesThe key the input value is assigned to in the Form object returned. If isMulti is true, the submitted value is an array of strings; otherwise, it is a string.
defaultValuestringThe initial user to display. The value should be an Atlassian account ID.
descriptionstringThe text description of the user picker field.
placeholderstringThe placeholder helper text.

Example

A field for selecting a user.

1
2
<UserPicker label="User" name="user" />

The returned Form object contains the Atlassian account ID of the selected user.

1
2
user: "1a2345bc6789012d3e45f67";

Rate this page: