# tableberg/1.1.5/src/CellChildAutoCompleter.tsx

Tableberg – Simple Gutenberg Table Block, version 1.1.5. 57 lines.

- Page: https://pluginprobe.com/plugins/tableberg/1.1.5/code/src/CellChildAutoCompleter.tsx
- Raw: https://pluginprobe.com/plugins/tableberg/1.1.5/raw/src/CellChildAutoCompleter.tsx
- Modified: 2026-09-16T03:30:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tableberg/1.1.5/code/src/CellChildAutoCompleter.tsx#L10-L20`.

```tsx
import { WPCompleter } from "@wordpress/components/build-types/autocomplete/types";
import buttonBlockIcon from "@tableberg/shared/icons/button";
import imageBlockIcon from "@tableberg/shared/icons/image";
import StyledListIcon from "@tableberg/shared/icons/styled-list";
import RibbonIcon from "@tableberg/shared/icons/ribbon";
import { ElementTypes } from "./attributes";
import { getExtendedElementDefinitions } from "./extensions";

function OptionIcon(icon: JSX.Element) {
    return <span className="block-editor-block-icon has-colors">{icon}</span>;
}

type Option = {
    icon: JSX.Element;
    name: string;
    value: ElementTypes;
    disabled?: boolean;
};

const baseCellChildAutoCompleter: WPCompleter<Option> = {
    name: "cell-blocks",
    triggerPrefix: "/",
    className: "block-editor-autocompleters__block",
    options: [],
    getOptionLabel: option => [OptionIcon(option.icon), option.name],
    getOptionKeywords: option => [option.name],
    isOptionDisabled: option => option.disabled ?? false,
    getOptionCompletion: option => {
        return {
            action: "replace",
            value: option.value,
        };
    },
};

export function getCellChildAutoCompleter(): WPCompleter<Option> {
    return {
        ...baseCellChildAutoCompleter,
        options: [
            { icon: buttonBlockIcon, name: "Button", value: "button" },
            { icon: imageBlockIcon, name: "Image", value: "image" },
            { icon: StyledListIcon, name: "List", value: "list" },
            {
                icon: RibbonIcon,
                name: "Ribbon",
                value: "ribbon",
                disabled: true,
            },
            ...getExtendedElementDefinitions().map(definition => ({
                icon: definition.icon as JSX.Element,
                name: definition.autocompleteLabel || definition.title,
                value: definition.name as ElementTypes,
            })),
        ],
    };
}

```
