Skip to content

Commit

Permalink
docs(table): add StyleFunc GoDoc example
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Sep 19, 2023
1 parent ef590a4 commit 31f0340
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions table/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ import (
//
// It takes the row and column of the cell as an input and determines the
// lipgloss Style to use for that cell position.
//
// Example:
//
// t := table.New().
// Headers("Name", "Age").
// Row("Kini", 4).
// Row("Eli", 1).
// Row("Iris", 102).
// StyleFunc(func(row, col int) lipgloss.Style {
// switch {
// case row == 0:
// return HeaderStyle
// case row%2 == 0:
// return EvenRowStyle
// default:
// return OddRowStyle
// }
// })
type StyleFunc func(row, col int) lipgloss.Style

// NoTableStyle is a TableStyleFunc that returns a new Style with no attributes.
Expand Down

0 comments on commit 31f0340

Please sign in to comment.