GPUI.UI.Collection.Selection (gpui_components v0.2.0)

Copy Markdown View Source

Controlled collection identity and optional logical index.

Use an index when the selected or revealed item may be outside the currently loaded source slice. assigns/2 converts the value to component options for either controlled selection or reveal behavior.

Summary

Functions

Returns :selected assigns for the controlled identity.

Builds a controlled collection identity with an optional logical index.

Types

t()

@type t() :: %GPUI.UI.Collection.Selection{
  id: String.t() | nil,
  index: non_neg_integer() | nil
}

Functions

assigns(selection, atom)

@spec assigns(t(), :selected | :reveal) :: map()

Returns :selected assigns for the controlled identity.

new(id, index \\ nil)

@spec new(String.t() | nil, non_neg_integer() | nil) :: t()

Builds a controlled collection identity with an optional logical index.