Document form action buttons in the design system guide #4313
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #4313"
general
weight: 0.35
gariasf
@jjmata this writes down the answer to your question on #4184 (question, answer), like I offered there.
Problem
Nothing in the guide says whether a form's buttons go wide or get told apart by variant. Main mostly answers it by how many actions the form has, but the cost basis editor shows how easy that is to miss. Main's popover passes small-button classes to
f.submit, which ignoresclass:, so its Save comes out full width. #4184's first take on a Cancel + Save pair then usedsize: :sm, which makes 28px buttons on a phone. Your other question, how amounts sit inside an input, isn't written down either.Change
A
## Form actionssection indocs/llm-guides/design-system.md, right after## Tablesand in the same shape (rule, one snippet, bullets). A form with one action ends inf.submit, which is always a full-width primaryDS::Button. A form with Cancel and a primary action ends in a right-aligned pair of natural-width buttons at the default size, Cancel first, and the variant carries the hierarchy: Cancel is:secondaryor:ghost(aDS::Linkwith the same variant when it leaves the page).The bullets cover the two traps from #4184 (
f.submitignoresclass:, andsize: :smtext buttons are 28px with no coarse-pointer bump, which only icon-only buttons get) and point atDS::Dialog#with_actionfor dialogs whose buttons don't submit a form. A destructive action takesvariant: :destructivein the primary's place, as a full-widthDS::Buttonwhen it's the only action, sincef.submitis always primary (Codex caught that one). The last bullet answers your other question: amount inputs stay left-aligned likemoney_fieldrenders them, and right alignment with tabular digits is for displayed figures and for inputs inside a column of them, like the budget grid.Docs only, so no screenshots.
Follow-ups (not in this PR)
I went through every Cancel on main (at 9884e617b, so line numbers will drift). 22 Cancel + primary pairs follow the rule and 50 don't, most of them provider pages copied from each other. Grouped by how they break it:
1. Primary first and stretched (
class: "flex-1"), with Cancel after it. The provider generator seeds this (lib/generators/provider/family/templates/setup_accounts.html.erb.tt:85), so I'd fix the template first. Thensetup_accounts.html.erbfor akahu, binance, brex, coinbase, coinspot, enable_banking, fio, ibkr, indexa_capital, kraken, lunchflow, mercury, monobank, questrade, redbark, simplefin, snaptrade, sophtron, trade_republic, trading212 and up, plusindexa_capital_items/select_accounts,simplefin_items/editandwise_items/select_profiles.2. Right-aligned, but the primary comes first and Cancel last:
select_existing_account.html.erbfor binance, coinbase, coinspot, enable_banking, ibkr, kraken, simplefin, trade_republic and trading212.3. A hand-built Cancel (
link_towithbutton-bg-secondaryclasses) instead ofDS::Link, in an otherwise fine row:select_accountsandselect_existing_accountfor brex, lunchflow and mercury, plusplaid_items/select_existing_account.4.
f.submitinside a pair, so the primary fills the row:-
holdings/show.html.erb:69, the remap security form (its Cancel is a hand-built<button>too)-
onchain_wallet_items/_token_review_form.html.erb:55-
admin/sso_providers/_form.html.erb:297(hand-built Cancel, and theclass:onform.submitis ignored)-
family_exports/new.html.erb:31(plainform_with, so both buttons are hand-built and split the row in half)-
doorkeeper/applications/_form.html.erb:54(stock Doorkeeper markup with Bootstrapbtnclasses we don't define)5. A stacked full-width pair:
import/confirms/show.html.erb:33.6. An
:outlineCancel:splits/new.html.erb:93,splits/edit.html.erb:102,transactions/convert_to_trade.html.erb:173,settings/ai_prompts/show.html.erb:92and theDS::DialogLookbook preview. This is the one group I'm not sure about, since the preview itself does it. If you'd rather allow:outlinefor Cancel, it's a one-word change in the guide. WDYT?7. A right-aligned amount input outside a column of figures: the move amount in
budget_categories/_move_dialog.html.erb:45.I left out the cost basis editor (#4184 fixes it), the per-row
size: :smLink buttons in the provider pickers (row actions, not form actions), the OIDC sign-up and link pages (a full-width submit with a way back to sign-in, likepassword_resets/new), and empty states with Refresh + Cancel.Validation
StyledFormBuilder#submithard-codesfull_width: trueand only readsdata:from its options.DS::Buttonish::SIZESgives sm text buttonspy-1(28px) and mdpy-2(36px), and only the icon-only classes havepointer-coarse:. TheDS::Dialogactions slot isflex items-center gap-2 justify-end, andshared/_money_fieldsets no alignment. All the links in the section resolve.bin/rails test: 12,435 runs, 0 failures, 0 errors on both commits. RuboCop, erb_lint, Biome and Brakeman are clean. No app code changed, so system tests don't apply.<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
Summary by CodeRabbit
Documentation
Added guidance for form actions, covering single-action buttons, Cancel and primary button pairs, alignment, sizing, button variants, destructive actions, dialog actions, and amount inputs. Examples clarify how to structure actions and use button hierarchy to distinguish their importance.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->