Add tabIndex prop in checkbox
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
@@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
|||||||
import './Checkbox.scss';
|
import './Checkbox.scss';
|
||||||
|
|
||||||
function Checkbox({
|
function Checkbox({
|
||||||
variant, isActive, onToggle, disabled,
|
variant, isActive, onToggle,
|
||||||
|
disabled, tabIndex,
|
||||||
}) {
|
}) {
|
||||||
const className = `checkbox checkbox-${variant}${isActive ? ' checkbox--active' : ''}`;
|
const className = `checkbox checkbox-${variant}${isActive ? ' checkbox--active' : ''}`;
|
||||||
if (onToggle === null) return <span className={className} />;
|
if (onToggle === null) return <span className={className} />;
|
||||||
@@ -14,6 +15,7 @@ function Checkbox({
|
|||||||
className={className}
|
className={className}
|
||||||
type="button"
|
type="button"
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
tabIndex={tabIndex}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -23,6 +25,7 @@ Checkbox.defaultProps = {
|
|||||||
isActive: false,
|
isActive: false,
|
||||||
onToggle: null,
|
onToggle: null,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
tabIndex: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
Checkbox.propTypes = {
|
Checkbox.propTypes = {
|
||||||
@@ -30,6 +33,7 @@ Checkbox.propTypes = {
|
|||||||
isActive: PropTypes.bool,
|
isActive: PropTypes.bool,
|
||||||
onToggle: PropTypes.func,
|
onToggle: PropTypes.func,
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
|
tabIndex: PropTypes.number,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Checkbox;
|
export default Checkbox;
|
||||||
|
|||||||
Reference in New Issue
Block a user