Skip to content

feat(Form): add a labelExtra slot to Form.Item's label row - #60

Merged
yomybaby merged 2 commits into
chore/issue-61-storybookfrom
feat/form-item-label-extra
Oct 13, 2026
Merged

yomybaby merged 2 commits into
chore/issue-61-storybookfrom
feat/form-item-label-extra

Conversation

@nowgnuesLee

@nowgnuesLee nowgnuesLee commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #64 (Storybook setup); merge that first.

Summary

Form.Item and FormItemVisual take a new labelExtra prop for actions that belong to a field's label row, such as a filter or sort toggle.

  • The slot (.uic-form-item__label-extra) renders beside the <label>, not inside it. Its buttons stay out of the control's accessible name and never trigger label activation, which a button hand-built into label does.
  • Vertical layout: the label column becomes a flex row with justify-content: space-between, so the slot sits at the far end of the row. The column stops clipping overflow so the flush-right button's focus ring stays whole.
  • Horizontal / inline layout: the slot sits right after the label, following labelAlign. The colon moves from the <label> to the end of the slot so it still ends the row. colon={false} keeps the non-breaking-space placeholder.
  • In a column too narrow for both, the label text clips at its own edge instead of painting over the slot.
  • Without a label, or for undefined / null / false, nothing renders and the markup is unchanged.

Docs: Form.doc.mjs usage mentions labelExtra and the new __label-extra style hook. Storybook: a LabelExtra story under Components/Form. CHANGELOG has an Unreleased / Added entry. No version bump here.

Why

backend.ai-webui wanted this for the session launcher's Environments / Version field (lablup/backend.ai-webui#10094), whose image filter button was hand-built inside the label. That PR first added the slot to the webui's own copy of the form engine. Since the engine moved here (webui FR-4088), the change belongs in ui-common. #10094 is closed in favour of this PR. Once this ships, the webui adopts it by bumping the catalog pin.

Verification

  • pnpm run verify passes: typecheck, lint, format, boundary, theme, 1463 tests, build, check:pack, check:integration.
  • New src/components/Form/FormItemVisual.labelExtra.test.tsx covers:
    • slot placement outside <label>
    • the control's accessible name excluding the slot
    • Form.Item forwarding the prop
    • the default and colon-less colon markers
    • no slot without a label or for undefined / null / false
    • the vertical-layout CSS contract, read from source because jsdom drops @layer

@nowgnuesLee
nowgnuesLee force-pushed the feat/form-item-label-extra branch from 27ae1db to 9d7437c Compare October 12, 2026 09:10
@nowgnuesLee
nowgnuesLee changed the base branch from main to chore/issue-61-storybook October 12, 2026 09:10
@nowgnuesLee
nowgnuesLee added this pull request to stack #65 October 12, 2026 09:10
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

GitHub Pages may take up to a minute to hydrate after the deploy.

🧩 Changed Components

Component Changed Stories Open
AlertModal stories 5 Storybook ↗
Board stories 3 Storybook ↗
BoardItemTitle stories 4 Storybook ↗
BooleanToken stories 4 Storybook ↗
BulkEditFormItem stories 3 Storybook ↗
BulkErrorModal stories 4 Storybook ↗
ColorPicker stories 5 Storybook ↗
ComplexSelector stories 8 Storybook ↗
ConfirmPopover stories 6 Storybook ↗
CountBadge stories 8 Storybook ↗
CountdownBorder stories 4 Storybook ↗
DataGrid stories 18 Storybook ↗
DeleteConfirmModal stories 8 Storybook ↗
DigitPopIn stories 3 Storybook ↗
DividedRow stories 5 Storybook ↗
DoubleBadge stories 4 Storybook ↗
DoubleToken stories 5 Storybook ↗
Drawer stories 5 Storybook ↗
ErrorState stories 6 Storybook ↗
Form source + stories 5 Storybook ↗
IconWithTooltip stories 5 Storybook ↗
ImageWithFallback stories 3 Storybook ↗
ListBanner stories 4 Storybook ↗
Modal stories 9 Storybook ↗
NotificationItem stories 4 Storybook ↗
NotificationStack stories 8 Storybook ↗
OverlayScrollbar stories 2 Storybook ↗
PagedSelector stories 7 Storybook ↗
PageHeader stories 3 Storybook ↗
PageLayout stories 3 Storybook ↗
…and 13 more
3 other changed file(s) in src/
  • src/Introduction.mdx
  • src/components/AGENTS.md
  • src/stories/helpers.tsx

📦 Bundle Size

Total gzip (JS + CSS): 165.9 kB

No base measurement — the merge-base build was skipped (a build input outside src/ changed, or the base build failed).


Generated by the PR Preview workflow for 4e5005d · Storybook · CI run

github-actions Bot added a commit that referenced this pull request Oct 12, 2026
@nowgnuesLee
nowgnuesLee requested a balanced review from Copilot October 12, 2026 09:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused API addition is consistently implemented, documented, and covered by relevant behavioral tests.

0 open findings

What changed in this PR

Adds a labelExtra action slot to Form label rows while preserving accessible names and layout behavior.

Changes:

  • Adds and forwards the labelExtra API.
  • Implements vertical, horizontal, and inline styling.
  • Adds tests, Storybook coverage, documentation, and changelog notes.
File Description
src/​components/​Form/​FormItemVisual.tsx Renders the new slot outside the label.
src/​components/​Form/​FormItemVisual.labelExtra.test.tsx Tests rendering, accessibility, forwarding, and CSS contracts.
src/​components/​Form/​FormItemVisual.css Styles slot positioning, clipping, and colon placement.
src/​components/​Form/​FormItem.tsx Exposes and forwards labelExtra.
src/​components/​Form/​Form.stories.tsx Demonstrates an interactive label action.
CHANGELOG.md Documents the new API.
astryx/​components/​Form.doc.mjs Updates Form usage documentation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

nowgnuesLee and others added 2 commits October 12, 2026 18:27
Form.Item and FormItemVisual take `labelExtra` for actions that belong to a
field's label row (a filter or sort toggle). The slot renders beside the
<label>, not inside it, so its buttons stay out of the control's accessible
name and never trigger label activation. Vertical layout pushes it to the
far end of the row and stops the label column clipping its focus ring;
horizontal and inline layout put it right after the label, with the colon
moved to the end of the slot.

Requested by backend.ai-webui (lablup/backend.ai-webui#10094), whose session
launcher hand-built a button inside its label to get this.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nowgnuesLee
nowgnuesLee force-pushed the feat/form-item-label-extra branch from 9d7437c to 4e5005d Compare October 12, 2026 09:28
github-actions Bot added a commit that referenced this pull request Oct 12, 2026
@nowgnuesLee
nowgnuesLee marked this pull request as ready for review October 12, 2026 09:44

@yomybaby yomybaby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yomybaby
yomybaby merged commit db6b6f3 into main Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants