Custom style for each listitems element
BastienLairis opened this issue · comments
BastienLairis commented
Hi @minop1205 and thx for your awesome work !
I need to have custom style for each listitems element, currently classes key is actually waiting for an object I need it to waiting for some sort of function to have access to my node props.
I tried several ways but without success
function App() {
return (
<DndProvider backend={MultiBackend} options={getBackendOptions()}>
<Tree
tree={treeData}
rootId={0}
render={(node) => <div>{node.text}</div>}
dragPreviewRender={(monitorProps) => (
<div>{monitorProps.item.text}</div>
)}
// Actual behavior
classes={{
listItem: "bg-red",
}}
// what i would like to have
classes={(node) => {
return {
listItem: `${node.text ? "bg-red" : "bg-blue"}`,
};
}}
/>
</DndProvider>
);
}
export default App;