Skip to content

feat: let tabs be closed - #422

Open
andrewhuhh wants to merge 5 commits into
mainfrom
feat/tabs-closable
Open

andrewhuhh wants to merge 5 commits into
mainfrom
feat/tabs-closable

Conversation

@andrewhuhh

@andrewhuhh andrewhuhh commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an optional onClose to tab definitions (and to TabsTrigger) for tabs a user can close, such as query editor tabs or open files. A closable tab shows a small close button beside its label, and pressing Delete or Backspace while the tab has focus closes it.

This follows the WAI-ARIA tabs pattern. The tab list keeps a single tab stop, and arrow keys move between tabs. The close button is left out of the tab order, so the Delete key is the keyboard path, but it stays available to assistive technology with the name "Close ". The button sits beside the trigger rather than inside it, so clicking it never selects the tab. It fits inside the existing tab height, and the selection indicator and focus ring cover the whole tab.

The caller still owns value and decides which tab to select after a close. If focus would otherwise fall to the page body, it returns to the tab that is now active. Closable tabs cap their width and truncate long labels, so the close button stays reachable on narrow screens. The list already scrolls when the tabs overflow.

The new "Closable" example on the Tabs page shows a small set of tabs, a set with long file names, and the state after every tab is closed.

Closable tabs truncate only their label (text or element) and keep a Count beside it, and a linked tab (asChild with an anchor) stays a single tab stop that follows its link.

Visual: four new tabs-closable baselines (desktop and mobile, Light and Dark). The example includes a long closable tab with a count. No existing baseline changed.

screenshot 1

screenshot 2

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@aws-amplify-gen-3

aws-amplify-gen-3 Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Name Status Preview Updated
cipher/preview (c90bc0b) ❌ Failed — 2026-12-04 00:48 UTC

Reason: OUTPUT_DIRECTORY_NOT_FOUND

@capy-ai capy-ai Bot added the visual-change label Dec 4, 2026

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 2 other findings in Capy.

Open in Capy

@greptile-apps

greptile-apps Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5RetriggerView in Greptile

[Low impact] The PR appears safe to merge; the linked-tab issue is fixed and no new actionable issues were found.

Summary

Adds closable tabs with a close button and Delete or Backspace shortcuts.

  • Tabs with a close callback can be closed by click or keyboard.

Reviews (5) · Last reviewed commit: "fix(tabs): keep an asChild element as th..." · Reviewed by Greptile

Comment thread src/ui/tabs.tsx Resolved
Comment thread src/ui/navigation.module.css Resolved
Comment thread site/src/examples/tabs/closable.tsx Resolved
… on content lists

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

Comment thread src/ui/tabs.tsx Resolved
greptile-apps[bot]
greptile-apps Bot previously approved these changes Dec 4, 2026
…s count

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

Comment thread src/ui/tabs.tsx Resolved
greptile-apps[bot]
greptile-apps Bot previously approved these changes Dec 4, 2026
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

Comment thread src/ui/tabs.tsx Resolved
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

@capy-ai capy-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant