Logo
UI Elements

List View

A dynamic table component with CSV support

Heads up!

List View is currently in preview. Future updates may introduce major changes.

Overview

List View is a fully dynamic table component that supports flexible columns, dynamic row generation, icons, custom fonts, alternating row colors, borders, and full styling through the ListViewStyle system or Styler Presets.

Preview

It automatically rebuilds itself when data changes, uses column width calculations based on fixed or flexible sizing, and supports CSV import and export.

CSV Support

List View can:

  • Import CSV strings
  • Load CSV files
  • Automatically build columns from headers
  • Update existing rows or replace entirely
  • Export all data to CSV format

Properties

Content

NameTypeDescription
columnsList<ListViewColumn>Column definitions
rowsList<ListViewRow>Row data with values and icons

Style Settings

NameTypeDescription
styleListViewStyleControls fonts, colors, spacing, borders
stylingSourceListViewStyle.StylingSourceCustom or StylerPreset
styleMappingList<ListViewStyle.Mapping>Maps style fields to styler IDs
stylerPresetStylerPresetReference used when stylingSource is StylerPreset

References

NameTypeDescription
parentRectRectTransformIf assigned, ListView updates its height based on total content

Classes

ListViewColumn

FieldTypeDescription
columnNamestringHeader label
columnIconSpriteOptional icon
widthfloatWidth when not flexible
useFlexibleWidthboolDistribute remaining space
alignmentTextAnchorAlignment for icon and text

ListViewRow

FieldTypeDescription
valuesList<string>Text values per column
iconsList<Sprite>Icons per column
SetCell(index, value, icon)Assign value and icon
GetIcon(index)Returns column icon

ListViewStyle

Contains:

  • Fonts
  • Font sizes
  • Font styles
  • Colors
  • Backgrounds
  • Spacing and padding
  • Border settings
  • Mapping IDs for Preset styling
  • Deep copy utilities

Public Methods

Structure and Data

NameParametersDescription
AddColumn(column)ListViewColumnAdds a new column
RemoveColumn(index)intRemoves column and trims existing rows
AddRow(row)ListViewRowAdds a row
AddRow(values)params string[]Adds a row from string values
RemoveRow(index)intRemoves one row
ClearRows()NoneRemoves all rows

Cells

NameParametersDescription
SetCellValue(row, col, value)int, int, stringUpdates text
SetCellData(row, col, value, icon)int, int, string, SpriteUpdates text and icon
GetCellValue(row, col)int, intGets text

Styling

NameParametersDescription
UseAlternatingRowColor(value)boolEnables alternating background colors
Refresh()NoneUpdates layout and content

CSV

NameParametersDescription
ImportFromCSV(csv, hasHeaders, clearExisting)string, bool, boolImports data
ExportToCSV(includeHeaders)boolReturns CSV string
SaveToCSVFile(path, includeHeaders)string, boolSaves CSV file
LoadFromCSVFile(path, hasHeaders, clearExisting)string, bool, boolLoads CSV file

Code Example

ListViewExample.cs
using UnityEngine;
using Evo.UI;

public class ListViewExample : MonoBehaviour
{
    public ListView listView;

    void Start()
    {
        // Add columns
        listView.AddColumn(new ListViewColumn
        {
            columnName = "Name",
            useFlexibleWidth = true,
            alignment = TextAnchor.MiddleLeft
        });

        listView.AddColumn(new ListViewColumn
        {
            columnName = "Age",
            width = 80,
            useFlexibleWidth = false
        });

        // Add rows
        listView.AddRow("Alice", "23");
        listView.AddRow("Bob", "31");

        // Modify a cell
        listView.SetCellValue(1, 1, "32");

        // Import CSV
        string csv = "Name,Score\nPlayer A,120\nPlayer B,95";
        listView.ImportFromCSV(csv);

        // Export CSV
        string exported = listView.ExportToCSV();
        Debug.Log(exported);

        // Refresh manually if needed
        listView.Refresh();
    }
}

On this page