import React, { forwardRef, HTMLAttributes, useContext } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import { CTabsContext } from './CTabsContext'
export interface CTabProps extends HTMLAttributes {
/**
* A string of all className you want applied to the base component.
*/
className?: string
/**
* Toggle the disabled state for the component.
*/
disabled?: boolean
/**
* Item key.
*/
itemKey: number | string
}
export const CTab = forwardRef(
({ children, className, itemKey, ...rest }, ref) => {
const { _activeItemKey, setActiveItemKey, id } = useContext(CTabsContext)
const isActive = () => itemKey === _activeItemKey
return (
)
}
)
CTab.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
disabled: PropTypes.bool,
itemKey: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
}
CTab.displayName = 'CTab'