Skip to main content

Class: CollectionComponent<P>

A component that lets you add and remove children.

Type parameters

NameType
Pextends CollectionComponentProps

Hierarchy

Constructors

constructor

new CollectionComponent<P>(props): CollectionComponent<P>

Creates an instance of a DisplayComponent.

Type parameters

NameType
Pextends CollectionComponentProps

Parameters

NameTypeDescription
propsPThe propertis of the component.

Returns

CollectionComponent<P>

Inherited from

DisplayComponent.constructor

Defined in

src/sdk/components/FSComponent.ts:73

Properties

context

Optional context: [] = undefined

The context on this component, if any.

Inherited from

DisplayComponent.context

Defined in

src/sdk/components/FSComponent.ts:64


contextType

Optional Readonly contextType: readonly [] = undefined

The type of context for this component, if any.

Inherited from

DisplayComponent.contextType

Defined in

src/sdk/components/FSComponent.ts:67


props

props: P & ComponentProps

The properties of the component.

Inherited from

DisplayComponent.props

Defined in

src/sdk/components/FSComponent.ts:61

Methods

addItem

addItem(node): string

Add a new child element.

Parameters

NameTypeDescription
nodeVNodeA VNode to add to the container.

Returns

string

An identifier for the added element.

Defined in

src/sdk/components/CollectionComponent.tsx:29


destroy

destroy(): void

Destroys this component.

Returns

void

Inherited from

DisplayComponent.destroy

Defined in

src/sdk/components/FSComponent.ts:98


getContext

getContext(context): never

Gets a context data subscription from the context collection.

Parameters

NameTypeDescription
contextneverThe context to get the subscription for.

Returns

never

The requested context.

Throws

An error if no data for the specified context type could be found.

Inherited from

DisplayComponent.getContext

Defined in

src/sdk/components/FSComponent.ts:106


insertAfter

insertAfter(node, after): string

Insert a child after an element.

Parameters

NameTypeDescription
nodeVNodeThe node to insert
afterstringThe element to insert after.

Returns

string

An identifier for the added element.

Defined in

src/sdk/components/CollectionComponent.tsx:61


insertBefore

insertBefore(node, before): string

Insert a child before an element.

Parameters

NameTypeDescription
nodeVNodeThe node to insert
beforestringThe element to insert before.

Returns

string

An identifier for the added element.

Defined in

src/sdk/components/CollectionComponent.tsx:49


onAfterRender

onAfterRender(node): void

A callback that is called after the component is rendered.

Parameters

NameTypeDescription
nodeVNodeThe component's VNode.

Returns

void

Inherited from

DisplayComponent.onAfterRender

Defined in

src/sdk/components/FSComponent.ts:87


onBeforeRender

onBeforeRender(): void

A callback that is called before the component is rendered.

Returns

void

Inherited from

DisplayComponent.onBeforeRender

Defined in

src/sdk/components/FSComponent.ts:80


removeItem

removeItem(id): void

Remove a child element.

Parameters

NameTypeDescription
idstringThe ID of the child to remove.

Returns

void

Defined in

src/sdk/components/CollectionComponent.tsx:39


render

render(): VNode

Render the element.

Returns

VNode

A VNode.

Overrides

DisplayComponent.render

Defined in

src/sdk/components/CollectionComponent.tsx:71