# TableView formatting🪄

**URL:** <https://community.viktor.ai/t/tableview-formatting/1347>\
**Category:** Community Inspiration\
**Created:** [23 October 2023 08:10 UTC](https://community.viktor.ai/t/tableview-formatting/1347 "2023-10-23T08:10:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mweehuizen](https://community.viktor.ai/user_avatar/community.viktor.ai/mweehuizen/32/17_2.png) [@mweehuizen](https://community.viktor.ai/u/mweehuizen)\
**Post date:** [23 October 2023 08:10 UTC](https://community.viktor.ai/t/tableview-formatting/1347/1 "2023-10-23T08:10:22Z")

</div>

I would like to use this topic to share some formatting ideas for the TableView.

I will start with freezing the header row of the table:

```python
s1 = df.style
header_style = {
    "selector": "th",
    "props": [
        ("text-align", "right"),
        ("background-color", "rgba(245, 245, 252)"),
        ("position", "sticky"),
        ("top", 0),
    ],
}
s1.set_table_styles([header_style])

table_result = TableResult(
    dataframe=df,
    style=s1
    )

```

This results in:  
 ![table_freeze_header](https://community.viktor.ai/uploads/default/original/1X/565aa1e499fb3405e3f69fa7b51ab396bec4d4e4.gif)

Please share your table view formatting ideas below.

---

<div class="post-metadata">

**Author:** ![rvandijk](https://community.viktor.ai/user_avatar/community.viktor.ai/rvandijk/32/866_2.png) [@rvandijk](https://community.viktor.ai/u/rvandijk)\
**Post date:** [23 October 2023 08:38 UTC](https://community.viktor.ai/t/tableview-formatting/1347/2 "2023-10-23T08:38:25Z")

</div>

Nice snippet!

To add to this: to format individual cells you can use the same snippet but with `"selector": "td"`.

Also I use the `set_properties` function a lot; it works like this:

`style = df.style.set_properties(**{"font-size": "14px", "text-align": "right"})`

Also I love the `.set_sticky` function:

`df.style.set_sticky(axis="index")`

---

<div class="post-metadata">

**Author:** ![matthijs](https://community.viktor.ai/user_avatar/community.viktor.ai/matthijs/32/34_2.png) [@matthijs](https://community.viktor.ai/u/matthijs)\
**Post date:** [24 May 2024 14:48 UTC](https://community.viktor.ai/t/tableview-formatting/1347/3 "2024-05-24T14:48:40Z")

</div>

there is now a feature request we are considering which is about creating a dedicated TableView: [Add TableView](https://community.viktor.ai/t/add-tableview/1848)
