react-checkbox-tree-enhanced
Version:
A simple, elegant, and enhanced checkbox tree for React.
25 lines (20 loc) • 561 B
JavaScript
import PropTypes from 'prop-types';
const nodeShape = {
label: PropTypes.node.isRequired,
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
]).isRequired,
disabled: PropTypes.bool,
icon: PropTypes.node,
showCheckbox: PropTypes.bool,
title: PropTypes.string,
};
const nodeShapeWithChildren = PropTypes.oneOfType([
PropTypes.shape(nodeShape),
PropTypes.shape({
...nodeShape,
children: PropTypes.arrayOf(nodeShape).isRequired,
}),
]);
export default nodeShapeWithChildren;