Block
@dopt/react / Exports / Block
Interface: Block<T>
Type parameters
Name | Type |
---|---|
T | unknown |
Hierarchy
Block
Table of contents
Properties
Properties
type
• type: "custom"
| "card"
| "modal"
| "checklist"
| "checklistItem"
| "tour"
| "tourItem"
Defined in
packages/@dopt/react/src/types.ts:113
kind
• kind: "block"
Defined in
packages/@dopt/react/src/types.ts:114
uid
• uid: string
Defined in
packages/@dopt/react/src/types.ts:115
sid
• sid: string
Defined in
packages/@dopt/react/src/types.ts:116
version
• version: number
Defined in
packages/@dopt/react/src/types.ts:117
state
• state: Object
The up-to-date state of this Block instance.
Type declaration
Name | Type |
---|---|
active | boolean |
entered | boolean |
exited | boolean |
Defined in
packages/@dopt/react/src/types.ts:121
transition
• transition: BlockTransition
<T
>
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.
Defined in
packages/@dopt/react/src/types.ts:130
transitioned
• transitioned: T
extends [string
, ...string[]] ? Record
<T
[number
], undefined
| boolean
> : 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'];
Defined in
packages/@dopt/react/src/types.ts:155
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
Name | Type |
---|---|
V | extends null | string | number | boolean | Record <string , any >[] |
Parameters
Name | Type |
---|---|
name | string |
Returns
undefined
| null
| V
Defined in
packages/@dopt/react/src/types.ts:168
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.