Skip to main content

card-window

Type aliases

CardProps

Ƭ CardProps<T>: Object

CardWindow provides the CardWindow.children component with this props.

Type parameters

NameType
Textends any[] = any[]

Type declaration

NameTypeDescription
colnumbercol is the rendered column.
dataTdata is an array. CardWindow passes data to the CardWindow.children component.
indexnumberindex is the index of the data allocated to the CardWindow.children component.
rownumberrow is the rendered row.
styleCSSPropertiesstyle should be passed to the root of the CardWindow.children component.

Defined in

CardWindow.tsx:15


CardWindowProps

Ƭ CardWindowProps<T>: Object

This props is for CardWindow. Missing description of function-type is bug.

Description of getKey

If you can use an id instead of array index for key, define a getKey function.

Type parameters

NameType
Textends any[] = any[]

Type declaration

NameTypeDescription
cardRectRectcardRect is used to calculate the rendering of CardWindow.children component.
childrenReact.ComponentType<CardProps<T>>children is a component that receives CardProps<T>.
container?{ className?: string ; style?: Omit<CSSProperties, "width" | "height"> }-
container.className?stringcontainer.className are passed to the scrollable large container element.
container.style?Omit<CSSProperties, "width" | "height">container.style are passed to the scrollable large container element.
dataTdata is an array. CardWindow passes data to CardWindow.children component.
justifyContent?JustifyContentJustifyContent only supports 7 values. If the value is stretch, the CardProps.style has { flexBasis: 'auto' }.
lastRowAlign?LastRowAlignLastRowAlign that defines how to align when the number of cards in the last row is less than the number of columns.
loading?Loadingloading? is a property for the infinite loading feature.
maxCols?numberMaximum number of columns can be set.
overScanPx?numberThe number of px to render outside of the visible area. By default, CardWindow overscans 200px.
root?{ className?: string ; style?: Omit<CSSProperties, "overflow"> }-
root.className?stringroot.className are passed to the root element of CardWindow.
root.style?Omit<CSSProperties, "overflow">root.style are passed to the root element of CardWindow.
spacing?Partial<Spacing>These values are px. The defaults are 8px.
thresholdOfVisible?numberthresholdOfVisible is used for card visibility in onScroll event. Please set a value between 0 and 1. The default is 0.5.
getKey?(index: number, data: T) => stringIf you can use an id instead of array index for key, define a getKey function.
onScroll?(props: OnScrollProps) => voidCalled when the CardWindow scroll positions changes.

Defined in

CardWindow.tsx:128


JustifyContent

Ƭ JustifyContent: "left" | "right" | "center" | "space-around" | "space-between" | "space-evenly" | "stretch"

JustifyContent only supports 7 values. If the value is stretch, the CardProps.style has { flexBasis: 'auto' }.

Defined in

CardWindow.tsx:38


LastRowAlign

Ƭ LastRowAlign: "left" | "right" | "inherit"

LastRowAlign that defines how to align when the number of cards in the last row is less than the number of columns.

Defined in

CardWindow.tsx:51


Loading

Ƭ Loading: LoadingCard | LoadingRow

There are two rendering types for the infinite loading feature.

Defined in

CardWindow.tsx:54


LoadingCard

Ƭ LoadingCard: Object

LoadingCard(type: 'card') displays the loading component after the last card. Missing description of function-type is bug.

Description of loadMore

loadMore is called when LoadingCard.Component is rendered.

Type declaration

NameTypeDescription
LoadingComponentReact.ComponentType<LoadingCardComponentProps>LoadingCard.Component is rendered after the last card.
count?numberLoadingCard.count is the number of loading cards to display.
type"card"-
loadMore?() => voidloadMore is called when LoadingCard.Component is rendered.

Defined in

CardWindow.tsx:74


LoadingCardComponentProps

Ƭ LoadingCardComponentProps: Object

CardWindow provides LoadingCard.Component with this props.

Type declaration

NameTypeDescription
colnumbercol is the rendered column.
rownumberrow is the rendered row.
styleCSSPropertiesstyle should be passed to the root of LoadingCard.Component.

Defined in

CardWindow.tsx:57


LoadingRow

Ƭ LoadingRow: Object

LoadingRow(type: 'row') displays the loading component in the center next to the last row. Missing description of function-type is bug.

Description of loadMore

loadMore is called when LoadingRow.Component is rendered.

Type declaration

NameTypeDescription
LoadingComponentReact.ComponentType<LoadingRowComponentProps>LoadingRow.Component is rendered in the center next to the last row.
heightnumberheight is the height of LoadingRow.Component.
type"row"-
loadMore?() => voidloadMore is called when LoadingRow.Component is rendered.

Defined in

CardWindow.tsx:98


LoadingRowComponentProps

Ƭ LoadingRowComponentProps: Object

CardWindow provides LoadingRow.Component with this props.

Type declaration

NameTypeDescription
styleCSSPropertiesstyle should be passed to the root of LoadingRow.Component.

Defined in

CardWindow.tsx:85


OnScrollProps

Ƭ OnScrollProps: Object

Type declaration

NameTypeDescription
directionScrollDirectiondirection is either "forward" or "backward".
indexesOfVisiblenumber[]
offsetnumberoffset is a number.
updateWasRequestedbooleanupdateWasRequested is a boolean.

Defined in

CardWindow.tsx:108


Rect

Ƭ Rect: Object

These values are px.

Type declaration

NameType
heightnumber
widthnumber

Defined in

CardWindow.tsx:29


ScrollDirection

Ƭ ScrollDirection: "forward" | "backward"

Defined in

CardWindow.tsx:107


Spacing

Ƭ Spacing: Partial<_Spacing>

Defined in

index.ts:20

Variables

CardWindow

Const CardWindow: React.FC<CardWindowProps>

Defined in

CardWindow.tsx:436

Functions

range

range(_start, _end?): number[]

Parameters

NameType
_startnumber
_end?number

Returns

number[]

Defined in

CardWindow.tsx:192


useResizeObserver

useResizeObserver<T>(): Partial<Rect> & { ref: RefObject<T> }

useResizeObserver is a custom Hook for monitoring the size of the element.

If you give the hook an initial value for the element size, the hook will return that element size if ref is null.

const initialSize = { width: 200, height: 100 };

export const Example: React.FC = () => {
const [{ width, height }, ref] = useResizeObserver<HTMLDivElement>();

if (ref.current === null) {
console.log(`width: ${width}`); // 200 from initialSize
console.log(`height: ${height}`); // 100 from initialSize
} else {
console.log(`width: ${width}`); // actual element width
console.log(`height: ${height}`); // actual element height
}

return (
<div ref={ref}>
...
</div>
)
}

Type parameters

NameType
Textends Element

Returns

Partial<Rect> & { ref: RefObject<T> }

Defined in

CardWindow.tsx:414