monday-ui-react-core
Version:
Official monday.com UI resources for application development in React.js
80 lines (60 loc) • 2.19 kB
text/mdx
import { Canvas, Meta } from "@storybook/blocks";
import * as UseGridKeyboardNavigationContextStories from "./useGridKeyboardNavigationContext.stories";
<Meta of={UseGridKeyboardNavigationContextStories} />
- [Overview](
- [Usage](
- [Arguments](
- [Returns](
- [Feedback](
A hook used to specify a connection between multiple navigable components, which are navigable between each other.
<Canvas of={UseGridKeyboardNavigationContextStories.Overview} />
<UsageGuidelines
guidelines={[
"Use this hook when you want to add keyboard navigation between multiple grid-like components.",
"Each of the components should use `useGridKeyboardNavigation`.",
"The components should be wrapped with a single `GridKeyboardNavigationContext`."
]}
/>
<FunctionArguments>
<FunctionArgument
name="positions"
type="Array[ { topElement: React.MutableRefObject, bottomElement: React.MutableRefObject } | { leftElement: React.MutableRefObject, rightElement: React.MutableRefObject } ]"
description="An array of relations between pairs of elements"
required
/>
<FunctionArgument
name="wrapperRef"
type="React.MutableRefObject"
description={
<>
A React ref for an element which contains all the elements which are listed on the <code>positions</code>{" "}
argument.
</>
}
required
/>
</FunctionArguments>
<FunctionArguments>
<FunctionArgument
name="result"
type="Object"
description={
<>
A <code>GridKeyboardNavigationContext</code> which should be provided to wrap all the elements from{" "}
<code>positions</code>
</>
}
/>
</FunctionArguments>
Disabled components can be skipped by adding a `disabled` (or `data-disabled`) to the referenced element.
<Canvas of={UseGridKeyboardNavigationContextStories.DisabledElements} />
The hook can be used inside multiple depths, in more complex layout requirements.
<Canvas of={UseGridKeyboardNavigationContextStories.MultipleDepths} />