Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/uitable.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **UIElement Table** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/uitable.git
```

[![pkglnk](https://www.pkglnk.dev/badge/uitable.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/uitable)

Dependencies (1)

README

UIElement Table

Overview

UIElement Table is a Unity package that provides a way to draw tables with UIElements.

Installation

Add UIElement Table to your Unity project via Package Manager:

  1. Open Window > Package Manager
  2. Click + > Add package from git URL
  3. Enter:
https://www.pkglnk.dev/uitable.git

pkglnk

Support

If you like my work then please consider showing your support by buying me a brew

Buy Me A Coffee

Usage

// Create a table
_table = new DataBindingUITable<Person>();
rootVisualElement.Add(_table);

// Style the table
var styleSheet = Resources.Load<StyleSheet>("CustomTable");
_table.SetCustomStyleSheet(styleSheet);

// Show row numbers (optional)
_table.ShowRowNumbers(new ColumnDefinition("#", 50f));

// Define columns using AddColumn with a cell creation func
_table.AddColumn(
    new ColumnDefinition("Name", 150f),
    person => new Label(person.Name)
);
_table.AddColumn(
    new ColumnDefinition("Age", 75f),
    person => new Label(person.Age.ToString())
);
_table.AddColumn(
    new ColumnDefinition("Country"),
    person => new Label(person.Country)
);

// Listen for cell clicks
_table.RegisterCallback<TableCellClickEvent>(evt =>
{
    var cell = _table.GetCell(evt.ColumnIndex, evt.RowIndex);
    var label = cell.Q<Label>();
    Debug.Log($"Clicked on cell: Column={evt.ColumnIndex}, Row={evt.RowIndex}, Value={label.text}");
});

// Populate the table with data
var people = new List<Person>
{
    new Person("Alice", 30, "USA"),
    new Person("Bob", 25, "Canada"),
    new Person("Charlie", 35, "UK")
};
_table.SetData(people);

public class Person
{
	public string Name;
	public int Age;
	public string Country;

	public Person(string name, int age, string country)
	{
		Name = name;
		Age = age;
		Country = country;
	}
}

Unity_eSa6UxeX1c

Comments

No comments yet. Be the first!