From f34b5534056550897c838ffb967ed8b3eb6c1583 Mon Sep 17 00:00:00 2001 From: bashbunni <15822994+bashbunni@users.noreply.github.com> Date: Thu, 14 Nov 2024 10:37:40 -0800 Subject: [PATCH] docs: include warning about table offset (#408) --- README.md | 3 +++ table/table.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 09ea76c2..90c9c2cf 100644 --- a/README.md +++ b/README.md @@ -453,6 +453,9 @@ fmt.Println(t) ![Table Example](https://github.com/charmbracelet/lipgloss/assets/42545625/6e4b70c4-f494-45da-a467-bdd27df30d5d) +> [!WARNING] +> Table `Rows` need to be declared before `Offset` otherwise it does nothing. + For more on tables see [the docs](https://pkg.go.dev/github.com/charmbracelet/lipgloss?tab=doc) and [examples](https://github.com/charmbracelet/lipgloss/tree/master/examples/table). ## Rendering Lists diff --git a/table/table.go b/table/table.go index 2a970ffc..9531ce8a 100644 --- a/table/table.go +++ b/table/table.go @@ -209,6 +209,9 @@ func (t *Table) Height(h int) *Table { } // Offset sets the table rendering offset. +// +// Warning: you may declare Offset only after setting Rows. Otherwise it will be +// ignored. func (t *Table) Offset(o int) *Table { t.offset = o return t