Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh tables #665

Merged
merged 15 commits into from
Jul 18, 2023
Merged

Refresh tables #665

merged 15 commits into from
Jul 18, 2023

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Jul 11, 2023

Sets a few default styles for tables and DataTables:

  • Table stripes, hover, and selected row styles
  • Adjust DT table container on overflow in small containers to scroll only the table, not the table and controls
  • Reduce table size inside bslib cards, but only when not full screen.

This PR is supported by

Screenshots

pkgload::load_all()
bs_theme_preview(bs_theme(5, "shiny"))

Edit: these screenshots capture the look-and-feel, but some details have changed slightly in the final version of the PR (e.g. striping is on even rows).

Full DT table styles

DT table in a card

When a DT table is used in a card that can expand to full screen, it would be useful to hide the table chrome (search, pagination, etc) and just show the table. The least jarring behavior would be to opt into this, so I've implemented it as a card class, e.g. card(class = "bslib-card-table-sm", ...).

Docs: We'll want to document this somewhere, but I'm not sure where that place would be. (We can also wait until the full theme is complete.)

image

DT table in a full-screen card

image

DT table in a small screen width

Notice header and footer are centered and the main table container (with overflow) scrolls horizontally.

image

@gadenbuie

This comment was marked as resolved.

@gadenbuie gadenbuie marked this pull request as ready for review July 12, 2023 20:43
@cpsievert
Copy link
Collaborator

cpsievert commented Jul 13, 2023

Let's create an issue about making this CSS class more discoverable. One idea we discussed was having something like card_body_table(), which could be used like this:

card(
  card_body_table(DT::datatable())
)

Or maybe card(compact_tables = TRUE, DT::datatable())?

@gadenbuie gadenbuie merged commit 1e60415 into main Jul 18, 2023
12 checks passed
@gadenbuie gadenbuie deleted the refresh/tables branch July 18, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants