Add tabIndex prop in checkbox
authorAjay Bura <ajbura@gmail.com>
Sun, 20 Feb 2022 14:44:28 +0000 (20:14 +0530)
committerAjay Bura <ajbura@gmail.com>
Sun, 20 Feb 2022 14:44:28 +0000 (20:14 +0530)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
src/app/atoms/button/Checkbox.jsx

index 5079a40122998d5c83ec71fb51aca45074f1f1c2..7fcea3b55f2d4666a5abe9affc530e5ce464ed34 100644 (file)
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
 import './Checkbox.scss';
 
 function Checkbox({
-  variant, isActive, onToggle, disabled,
+  variant, isActive, onToggle,
+  disabled, tabIndex,
 }) {
   const className = `checkbox checkbox-${variant}${isActive ? ' checkbox--active' : ''}`;
   if (onToggle === null) return <span className={className} />;
@@ -14,6 +15,7 @@ function Checkbox({
       className={className}
       type="button"
       disabled={disabled}
+      tabIndex={tabIndex}
     />
   );
 }
@@ -23,6 +25,7 @@ Checkbox.defaultProps = {
   isActive: false,
   onToggle: null,
   disabled: false,
+  tabIndex: 0,
 };
 
 Checkbox.propTypes = {
@@ -30,6 +33,7 @@ Checkbox.propTypes = {
   isActive: PropTypes.bool,
   onToggle: PropTypes.func,
   disabled: PropTypes.bool,
+  tabIndex: PropTypes.number,
 };
 
 export default Checkbox;