@chakra-ui/react#useTab JavaScript Examples

The following examples show how to use @chakra-ui/react#useTab. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: components.js    From idena-web with MIT License 6 votes vote down vote up
GetInvitationTab = React.forwardRef(
  ({iconSelected, icon, title, ...props}, ref) => {
    const isMobile = useBreakpointValue([true, false])
    const tabProps = useTab({...props, ref})
    const isSelected = !!tabProps['aria-selected']
    return (
      <Tab
        color="gray.300"
        fontWeight="500"
        _selected={{
          color: 'blue.500',
          bg: ['gray.500', 'gray.50'],
          borderRadius: 'md',
        }}
        mr={[0, 2]}
        w={['25%', null]}
        {...tabProps}
        py={3 / 2}
      >
        {isMobile
          ? React.cloneElement(isSelected ? iconSelected : icon, {
              boxSize: 6,
              color: isSelected ? 'white' : 'gray.500',
            })
          : title}
      </Tab>
    )
  }
)
Example #2
Source File: components.js    From idena-web with MIT License 5 votes vote down vote up
NewAdFormTab = React.forwardRef((props, ref) => {
  const tabProps = useTab({...props, ref})
  const isSelected = Boolean(tabProps['aria-selected'])

  return <Button variant="tab" isActive={isSelected} {...tabProps} />
})