uswds / uswds

The U.S. Web Design System helps the federal government build fast, accessible, mobile-friendly websites.
https://designsystem.digital.gov
Other
6.78k stars 926 forks source link

Table: Responsive classes to trigger when a table becomes stacked #4143

Open sawyerh opened 3 years ago

sawyerh commented 3 years ago

The stacked table currently only becomes stacked when the viewport is narrower than the mobile-lg breakpoint. A wide table may overflow a viewport when it is wider than this mobile-lg breakpoint though.

Describe the solution you'd like

I'd like more control over when a table becomes stacked, so that I can more finely tailor the experience based on the table content. For instance, if there were responsive prefixes that could enable the stacked behavior instead:

class="usa-table tablet:usa-table--stacked"

Describe alternatives you've considered

My current solution is to apply the scrollable table styles, in addition to the stacked table styles, however this isn't ideal since some users may not notice the table is horizontally scrollable, particularly on devices that hide scrollbars.

Example

Current behavior, using a scrollable and stacked table:

(This is fake data)

image

Proposed behavior, using a responsive prefix, like tablet:usa-table--stacked

image

mdurchholz commented 1 month ago

This would be a great feature to have. Either this or a SCSS variable to update the stacked breakpoint variable.

CC: @mejiaj