use-is-tabbing
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

useIsTabbing

Hide browser tab outline until it's needed.

Example using Styled Components

import React from 'react';
import { createGlobalStyle } from 'styled-components';
import { useIsTabbing } from 'use-is-tabbing';

const TabStyles = createGlobalStyle`
  a,
  button {
    &:focus {
      outline: 2px dashed var(--outline-color);
      outline-offset: 2px;
    }
  }
`;

const ActivateTabOutline = () => {
  const showTabOutline = useIsTabbing();

  return showTabOutline ? <TabStyles /> : null;
};

export default ActivateTabOutline;

Package Sidebar

Install

npm i use-is-tabbing

Weekly Downloads

11

Version

0.1.1

License

MIT

Unpacked Size

8.4 kB

Total Files

12

Last publish

Collaborators

  • jbsmith731