Skip to main content

Container

@dopt/react / Exports / Container

Interface: Container

A container is a block which encapsulates other blocks. For example, a "checklist" encapsulates its children.

A container extends Block and has all the properties that a block has. Calling the transition function on the container transitions the parent block.

A container also has children which are also of type Block and are contained within the parent block. These children all have ['containerUid'] pointing to the parent's ['uid'].

Hierarchy

Table of contents

Properties

Properties

children

children: Block<unknown>[]

Accessing children directly from a container doesn't permit type-safety for block.transitioned.

Defined in

packages/@dopt/react/src/types.ts:328


type

type: "custom" | "card" | "modal" | "checklist" | "checklistItem" | "hints" | "hintsItem" | "tour" | "tourItem"

Inherited from

Block.type

Defined in

packages/@dopt/react/src/types.ts:124


kind

kind: "block"

Inherited from

Block.kind

Defined in

packages/@dopt/react/src/types.ts:125


uid

uid: string

Inherited from

Block.uid

Defined in

packages/@dopt/react/src/types.ts:126


sid

sid: string

Inherited from

Block.sid

Defined in

packages/@dopt/react/src/types.ts:127


version

version: number

Inherited from

Block.version

Defined in

packages/@dopt/react/src/types.ts:128


state

state: Object

The up-to-date state of this Block instance.

Type declaration

NameType
activeboolean
enteredboolean
exitedboolean

Inherited from

Block.state

Defined in

packages/@dopt/react/src/types.ts:132


transition

transition: BlockTransition<unknown>

A function correspond to an intent-based API for signaling state transitions on a block. This function has side effects: it changes the state of other blocks and the flow as well. For example, transitioning a block activates the next block and transitioning the last block finishes a flow.

Inherited from

Block.transition

Defined in

packages/@dopt/react/src/types.ts:141


transitioned

transitioned: Record<string, undefined | boolean>

The up-to-date transitioned values for this Block instance.

Contains the edges which have been transitioned for this instance. If the edge exists, it's value will be true / false, otherwise the value will be undefined.

Example

const [block] = useBlock("HNWvcT78tyTwygnbzU6SW");
const firstTransitioned = block.transitioned['first-edge'];

In typescript, if a block is accessed with generics:

const [block] = useBlock<['a-edge']>("HNWvcT78tyTwygnbzU6SW");

// this is valid
block.transitioned['a-edge'];

// this is invalid
block.transitioned['b-edge'];

Inherited from

Block.transitioned

Defined in

packages/@dopt/react/src/types.ts:166


field

field: <V>(name: string) => undefined | null | V

Type declaration

▸ <V>(name): undefined | null | V

Gets the field (see ['value']) with the name (see ['sid']) contained by this Block.

If Dopt is loading or Block does not have a field with the specified name, undefined is returned.

null is returned when the field has been explicitly configured in app.dopt.com to have an empty value.

Type parameters
NameType
Vextends null | string | number | boolean | Record<string, any>[]
Parameters
NameType
namestring
Returns

undefined | null | V

Inherited from

Block.field

Defined in

packages/@dopt/react/src/types.ts:179


containerUid

Optional containerUid: string

If a block is contained within another block, for example a "checklistItem" within a "checklist", this property will point to the parent "checklist" block's uid.

Otherwise, this property will be undefined.

Inherited from

Block.containerUid

Defined in

packages/@dopt/react/src/types.ts:187