import React from 'react' import { type Meta } from '@storybook/react-vite' import SearchBar from '../../components/SearchBar/SearchBar' import { useFocus } from '../useFocus/useFocus' import { DocsTemplate } from '../../../.storybook' export const Example = (): React.JSX.Element => { const ref = useFocus(true) return ( { return }} ref={ref} /> ) } Example.storyName = 'useFocus' Example.args = {} export default { title: 'Hooks/useFocus', component: Example, parameters: { viewMode: 'docs', previewTabs: { canvas: { hidden: true }, }, docs: { page: () => ( <> A hook used to get a ref for an element. This ref will be used to dynamically pass the focus to the intended element. } infoBullets={[ A good use case for this is when we have a form element that is hidden inside of a SideDrawer or a popover. In these cases, our generic autoFocus prop will not work. This hook will let us know when the element is visible and ready to be focused. , ]} noArgs /> ), }, }, } as Meta