Instruction file imported from lqdflying/chathub (
.cursor/rules/settings-provider-layout.mdc). Copyright stays with the author.
Settings provider detail layout
How Settings → provider (native OpenAI, native xAI, and OpenAI Compatible)
finally stayed inside the pane: two equal API-route pills, Check on the same
row as the model select (minmax(0, 1fr) auto), visible enable switch at
768–800px. Apply this stack. Do not revive the failed approaches. Native xAI
reuses the same shrink stack plus a Codex-style SuperGrok OAuth extra card
(min-width: 0, stacked Sign out, wrap meters).
What actually works (keep)
These layers are all required. Fixing only the form, or only the toggle, is not enough.
- Ancestor shrink. Desktop Settings is a flex child of the app shell.
Default
min-width: autois min-content, so a form or Codex card widens the whole pane past the viewport.DESKTOP_SETTINGS_LAYOUT_STYLEand the provider detail /SettingContainerchain must setmin-width: 0(andmax-width: 100%where the pane clips). - One-column form grid. LobeHub Form still paints
.ant-rowas horizontalspace-betweeneven when Antlayout="vertical". Do not put twowidth: 100%flex children in that row — they become ~2× the pane andoverflow-x: hiddenclips Responses / Check. Force the item row todisplay: grid; grid-template-columns: minmax(0, 1fr). - Owned route toggle.
ProviderRouteToggleis a two-column CSS grid with inline track/item widths. Do not use antdRadio.Group blockor@lobehub/uiSegmented block. Both start content-sized /inline-block, then CSS-in-JS injects flex ~1s after paint /setFieldsValue; the selected thumb becomes the full pane and the other label disappears. - Collapse title shrink. The enable switch lives in
.ant-collapse-extra. antd header-text isflex: autowithmin-width: auto, so the title keeps min-content andoverflow: hiddenon the header clips the switch at 768–800px. Shrink.ant-collapse-header-text(flex: 1 1 0,min-width: 0) and keep extraflex: none. InnerproviderConfigTitleRowStylealone is not enough. - Drop
FORM_STYLE.itemMinWidth.max(34%, 240px)shrink-wraps the control. KeepitemMinWidth={undefined}andlayout="vertical". - Connectivity Check one-row grid. Shared
CheckerActionRowisgrid-template-columns: minmax(4rem, 1fr) minmax(2rem, max-content)pluscontainer-type: inline-size. Bareminmax(0, 1fr) autolets a long Check translation (Проверить) collapse the select to 0px on the 112px row left at 768px desktop. The two floors still fit that row (4rem + 2rem + 8px). Below14remvisually hide the Check label (WCAG C7) and keep an icon or the loading spinner;aria-labelkeeps the full name. Bare1fris stillminmax(auto, 1fr)(CSS Grid §7.2.3). react-layout-kitFlexboxdefaults to a column and must not wrap Check as the only layout. Codex Sign out stays stacked — that card has a paragraph, not a shrinking select.
Map boolean enableResponseApi with getValueFromEvent /
getValueProps. Keyboard on the owned toggle follows the WAI-ARIA radio
pattern (roving tabindex, arrows move and check).
Do not
- Diagnose “Compatible works, native does not” as different CSS. They share
ProviderConfig. Compatible only looked stacked when long labels wrapped. - Beat LobeHub horizontal rows with stronger
flex/width: 100%only. - Bring back
Radio.Group blockorSegmented blockfor the API route. - Set
min-width: 0only on an inner title Flexbox and ignore.ant-collapse-header-text. - Treat a first paint of two pills as success. Wait for late CSS-in-JS
(~1s / after
setFieldsValue) before claiming the toggle is stable. - Add a second topic branch for another Settings layout pass; stay on the current pre-GA branch.
- Stack Connectivity Check under the model select as the only layout. A
naive
minmax(0, 1fr) autorow also fails: long Check labels starve the select. Keep one row with floors on both tracks and a compact Check label.
Wrong-direction history (do not revert the working commits)
| Commit | Intent | Verdict |
|---|---|---|
f2b405086e / a4927d52f6 |
Flex overrides, drop FORM_STYLE |
Keep the FORM_STYLE drop. Flex-only overrides were not enough. |
f5388e8936 |
layout="vertical" |
Keep. Labels must stack. Compatible was never a different form. |
d2edaedf43 |
One-column grid; Radio.Group block |
Keep the grid. Radio block was the late-flex failure — already removed from JSX. Do not restore it. Dead .ant-radio-group { width: 100% } in the form styles is leftover and should stay gone. |
4d62491d72 |
Segmented block |
Wrong control. Same late CSS-in-JS as Radio. Already replaced. |
6714dc0513 / b977a3320c |
Owned ProviderRouteToggle |
Keep. This is the route control. |
25dd3ae994 |
Desktop min-width: 0 |
Keep. Outer pane shrink. |
a7bf5d1a09 |
Collapse header-text shrink | Keep. Enable switch at 768–800px. |
| Codex card stack / usage meters | Stack Sign out; show 5h / weekly | Keep the stack. Card copy belongs in the title help icon, not three body paragraphs. |
Codex help icon: do not set trigger={['hover', 'focus']} alone. Installed
@rc-component/trigger maps hover to click on touch, so the first tap focuses
(open) then clicks (close). Use resolveCodexHelpTrigger: ['click'] when
(hover: none) / (pointer: coarse), else ['hover', 'focus']. Cap the popup
with min(360px, calc(100vw - 32px)). Meter heading/value and the plan Tag
must wrap (flex-wrap, min-width: 0, Tag white-space: normal).
Do not git revert those commits. They also contain the working pieces.
Prune only leftover Radio/Segmented markup or dead radio-group CSS.
Sources
- CSS Flexbox min-size:auto
- CSS Grid
fr=minmax(auto, <flex>) - Preventing a Grid Blowout
- MDN
minmax() - MDN
container-type - WCAG C7 visually hidden text
- MDN
min-width - Why flex items don’t shrink past content size
- Ant Design Form
- Radio
block(5.21+) - Segmented
block - Ant Design CSS-in-JS
- antd Collapse header-text
flex: auto - antd #54890
- WAI-ARIA radio group