tuil
ReferenceComponentsVirtual list

VirtualListProps

VirtualListProps component contract.

View rawEdit

Type

export interface VirtualListProps<TItem>
  extends CommonComponentProps,
    SlottedComponentProps<
      VirtualListSlots,
      {
        readonly focused: boolean;
        readonly activeIndex: number;
        readonly offset: number;
      }
    > {
  readonly items: readonly TItem[];
  readonly renderItem: (
    item: TItem,
    context: VirtualListRenderContext,
  ) => ReactNode;
  readonly getItemKey: (item: TItem, index: number) => string;
  readonly getItemLabel?: (item: TItem, index: number) => string;
  readonly height?: number;
  readonly overscan?: number;
  readonly offset?: number;
  readonly defaultOffset?: number;
  readonly onOffsetChange?: (offset: number) => void | Promise<void>;
  readonly activeIndex?: number;
  readonly defaultActiveIndex?: number;
  readonly onActiveIndexChange?: (index: number) => void | Promise<void>;
  readonly onSelect?: (item: TItem, index: number) => void | Promise<void>;
  readonly emptyMessage?: string;
  readonly staticLimit?: number;
  readonly autoFocus?: boolean;
}

Members

MemberTypeRequiredDescriptionRelated types
itemsreadonly TItem[]YesThe items member uses the readonly TItem[] contract.
renderItem(item: TItem, context: VirtualListRenderContext) => ReactNodeYesThe renderItem member uses the (item: TItem, context: VirtualListRenderContext) => ReactNode contract.
getItemKey(item: TItem, index: number) => stringYesThe getItemKey member uses the (item: TItem, index: number) => string contract.
getItemLabel((item: TItem, index: number) => string) | undefinedNoThe getItemLabel member uses the ((item: TItem, index: number) => string) | undefined contract.
heightnumber | undefinedNoThe height member uses the number | undefined contract.
overscannumber | undefinedNoThe overscan member uses the number | undefined contract.
offsetnumber | undefinedNoThe offset member uses the number | undefined contract.
defaultOffsetnumber | undefinedNoThe defaultOffset member uses the number | undefined contract.
onOffsetChange((offset: number) => void | Promise<void>) | undefinedNoThe onOffsetChange member uses the ((offset: number) => void | Promise<void>) | undefined contract.
activeIndexnumber | undefinedNoThe activeIndex member uses the number | undefined contract.
defaultActiveIndexnumber | undefinedNoThe defaultActiveIndex member uses the number | undefined contract.
onActiveIndexChange((index: number) => void | Promise<void>) | undefinedNoThe onActiveIndexChange member uses the ((index: number) => void | Promise<void>) | undefined contract.
onSelect((item: TItem, index: number) => void | Promise<void>) | undefinedNoThe onSelect member uses the ((item: TItem, index: number) => void | Promise<void>) | undefined contract.
emptyMessagestring | undefinedNoThe emptyMessage member uses the string | undefined contract.
staticLimitnumber | undefinedNoThe staticLimit member uses the number | undefined contract.
autoFocusboolean | undefinedNoThe autoFocus member uses the boolean | undefined contract.
variantstring | undefinedNoThe variant member uses the string | undefined contract.
size"sm" | "md" | "lg" | undefinedNoThe size member uses the "sm" | "md" | "lg" | undefined contract.
unstyledboolean | undefinedNoThe unstyled member uses the boolean | undefined contract.
classNamestring | undefinedNoThe className member uses the string | undefined contract.
layoutPartial<Omit<LayoutNodeInput, "children" | "id" | "semantics">> | undefinedNoThe layout member uses the Partial<Omit<LayoutNodeInput, "children" | "id" | "semantics">> | undefined contract.
idstring | undefinedNoThe id member uses the string | undefined contract.
testIdstring | undefinedNoThe testId member uses the string | undefined contract.
roleSemanticRole | undefinedNoThe role member uses the SemanticRole | undefined contract.SemanticRole
labelstring | undefinedNoThe label member uses the string | undefined contract.
descriptionstring | undefinedNoThe description member uses the string | undefined contract.
disabledboolean | undefinedNoThe disabled member uses the boolean | undefined contract.
readOnlyboolean | undefinedNoThe readOnly member uses the boolean | undefined contract.
selectedboolean | undefinedNoThe selected member uses the boolean | undefined contract.
checkedboolean | undefinedNoThe checked member uses the boolean | undefined contract.
expandedboolean | undefinedNoThe expanded member uses the boolean | undefined contract.
valueTextstring | undefinedNoThe valueText member uses the string | undefined contract.
slotsPartial<SlotComponents<&#123; root: import("ink").BoxProps; viewport: import("ink").BoxProps; item: import("ink").TextProps; overflow: import("ink").TextProps; empty: import("ink").TextProps; &#125;>> | undefinedNoThe slots member uses the Partial<SlotComponents<&#123; root: import("ink").BoxProps; viewport: import("ink").BoxProps; item: import("ink").TextProps; overflow: import("ink").TextProps; empty: import("ink").TextProps; &#125;>> | undefined contract.BoxProps, SlotComponents, TextProps
slotPropsPartial<SlotProps<&#123; root: import("ink").BoxProps; viewport: import("ink").BoxProps; item: import("ink").TextProps; overflow: import("ink").TextProps; empty: import("ink").TextProps; &#125;, &#123; readonly focused: boolean; readonly activeIndex: number; readonly offset: number; &#125;>> | undefinedNoThe slotProps member uses the Partial<SlotProps<&#123; root: import("ink").BoxProps; viewport: import("ink").BoxProps; item: import("ink").TextProps; overflow: import("ink").TextProps; empty: import("ink").TextProps; &#125;, &#123; readonly focused: boolean; readonly activeIndex: number; readonly offset: number; &#125;>> | undefined contract.BoxProps, SlotProps, TextProps

Source

View the secondary source reference

On this page