Download CSV button
Outside the canonThe list toolbar's way to take the list away as a file (2026-10-28, Danielle's review comment: "add download CSV on the list pages near the filter"), in the Toolbar's actions slot — just left of Columns where a list has it (Transactions), beside Sort where it does not (Credit Memos, Payouts). It downloads what the list shows: every row the search and filters match, across every page, not only the one on screen; on a list with a Columns control, the columns showing, in their order. The Tooltip names the action and says what the file holds ("Download 69 transactions as CSV, with the columns showing"). The file: a header row of the columns' names, the badges' words as text, amounts as plain numbers with two decimals and their minus sign ("-200.00"), dates as yyyy-mm-dd, a UTF-8 byte-order mark for Excel, and no cell a spreadsheet would run as a formula; named after the list and the day (transactions-2026-02-10.csv). The trigger is the filter's and Columns' 32px outlined control with file-csv and no label (2026-11-04, Danielle's review comment: "download and columns can be an icon and if you hover a word pops up with the title, to keep space small"; it was labelled "Download" from xl until then): the icon says what kind of file, the accessible name is "Download CSV", and the Tooltip, which opens on "Download", is the word on hover. With nothing to download it stays, disabled, and the Tooltip says why (P8). No toast: the browser shows the download. Mock behaviour: the file is built in the browser (lib/csv.ts). Outside the canon vocabulary.
App: Ui::DownloadCsvButtonComponent (suggested): a link to the index with format: :csv and the list's current params, with the download attribute — no Stimulus. The controller writes the CSV (respond_to format.csv), reading the person's column preference where the list has one
Default
#defaultClick it to download a three-row file; hover or focus it for the Tooltip, which names the action and what the file holds. Icon-only at every width.
Nothing to download
#disabledA list whose search and filters match nothing: the button stays, disabled in grey, and the Tooltip says why (P8).
Props
| Name | Type | Default | Notes |
|---|---|---|---|
| filename | string | — | Required. Without .csv: the list and the day, "transactions-2026-02-10" |
| description | string | — | Required. The Tooltip: the action and what the file holds, "Download 69 transactions as CSV, with the columns showing" |
| rows | () => CsvCell[][] | — | Required. Builds the file when clicked, the header row first. Use the list's matching_rows (useMockList), not visible_rows, and csvMoney for amounts |
| disabled_reason | string | — | Nothing to download: disabled, with this in the Tooltip (P8) |
| className | string | — | On the button |
| lib/csv.ts | module | — | toCsv(rows), downloadCsv(filename, rows), csvMoney(cents) → "1282.50". Quotes a cell with a comma, quote or line break; prefixes ' to a text cell starting = + - @ (a negative number is left alone) |