Skip to content

Add half checked icon to parent element with some checked children #466

Open
@merimem

Description

@merimem

Describe the bug
Hello, I'm utilizing the library to display a checkbox list with extensive data. However, I'm encountering an aesthetic challenge. I aim to display a half-checked icon in nodes that have some checked children. I am using the noCascade mode, as I don't want the children to be automatically checked when a parent is selected.

My inquiry is purely aesthetic. I don't need the parent being added to the list of checked items. But I need to have a half-checked icon into the parent node without adding the parent to the list of checked items.

This is my code:
<CheckboxTree checked={checkedValues} expanded={expandedValues} nodes={nodes} onCheck={onCheck} onExpand={onExpand} noCascade={true} icons={{ check: ( <CheckIcon className="h-4 w-4 rounded border border-blue-600 bg-blue-600 text-white focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600" /> ), uncheck: ( <i className="h-4 w-4 rounded border border-gray-300 bg-gray-100 align-middle focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600" /> ), halfCheck: ( <MinusIcon className="h-4 w-4 rounded border border-blue-600 bg-blue-600 text-white focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600" /> ), expandClose: ( <ChevronRightIcon className="rct-icon rct-icon-expand-close mt-1 h-4 w-4 text-gray-500" /> ), expandOpen: ( <ChevronDownIcon className="rct-icon rct-icon-expand-open mt-1 h-4 w-4 text-gray-900" /> ), expandAll: ( <PlusIcon className="h-4 w-4 rounded border border-blue-600 bg-blue-600 text-white focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600" /> ), collapseAll: ( <MinusIcon className="h-4 w-4 rounded border border-blue-600 bg-blue-600 text-white focus:ring-2 focus:ring-blue-500 dark:border-gray-600 dark:bg-gray-700 dark:ring-offset-gray-800 dark:focus:ring-blue-600" /> ), parentClose: <></>, parentOpen: <></>, leaf: <></> }} />

Expected behavior
The parent like you see in the screenshot is not half checked. So the user is lost because he doesn't know what did he check. Is there any error in my code or the feature doesn't exist yet?

Screenshots
image

Thank you for any guidance you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions