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.
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.
You can access the current user's Atlassian account ID with the useProductContext UI hook.
1 2import ForgeUI, { Avatar } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
accountId | string | Yes | The Atlassian account ID of the user. |
1 2<Avatar accountId="5a1234bc8d12345e3f1g11hi" />
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.
1 2import ForgeUI, { AvatarStack } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<Avatar> | Yes | The Atlassian account IDs for the users whose avatars are displayed in the AvatarStack. See Avatar for further details on the props. |
1 2import 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/>);
An inline visual indicator of a numeric value like a score or number of notifications.
1 2import ForgeUI, { Badge } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The text within the badge. |
appearance | string | The appearance of the badge. Valid values are added , default , important , primary , and removed . Defaults to default . |
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>
A button that triggers an event or action. A row of buttons is displayed in a ButtonSet.
1 2import ForgeUI, { Button } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
onClick | () => void | Promise<void> | Yes | An event handler that can be asynchronous. You can execute state updates inside this function. |
text | string | Yes | The button's label text. |
appearance | string | The appearance of the button. Valid values are danger ,
default , link , subtle , subtle-link ,
and warning . Defaults to default . | |
disabled | boolean | Whether the user interaction is disabled. Defaults to false. | |
icon | string | An 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". |
1 2<Button text="Sign up" onClick={async () => { await postSignup(data); }} />
A layout container for multiple buttons.
1 2import ForgeUI, { ButtonSet } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<Button> | Yes | The 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. |
1 2<ButtonSet> <Button text="Allow" onClick={handleAllow} /> <Button text="Deny" onClick={handleDeny} /> </ButtonSet>
See CheckboxGroup
.
A logical group of Checkbox
components.
Form
or a MacroConfig
component.Checkbox
components must be contained within a CheckboxGroup
.1 2import ForgeUI, { CheckboxGroup, Checkbox } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
children | Array<Checkbox> | Yes | The checkbox components. |
label | string | Yes | The label text that describes the checkbox group. |
name | string | Yes | The name of the property when submitted. |
description | string | The text description of the checkbox group. |
Name | Type | Required | Description |
---|---|---|---|
defaultChecked | boolean | Whether the checkbox is initially checked. Defaults to false. | |
isRequired | boolean | Indicates to the user whether or not this checkbox must be selected to submit the form. | |
label | string | Yes | The label text. |
value | string | Yes | The value of the property when submitted. Empty if not selected. |
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"]; }
An entire block of formatted code, highlighted in the body text.
1 2import ForgeUI, { Code } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The code to be formatted. |
language | string | The language in which the code is written. |
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"
1 2const 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" /> ); };
An inline component that displays a calendar date.
1 2import ForgeUI, { DateLozenge } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
value | number | Yes | The date represented as the number of milliseconds elapsed since Unix epoch. |
A text component with a nested DateLozenge
component.
1 2<Text> <DateLozenge value={new Date('07-29-1988').getTime()} /> </Text>
A form that lets users select a calendar date.
'DD-MM-YYYY'
for en-NZ).Form
or a MacroConfig
component.1 2import ForgeUI, { DatePicker } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
defaultValue | string | The initial date value to display. It should be formatted as 'YYYY-MM-DD' . | |
isRequired | boolean | Indicates to the user whether or not a value in this field is required to submit the form. | |
label | string | Yes | The label to display. |
name | string | Yes | The key the input value is assigned to in the form object returned. |
description | string | The text description of the date picker. | |
placeholder | string | The placeholder helper text. |
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"; }
A form that contains a list of components, a submit button, and a function that handles the submit event.
Can contain any other component, except another Form
component.
1 2import ForgeUI, { Form } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
children | Array<ForgeComponent> | Yes | Any component, except for a Form . Form components are controlled automatically and have their values
added to the onSubmit call. |
onSubmit | formData => void | Promise<void> | Yes | An 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. |
submitButtonAppearance | string | The appearance of the submit button. Valid values are
default and primary . Defaults to default . See examples of appearance values. | |
submitButtonText | string | The label text displayed on the form’s submit button. Defaults to Submit . | |
actionButtons | Array<Button> | The array of the Button component.
These buttons align to the right of the Submit button, letting you have additional form behaviors. |
1 2import 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 />} />);
Display or hide a group of components based on a form field's value
.
Can only be used inside a Form
.
1 2import ForgeUI, { FormCondition } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
when | string | Yes | The name of the form field to switch on. |
is | string | array | Yes | The value of the form field that causes the component to render its children . |
children | Array<ForgeComponent> | Yes | Any component, except for a Form . |
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>
A piece of text at the top of a page or section.
1 2import ForgeUI, { Heading } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | string | Yes | The text of the heading. |
size | 'small' | 'medium' | 'large' | The size of the heading. Defaults to medium . |
1 2<Heading size="large">Title</Heading> <Text> Paragraph text goes here. </Text>
An image.
1 2import ForgeUI, { Image } from '@forge/ui';
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 2permissions: external: images: - '<ImageURL>'
Name | Type | Required | Description |
---|---|---|---|
alt | string | Yes | The alternative text displayed if the image is not loaded. |
src | string | Yes | The URL of the image. |
size | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | The size of the image. Defaults to xlarge . |
1 2<Image src="https://media.giphy.com/media/jUwpNzg9IcyrK/source.gif" alt="homer" />
A dialog that displays outside a block of content in a Confluence page.
The ContextMenu:
The InlineDialog
:
Example: Dictionary app
InlineDialog
is required for the confluence:contextMenu
module1 2import ForgeUI, { InlineDialog } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<ForgeComponent> | Yes | The content of the inline dialog |
1 2import 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.
1 2import ForgeUI, { Link } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
href | string | Yes | The prop |
appearance | string | The appearance of the link. Valid values are link , button , and primary-button . Defaults to link . | |
openNewTab | boolean | Whether or not the link should open in a new tab. Defaults to false . |
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>
A form that defines the configuration options of a macro.
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.
1 2import ForgeUI, { MacroConfig } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
children | Array<ForgeComponent> | Yes | Any of CheckboxGroup , DatePicker , RadioGroup , Select , TextArea , TextField , and UserPicker . |
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 2import 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 />);
A dialog that appears in a layer above the app’s UI and requires user interaction.
1 2import ForgeUI, { ModalDialog } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<ForgeComponent> | Yes | The content of the modal dialog. |
header | string | Yes | The title of the modal dialog. |
onClose | () => void | Promise<void> | Yes | The 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. | |
closeButtonText | string | The 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". |
The example app below shows a ModalDialog
when a Button
is clicked.
1 2const 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 2const 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> ); };
See RadioGroup
.
A group of Radio
buttons.
Can only be used inside a Form
or a MacroConfig
component.
1 2import ForgeUI, { RadioGroup, Radio } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
isRequired | boolean | Indicates to the user whether or not a radio button in this group must be selected to submit the form. Defaults to false. | |
label | string | Yes | The label text to display. |
name | string | Yes | The key the selected radio button value is assigned to in the returned form object. |
description | string | The text description of the radio group. | |
children | Array<Radio> | Yes | The 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. |
Name | Type | Required | Description |
---|---|---|---|
defaultChecked | boolean | Whether this radio is initially checked. Defaults to false. | |
label | string | Yes | The label text to display. |
value | string | Yes | The value of the property when submitted. Empty if not selected. |
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"; }
A slider control that allows the user to select from a range of values.
Can only be used inside a Form
component.
1 2import ForgeUI, { Range } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
isRequired | boolean | Indicates to the user whether or not a range value is required to submit the form. | |
label | string | Yes | The label text to display. |
name | string | Yes | The key the input value is assigned to in the form object returned. |
defaultValue | string | The selected range value that’s initially displayed. | |
min | string | The minimum range value that the slider can slide to. | |
max | string | The maximum range value that the slider can slide to. | |
step | string | The stepping interval between the min and max values that the slider can snap to. Must be greater than 0. |
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} />
A text callout to alert users to important information.
1 2import ForgeUI, { SectionMessage } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<Text> | Yes | The content of the section message. |
title | string | The 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" . |
1 2<SectionMessage title="Heading" appearance="info"> <Text>Some text content</Text> <Text>More content</Text> </SectionMessage>
A field for users to make a single selection or multiple selections from a list of options.
Can only be used inside a Form
or a MacroConfig
component.
1 2import ForgeUI, { Select, Option } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
children | Array<Option> | Yes | The 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. |
isMulti | boolean | Whether the user can select multiple items from the list. Defaults to false. | |
isRequired | boolean | Indicates to the user whether or not one item from the dropdown list must be selected to submit the form. | |
label | string | Yes | The label text to display. |
name | string | Yes | The 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. |
description | string | The text description of the select field. | |
placeholder | string | The placeholder text to display when no options are selected. It defaults to “Select …” |
Name | Type | Required | Description |
---|---|---|---|
defaultSelected | boolean | Whether this option is initially selected. Defaults to false. | |
label | string | Yes | The label text to display. |
value | string | Yes | When submitted, and if selected, it will be included in the value of the array property. |
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 2milestone: "one";
If isMulti
is true, the form returns an array:
1 2// nothing selected { milestone: []; } // multiple selections { milestone: ["one", "two"]; }
A lozenge to show a status.
1 2import ForgeUI, { StatusLozenge } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The text content of the status lozenge. |
appearance | string | The appearance of the status lozenge. Valid values are default , inprogress , moved , new , removed , and success . Defaults to default . |
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>
Name | Type | Required | Description |
---|---|---|---|
label | string | Yes | The label text to display. |
children | ForgeComponent | Yes | The contents to display in the tab. |
A visual divider, used to organize content by grouping similar information into tabs on the same page.
1 2import ForgeUI, { Tabs, Tab } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Tab | Yes | The tab components to be displayed. |
1 2<Tabs> <Tab label="Tab 1"> <Text>Hello</Text> </Tab> <Tab label="Tab 2"> <Text>World!</Text> </Tab> </Tabs>
A table that displays data and other components.
This component can't contain another Table
component within itself.
1 2import ForgeUI, { Table, Head, Row, Cell } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
Table | Head | Array<Row> | Yes | Top-level component of a table. |
Head | Array<Cell> | Yes | Container of cells for the heading row of the table. A table can only contain one Head . |
Row | Array<Cell> | Yes | Container of cells for a row of the table. |
rowsPerPage | number | No | Maximum number of rows shown in the table before pagination is automatically enabled. Defaults to 25. Set to 0 to disable automatic pagination. |
Cell | ForgeComponent | Yes | Cell can contain any value or component, except a Table component. |
1 2import 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 />} />);
A visual indicator for UI objects, for quick recognition and navigation.
1 2import ForgeUI, { Tag } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The text content to display. |
color | string | The 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 . |
1 2<Tag text="decision" /> <Tag text="spec" color="blue-light" />
A layout container for multiple tags.
1 2import ForgeUI, { Tag, TagGroup } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<Tag> | Yes | The tag components to be displayed. See Tag for further details on the props. |
A simple group of two tag components.
1 2<TagGroup> <Tag text="tag 1" /> <Tag text="tag 2" /> </TagGroup>
A piece of plain text with basic text formatting options.
It can also include inline components such as Badge, DateLozenge, and StatusLozenge.
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.
The text formatting options are listed here.
Name | Markup | Output |
---|---|---|
code | <Code text="code" /> | code |
em |
<Em>em</Em>
|
em |
link |
See the Link documentation for more details. | |
strike |
<Strike>strike</Strike>
| |
strong |
<Strong>strong</Strong>
|
strong |
1 2import ForgeUI, { Text } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | string | ForgeInlineComponent | Yes | The text and inline components to display. |
1 2import ForgeUI, { Text, Strong } from '@forge/ui'; <Text> Some <Strong>bold text</Strong> </Text>
A field for users to enter multiple lines of text.
Can only be used inside a Form
component.
1 2import ForgeUI, { TextArea } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
defaultValue | string | The initial text value of the field. | |
isMonospaced | boolean | Whether or not to style the text as monospaced . | |
isRequired | boolean | Indicates to the user whether or not a value in this field is required to submit the form. | |
label | string | Yes | The label text to display. |
name | string | Yes | The key the input value is assigned to in the form object returned. |
description | string | The text description of the text area input. | |
placeholder | string | The placeholder helper text. | |
spellCheck | boolean | The HTML attribute that determines whether the text should be checked for spelling errors. Defaults to false. |
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"; }
A field for users to enter a single line of text.
Can only be used inside a Form
or a MacroConfig
component.
1 2import ForgeUI, { TextField } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
label | string | Yes | The label text to display. |
name | string | Yes | The key the input value is assigned to in the form object returned. |
defaultValue | string | The initial text value of the field. | |
isRequired | boolean | Indicates to the user whether or not a value in this field is required to submit the form. | |
description | string | The text description of the field. | |
placeholder | string | The placeholder helper text. | |
type | "text" | "number" | "email" | "tel" | "password" | The input type of the field. | |
autoComplete | "off" | Optionally disable HTML autocomplete. |
A field for entering a name.
1 2<TextField label="Name" name="name" />
A toggle for viewing or switching between enabled or disabled states.
1 2import ForgeUI, { Toggle } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
label | string | Yes | The label text to display. |
name | string | Yes | The key the input value is assigned to in the form object returned. |
defaultChecked | boolean | Whether the toggle is initially checked. Defaults to false. |
1 2<Toggle label="Show section" name="isSectionVisible" />
A tooltip that displays when hovering over another component.
1 2import ForgeUI, { Tooltip } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | ForgeElement | Yes | The component to wrap the tooltip around. |
text | string | Yes | The message to display in the tooltip. |
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>
A component that represents a user, displaying details such as name and profile picture, subject to the user's privacy settings.
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.
1 2import ForgeUI, { User } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
accountId | string | Yes | The Atlassian account ID of the user. |
Display a user.
1 2<User accountId="5a1234bc8d12345e3f1g11hi" />
Note, you can access the current user's Atlassian account ID in the app product context.
A stack of multiple users (name and profile picture), subject to their privacy settings.
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.
1 2import ForgeUI, { UserGroup } from '@forge/ui';
Name | Type | Required | Description |
---|---|---|---|
children | Array<User> | Yes | The users (specified by Atlassian account ID) whose avatars and/or names are displayed in the UserGroup. See User for further details on the props. |
A simple group of seven users using the UserGroup
component.
1 2import 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/>);
A dropdown that lists a selectable range of users on the site.
Form
component.1 2import ForgeUI, { UserPicker } from "@forge/ui";
Name | Type | Required | Description |
---|---|---|---|
isMulti | boolean | Whether the user can select multiple users from the list. Defaults to false. | |
isRequired | boolean | Indicates to the user whether or not a value in this field is required to submit the form. | |
label | string | Yes | The label text to display. |
name | string | Yes | The 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. |
defaultValue | string | The initial user to display. The value should be an Atlassian account ID. | |
description | string | The text description of the user picker field. | |
placeholder | string | The placeholder helper text. |
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 2user: "1a2345bc6789012d3e45f67";
Rate this page: