Skip to content

Allow a single row or header to span multiple columns in tables #24

Closed

Description

@AdmiringWorm

In some cases, it would be useful to have the ability to have a single header or row span multiple columns in a table.

For instance, if the header of the table is used as a title instead of the value name of each column, or if a row has the same value for multiple columns next to each other or even if the row is more used as a separator.


Please upvote 👍 this issue if you are interested in it.

Activity

  1. patriksvensson commented on Aug 6, 2020

    @patriksvensson
    Contributor

    @AdmiringWorm Great idea!

    I'm trying to keep functionality simple for now until things stabilized a bit (still some basic features that's missing), so we should probably wait with this for a little while.

  2. patriksvensson commented on Aug 6, 2020

    @patriksvensson
    Contributor

    @AdmiringWorm As a workaround for now (for table titles), you could configure the Table to not show the column headers, and then draw the title above the table.

    var table = new Table(showHeaders: false);
    
  3. AdmiringWorm commented on Aug 6, 2020

    @AdmiringWorm
    ContributorAuthor

    Thanks, I gave that a shot as well. Not as clean, but workable IMO.
    Used a panel for the header though (with fit set to true), also had to wrap the table inside a panel with fit set to true, and no border. (Everything was set to Justify.Center as well, as I felt that looked the best)
    Otherwise, everything unfortunately looked out of place.

    I'm trying to keep functionality simple for now until things stabilized a bit (still some basic features that's missing), so we should probably wait with this for a little while.

    I completely understand.

  4. patriksvensson commented on Aug 6, 2020

    @patriksvensson
    Contributor

    @AdmiringWorm Thanks for understanding.

    I'm currently fixing the calculation of table widths and similar so keeping the code simple until everything is working as expected keeps things easier to reason about. Will definitely make panels and tables more flexible in 0.7.0 (which will enable you to remove the hack).

  5. AdmiringWorm commented on Aug 6, 2020

    @AdmiringWorm
    ContributorAuthor

    Sounds awesome.

    TBH, I kinda like the look the workaround created (the only thing remaining of the look is the center the cells, but that is a different story).

    image

    I am testing Spectre.Console on an old program I wrote to help calculate best overclocking in a game I used to play (just in case you were wondering about the output) 😄

  6. patriksvensson commented on Aug 6, 2020

    @patriksvensson
    Contributor

    That looks really good! Wow! Nice work!
    Will add an option to add a table header for you in version 0.7! 😄

  7. dvygolov commented on Jul 26, 2021

    @dvygolov

    It is sad that this great library doesn't have the ability to span several columns :(
    For example: I'd like to add one table into the other one. I can do it, but the child table is rendered in the first column of the row. Because of that it looks unreadable and doesn't make sense...

  8. phil-scott-78 commented on Jul 27, 2021

    @phil-scott-78
    Contributor

    I've added the help-wanted tag to this. It's be a nice feature to have but not one that I have a need for either so I doubt I'd be able to spend time on myself. Hopefully someone in the community with the need can jump in.

    With the testing being very complete around the tables it would be a nice item for someone who hasn't worked in the project before to get their feet wet.

    I'd be happy to help with the initial design of the API and code review too.

  9. FrankRay78 commented on Dec 18, 2022

    @FrankRay78
    Contributor

    It is sad that this great library doesn't have the ability to span several columns :( For example: I'd like to add one table into the other one. I can do it, but the child table is rendered in the first column of the row. Because of that it looks unreadable and doesn't make sense...

    Hi @dvygolov - Are you able to share in a Gist (or otherwise), an example program.cs that exactly reproduces this issue for you? It would be a really helpful starting point for someone looking to pick up this issue.

  10. thomastv commented on Feb 21, 2026

    @thomastv
    Contributor

    Hi everyone — I’d love to take this on and work on a fix. If nobody else is actively working on it, I can start investigating this.

    Approach: Add colSpan support for body-row cells and update the row layout logic to account for spanned cells (skipping the covered columns so subsequent cells render in the correct positions).

    Example (order list)

    In an order table with columns Item | Qty | Unit Price | Total, we can show the item name normally, but have a note take the space of the pricing columns:

    | Item     | Qty  | Unit Price  | Total
    | Item A   | 5    | 20          | 100
    | Item B   | Note: deliver after 5pm (spans Qty + Unit Price + Total) |
    
  11. patriksvensson commented on Feb 21, 2026

    @patriksvensson
    Contributor

    @thomastv Sure! Go ahead 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions