dominikmayer/elm-virtual-list/2.1.0

VirtualList.Config

Configure a virtual list with settings for size estimation, buffering, and visibility during measurement.

type Config

Defines the configuration for a virtual list, including estimated item heights, buffer size, and visibility settings during measurement.

Start with default and customize it using setter functions:

VirtualList.Config.default
    |> VirtualList.Config.setInitialHeight 650
    |> VirtualList.Config.setBuffer 10

Returns a default configuration with reasonable initial values.

Setters

You can combine the following setters with the pipe operator:

VirtualList.Config.default
    |> VirtualList.Config.setInitialHeight 650
    |> VirtualList.Config.setBuffer 10
setListId : String -> Config -> Config

Sets the ID of the list container in the DOM.

Uses the default ID if an empty string is provided: "virtual-list"

Defines the estimated list height before measurement.

Uses the default if negative: 500

Sets the estimated item height before measurement.

Uses the default if negative: Default: 26

Controls whether the list remains visible during measurement.

If True, it may cause spacing issues.

Default: False

setBuffer : Int -> Config -> Config

Defines how many extra items are rendered outside the visible range for smoother scrolling.

Default: 5

Enables dynamic buffer sizing based on scroll speed.

Default: True

Getters

You will probably have no need to access these values directly.

getListId : Config -> String

Returns the list container’s ID.

Returns the list’s estimated height before measurement.

Returns the estimated item height before measurement.

Returns whether the list remains visible during measurement, which may affect layout.

getBuffer : Config -> Int

Returns the number of extra items rendered outside the visible area.

Returns whether buffer sizing is dynamic based on scroll speed.