@@ -3,7 +3,27 @@ import type { Positioner } from "./use-positioner";
33/**
44 * This hook handles the render phases of the masonry layout and returns the grid as a React element.
55 *
6- * @param options Options for configuring the masonry layout renderer. See `UseMasonryOptions`.
6+ * @param options - Options for configuring the masonry layout renderer. See `UseMasonryOptions`.
7+ * @param options.positioner
8+ * @param options.resizeObserver
9+ * @param options.items
10+ * @param options.as
11+ * @param options.id
12+ * @param options.className
13+ * @param options.style
14+ * @param options.role
15+ * @param options.tabIndex
16+ * @param options.containerRef
17+ * @param options.itemAs
18+ * @param options.itemStyle
19+ * @param options.itemHeightEstimate
20+ * @param options.itemKey
21+ * @param options.overscanBy
22+ * @param options.scrollTop
23+ * @param options.isScrolling
24+ * @param options.height
25+ * @param options.render
26+ * @param options.onRender
727 */
828export declare function useMasonry < Item > ( {
929 positioner,
@@ -49,6 +69,7 @@ export interface UseMasonryOptions<Item> {
4969 } ;
5070 /**
5171 * This is the type of element the grid container will be rendered as.
72+ *
5273 * @default "div"`
5374 */
5475 as ?: keyof JSX . IntrinsicElements | React . ComponentType < any > ;
@@ -67,11 +88,13 @@ export interface UseMasonryOptions<Item> {
6788 style ?: React . CSSProperties ;
6889 /**
6990 * Optionally swap out the accessibility `role` prop of the container and its items.
91+ *
7092 * @default "grid"
7193 */
7294 role ?: "grid" | "list" ;
7395 /**
7496 * Change the `tabIndex` of the grid container.
97+ *
7598 * @default 0
7699 */
77100 tabIndex ?: number ;
@@ -83,6 +106,7 @@ export interface UseMasonryOptions<Item> {
83106 | React . MutableRefObject < HTMLElement | null > ;
84107 /**
85108 * This is the type of element the grid items will be rendered as.
109+ *
86110 * @default "div"
87111 */
88112 itemAs ?: keyof JSX . IntrinsicElements | React . ComponentType < any > ;
@@ -95,6 +119,7 @@ export interface UseMasonryOptions<Item> {
95119 * This value is used for estimating the initial height of the masonry grid. It is important for
96120 * the UX of the scrolling behavior and in determining how many `items` to render in a batch, so it's
97121 * wise to set this value with some level accuracy, though it doesn't need to be perfect.
122+ *
98123 * @default 300
99124 */
100125 itemHeightEstimate ?: number ;
@@ -103,6 +128,7 @@ export interface UseMasonryOptions<Item> {
103128 * if your collection of items is never modified. Setting this property ensures that the component in `render`
104129 * is reused each time the masonry grid is reflowed. A common pattern would be to return the item's database
105130 * ID here if there is one, e.g. `data => data.id`
131+ *
106132 * @default (data, index) => index`
107133 */
108134 itemKey ?: ( data : Item , index : number ) => string | number ;
@@ -116,6 +142,7 @@ export interface UseMasonryOptions<Item> {
116142 * too high of a vaimport { useForceUpdate } from './use-force-update';
117143 lue may create too much work for React to handle, so it's best that you tune this
118144 * value accordingly.
145+ *
119146 * @default 2
120147 */
121148 overscanBy ?: number ;
@@ -140,6 +167,7 @@ export interface UseMasonryOptions<Item> {
140167 * `will-change: contents;` value to the style string. You can forgo using this prop, but I would
141168 * not recommend that. The `useScroller()` hook and `<MasonryScroller>` components will help you if
142169 * you're rendering the grid relative to the browser `window`.
170+ *
143171 * @default false
144172 */
145173 isScrolling ?: boolean ;
0 commit comments