Hiyve Components - v1.0.0
    Preparing search index...

    A block type your app adds to courses — an activity from your own product that providers can drop into lessons.

    interface CourseBlockType<TData = unknown> {
        createDefault: () => TData;
        Editor: ComponentType<CustomBlockEditorProps<TData>>;
        fileRefs?: (data: TData) => MediaRef[];
        icon?: ReactNode;
        kind: string;
        label: string;
        migrate?: (data: unknown, fromVersion: number) => TData;
        summarize?: (data: TData) => string;
        version: number;
        View: ComponentType<CustomBlockViewProps<TData>>;
    }

    Type Parameters

    • TData = unknown
    Index

    Properties

    createDefault: () => TData

    Data for a new block.

    Editor: ComponentType<CustomBlockEditorProps<TData>>

    Edits the block in the builder.

    fileRefs?: (data: TData) => MediaRef[]

    Stored files the block uses, so they are shared with clients along with the lesson.

    icon?: ReactNode

    Icon shown next to the name.

    kind: string

    Unique, namespaced kind (e.g. 'acme.checklist'). Stored with each block.

    label: string

    Name shown in the builder's block palette.

    migrate?: (data: unknown, fromVersion: number) => TData

    Turn data saved by an older version into the current shape.

    summarize?: (data: TData) => string

    One-line description of a block for the builder's block list.

    version: number

    Version of data's shape. Bump it when the shape changes and handle old data in migrate.

    View: ComponentType<CustomBlockViewProps<TData>>

    Shows the block in the course player.