Forge Developer

Beta

Forge Developer

Beta

Rate this page:

Fragment

Fragments return a list of components. Similar to React’s Fragment. Because a function can only return one top-level component, it is used for wrapping a list of top-level components.

Usage

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

Props

NameTypeRequiredDescription
childrenArray<ForgeComponent>YesA container for displaying multiple components. Can contain any Forge UI component.

Example

Using a Fragment to return multiple components.

1
2
3
4
5
6
const App = () => (
  <Fragment>
    <Text content="Hello world!" />
    <Button text="Do something" onClick={onClick} />
  </Fragment>
);

Preview

Screenshot of rendered Fragment example

Rate this page: