react-checkbox-tree
Version:
A simple and elegant checkbox tree for React.
21 lines (14 loc) • 479 B
JSX
import PropTypes from 'prop-types';
import React, { useEffect, useRef } from 'react';
const propTypes = {
indeterminate: PropTypes.bool,
};
function NativeCheckbox({ indeterminate = false, ...otherProps }) {
const checkbox = useRef(null);
useEffect(() => {
checkbox.current.indeterminate = indeterminate;
});
return <input {...otherProps} ref={checkbox} type="checkbox" />;
}
NativeCheckbox.propTypes = propTypes;
export default NativeCheckbox;