from reactable import Reactable, Column, ColGroup, embed_css
from reactable.data import cars_93
embed_css()
Column resizing
You can make columns resizable by setting resizable=True
:
Reactable(5, :],
cars_93[:=True,
resizable=False,
wrap=True,
bordered )
Sticky columns
You can make columns sticky when scrolling horizontally using the sticky=
argument in Column
or ColGroup
. Set sticky to either "left"
or "right"
to make the column stick to the left or right side.
Reactable(5, :],
cars_93[:=[
columns
Column(id="manufacturer",
="left",
sticky={"border-right": "1px solid #eee"},
style={"border-right": "1px solid #eee"},
header_style
),
Column(id="make",
="right",
sticky={"border-left": "1px solid #eee"},
style={"border-left": "1px solid #eee"},
header_style
),
],=Column(min_width=150),
default_col_def )
Note that the border between two column headers can now be clicked and dragged to change the size of a column.
Multiple sticky columns
= {"background-color": "#f7f7f7"}
stick_style
Reactable(5, :],
cars_93[:=[
columnsid="manufacturer", sticky="left", style=stick_style, header_style=stick_style),
Column(id="make", sticky="left", style=stick_style, header_style=stick_style),
Column(id="type", sticky="left", style=stick_style, header_style=stick_style),
Column(
], )
Sticky column groups
If a column group is sticky, all columns in the group will automatically be made sticky.
Reactable(5, :],
cars_93[:=[
column_groups="Make", columns=["manufacturer", "model"], sticky="left"),
ColGroup(name="Price", columns=["min_price", "price", "max_price"], sticky="left"),
ColGroup(name
],=Column(footer="Footer"),
default_col_def=True,
resizable=False,
wrap=True,
bordered )