Skip to main content
TabIndicator
@coinbase/cds-web@8.13.6
A visual indicator that shows the active tab position.
Import
import { TabIndicator } from '@coinbase/cds-web/tabs/TabIndicator'
SourceView source codeStorybookView Storybook
Peer dependencies
  • framer-motion: ^10.18.0
Related components

Basic Example

Loading...
Live Code
function TabIndicatorExample() {
  const getRandomNumber = () => Math.random() * 100 + 100;
  const [width, setWidth] = useState(120);
  const [x, setX] = useState(120);

  const handlePress = () => {
    setWidth(getRandomNumber());
    setX(getRandomNumber());
  };

  return (
    <VStack padding={4} gap={2} background="bg">
      <Button onClick={handlePress} block>
        Randomize
      </Button>
      <TabIndicator width={width} x={x} />
    </VStack>
  );
}

Is this page useful?

Coinbase Design is an open-source, adaptable system of guidelines, components, and tools that aid the best practices of user interface design for crypto products.