Skip to content

limbo-works/Limbo.Umbraco.Tables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Limbo Tables

GitHub license NuGet NuGet Umbraco Marketplace Limbo.Umbraco.Tables at packages.limbo.works

Table editor for Umbraco 13.

License: MIT License
Umbraco: Umbraco 13
Target Framework: .NET 8



Installation

Umbraco 13

Install for Umbraco 13 via NuGet. Either via the .NET CLI:

dotnet add package Limbo.Umbraco.Tables --version 13.0.2

or the NuGet Package Manager:

Install-Package Limbo.Umbraco.Tables -Version 13.0.2

Umbraco 10, 11 and 12
For the Umbraco 10-12 version of this package, see the v1/main branch instead.



Documentation

The package adds a Limbo Tables property that you can use either on a content type or on an element type (eg. in Umbraco's block list).

Properties using this property editor exposes an instance of Limbo.Umbraco.Tables.Models.TablesDataModel representing the tabular data. The property is nullable, so if the user hasn't yet entered any data, or all cells are empty, null will be returned instead.

The returned offers a number of different properties for accessing and rendering the data - eg. the Cells containing a two-dimensional array with the tabular data:

@using Limbo.Umbraco.Tables.Models
@{
    var value = block.Content.Value("data");
    if (value is TableModel data)
    {
        <table>
            @foreach (IReadOnlyList<TableCell> row in data.Cells)
            {
                <tr>
                    @foreach (TableCell cell in row) {
                        @if (cell.Type == TableCellType.Th)
                        {
                            <th>@Html.Raw(cell.Value)</th>
                        }
                        else
                        {
                            <td>@Html.Raw(cell.Value)</td>
                        }
                    }
                </tr>
            }
        </table>
    }
}



Property Editor

The property editor gives users the ability to create tabular data, with each cell value being a richtext editor on it's own.

The table can be configured to use either the first row or the first column as a header - or both.

image