File size: 1,921 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# ResponsiveToolBarGroup

This component is used to render a toggle group that collapses items that overflow the component width into more dropdown. On mobile viewports this menu no longer collapses and extends off the screen for swiping into view.

## How to use

```jsx
import Discover from 'calypso/my-sites/plugins/categories/responsive-toolbar-group';

<ResponsiveToolbarGroup onClick={ onClick } initial>
	<span> Item #1 </span>
	<span> Item #2 </span>
	<span> Item #3 </span>
	<span> Item #4 </span>
</ResponsiveToolbarGroup>;
```

## Props

- `children`[ReactNode]: A group of react components to be rendered.
- `className`[string]: A classname to add to the ToolBarGroupComponent. (optional).
- `hideRatio`[number]: The ratio in which the components are considered to be hidden, for example the default ratio of 0.99 will hide the element when 99% of it is visible (1% of it isn't visible). We rely on ([IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#thresholds)) (optional).
- `showRatio`[number]: The ratio in which the components are considered to be shown, for example the default ratio of 1 will show the element when 100% of it will be visible. We rely on ([IntersectionObserver](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#thresholds)) (optional).
- `rootMargin`[string]: take a look at ([take a look at the IntersectionObserver docs](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/rootMargin)) (optional).
- `onClick`[( index: number) => void]: A callback function that receives the index of the children being clicked. (optional).
- `initialActiveIndex`[number]: The initial active index of the component. (optional).
- `swipeBreakpoint`[string]: The breakpoint used to switch to a mobile friendly version of the toolbar optimized for swiping with no menu collapse. (optional, defaults to "<660px")