Skip to content

Hiding header columns breaks the table #191

@zthreee

Description

@zthreee

Hey, not sure if I am doing something wrong, but I am trying to draw only the bottom border on the headers, without top/left/right ones.

I tried with:

func headerStyle() lipgloss.Style {
	return lipgloss.NewStyle().
		BorderStyle(lipgloss.HiddenBorder()).
		BorderForeground(lipgloss.Color("240")).
		Foreground(lipgloss.Color("#666666"))
}

That does nothing.

I am setting it up this way:

func initializeTable() table.Model {
	t := table.New(tableColumns()).
		HeaderStyle(headerStyle()).
		WithRows([]table.Row{
			table.NewRow(table.RowData{
				"date_key": parsers.FormatRelativeTime(time.Now()),
				"type_key": "buy",
				"usd_key":  "12.2",
				"token_key":  "100M",
				"sol_key":  "10.3",
			}),
		}).
		WithBaseStyle(styleBase).
		WithRowStyleFunc(rowStyleFunc)

	return t
}

When i set:

func headerStyle() lipgloss.Style {
	return lipgloss.NewStyle().
		BorderStyle(lipgloss.HiddenBorder()).
		BorderTop(false).
		BorderForeground(lipgloss.Color("240")).
		Foreground(lipgloss.Color("#666666"))
}

Table totally breaks:

Image

I tried to also setup the header style directly on each column, and when doing:

func headerStyle() lipgloss.Style {
	return lipgloss.NewStyle().
		BorderStyle(lipgloss.HiddenBorder()).
		BorderTop(false).
		BorderLeft(false).
		BorderRight(false).
		BorderForeground(lipgloss.Color("240")).
		Foreground(lipgloss.Color("#666666"))
}

Nothing changes fromt he example, when I disable only the TopBorder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions