diff --git a/data/structures/table.yml b/data/structures/table.yml index 9c15109c..ae1950de 100644 --- a/data/structures/table.yml +++ b/data/structures/table.yml @@ -29,6 +29,12 @@ arguments: release: v0.24.13 filter: filter-col: + justify: + comment: >- + Horizontal alignment of the filter controls. Requires `filter`, which is + the only element this argument positions — the table itself always spans + the full width of its container. + release: v3.18.0 wrap: wrapper: release: v2.0.0 diff --git a/exampleSite/content/en/table-demo.md b/exampleSite/content/en/table-demo.md index d654c579..61ba2625 100644 --- a/exampleSite/content/en/table-demo.md +++ b/exampleSite/content/en/table-demo.md @@ -49,6 +49,18 @@ modules: ["simple-datatables"] | delta | gadget | The fourth record, whose description runs on for a little while. | {{< /table >}} +## Centered filter controls + +{{< table filter="widget, gadget" filter-col="1" justify="center" class="fixture-filter-center" >}} + +| Name | Type | Description | +|---------|--------|--------------------------------------------------------------------| +| alpha | widget | The first record, with a description long enough to need wrapping. | +| bravo | gadget | The second record, also with a fairly long trailing description. | +| charlie | widget | The third record. Short. | +| delta | gadget | The fourth record, whose description runs on for a little while. | +{{< /table >}} + ## Filtered, sortable, wrapped data table {{< table filter="widget,gadget" filter-col="1" sortable="true" paginate="true" pagination="2" wrap="true" class="fixture-filter-wrap" >}} diff --git a/layouts/_partials/assets/table.html b/layouts/_partials/assets/table.html index fde38b46..605df5ee 100644 --- a/layouts/_partials/assets/table.html +++ b/layouts/_partials/assets/table.html @@ -126,8 +126,11 @@ {{ $wrapper := $args.wrapper | default "" }} + {{/* The controls sit in their own flex row, so they align independently of the table below — + which always spans the full width of its container. `justify` carries a default of + `start` in mod-utils, preserving the original alignment for every existing caller. */}} {{ if $filter }} -