Skip to content

Add 'Jump to' functionality to Braid Docs#2029

Merged
SEEKilian merged 17 commits intomasterfrom
docs-jumpto
Apr 19, 2026
Merged

Add 'Jump to' functionality to Braid Docs#2029
SEEKilian merged 17 commits intomasterfrom
docs-jumpto

Conversation

@SEEKilian
Copy link
Copy Markdown
Contributor

Adds a Modal that allows for quickly jumping to certain Navigation items. Opens with CTRL/CMD+K, as well as an icon below the theme switcher.

JumpToModal component — A new site-level modal (Leverages Braid's Dialog) that lets users search across Foundations, Components, CSS, and Logic by name. Supports arrow-key navigation through results, Enter to navigate, Shift+Enter to jump directly to a component's props page (if present), and auto-focuses the search input on open.

SearchResults & getSearchItems — Supporting modules for the modal: getSearchItems builds a flat list of all searchable items from the existing navigation helpers/routes, and SearchResults renders them grouped by category.

KeyboardShortcut & KeyboardIcon components — New docs-ui components that render styled key cap badges (e.g. , K) alongside a label, used to surface shortcut hints in the UI.

HeaderNavigation updated — Added an onSearchClick prop and a new search trigger button in the header, showing the platform-appropriate shortcut hint (⌘K / Ctrl+K) using KeyboardShortcut.

Navigation updated — Wires up isSearchOpen state, renders JumpToModal, and passes onSearchClick down to both the fixed and sticky Header instances.

useSearchHotkey hook — Listens for ⌘K (macOS) or Ctrl+K (other) globally and calls onOpen to trigger the modal, with platform detection via a small utility (isMac).

CategoryHeading component — For rendering uppercased category labels within the search results list - will be leveraged within docDetails in a follow-up branch

@SEEKilian SEEKilian requested a review from a team as a code owner April 7, 2026 01:41
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 7, 2026

🦋 Changeset detected

Latest commit: 69198a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@braid-design-system/docs-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment on lines +58 to +83
<Stack space="none">
<Box>{themeToggle}</Box>
<Bleed horizontal="xxsmall" bottom="xxsmall">
<Box
component="button"
padding="xxsmall"
paddingRight="xsmall"
borderRadius="standard"
className={searchButton}
onClick={onSearchClick}
>
<KeyboardShortcut
keys={[
navigator.platform.startsWith('Mac') ||
navigator.platform === 'iPhone' ||
navigator.platform === 'iPad' ||
navigator.platform === 'iPod'
? '⌘'
: 'Ctrl',
'K',
]}
shortcutLabel={<IconSearch />}
/>
</Box>
</Bleed>
</Stack>
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.

Based one where this landed we can remove the wrapping Stack and the Box around the themeToggle.


export const searchButton = style({
':hover': {
background: vars.backgroundColor.neutralSoft,
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.

When we change the background colour outside of React Context we need to manage the colour mode change manually. So here need to use the colorModeStyle utility and specify the right token for dark mode.

You can test it on the docs site by focusing the window and typing braiddark 🥸

Comment thread site/tsconfig.json Outdated
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.

Need to add a changeset for this new component

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.

Should add a changeset for this, as its new API for the docs-ui component

Comment thread site/src/App/CategoryHeading/CategoryHeading.tsx Outdated
@@ -0,0 +1,13 @@
import { Box, Text } from 'braid-src/index';
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.

This import path is not right, we might have some setup issues to work through.

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.

I believe getSearchItems can be a static array rather behind a function call. That will mean it also wont need to be memoised as its value never changes.

<TextField
icon={<IconSearch />}
ref={inputRef}
label=""
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.

We should use aria-label here instead of a blank label

if (flatResults.length === 0 && searchQuery.trim()) {
return (
<Box
background="neutralSoft"
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.

Favour using neutralLight over neutralSoft, where soft primarily serves the button use case. This will get you dark mode support out the box too.

Maybe a subtle radius on this one too?

Comment on lines +42 to +57
if (!searchQuery.trim()) {
return (
<Box
background="neutralSoft"
padding="xxxlarge"
display="flex"
justifyContent="center"
alignItems="center"
height="full"
>
<Text tone="secondary" size="xsmall" align="center">
Matching pages will appear here.
</Text>
</Box>
);
}
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.

Maybe combine with the previous if block or use a component for this placeholder state to keep them consistent.

Comment on lines +69 to +72
<Stack key={category} space="xxsmall" component="ul">
<Box marginBottom="xsmall">
<CategoryHeading>{category}</CategoryHeading>
</Box>
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.

The use of margin means the stack model is probably not right. This is also highlighted by the separation of the ul and li elements. I suggest something like this:

<Stack space="xsmall">
  <CategoryHeading>...</CategoryHeading>

  <Stack space="xxsmall" component"ul">
    {items.map(() => (
      <Bleed component="li">
        <Spread space="small">
          <ButtonLink>...</ButtonLink>
          <KeyboardShortcut />
        </Spread>
      </Bleed>
    ))}
  </Stack>
</Stack>

Comment on lines +9 to +12
component?: ComponentProps<typeof Text>['component'];
}) => (
<Box style={{ textTransform: 'uppercase' }}>
<Text size="xsmall" weight="medium" component={component}>
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.

A consumer setting component would likely be more interested in controlling the container element. Suggest applying to the Box:

Suggested change
component?: ComponentProps<typeof Text>['component'];
}) => (
<Box style={{ textTransform: 'uppercase' }}>
<Text size="xsmall" weight="medium" component={component}>
component?: ComponentProps<typeof Box>['component'];
}) => (
<Box component={component} style={{ textTransform: 'uppercase' }}>
<Text size="xsmall" weight="medium">

variant="transparent"
size="large"
label="Back to browse"
icon={<IconChevron direction="left" />}
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.

Recommend using IconArrow for this in favour of Chevron

}

return (
<Stack space="large" test-id="search-results">
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.

Suggested change
<Stack space="large" test-id="search-results">
<Stack space="large">

Copy link
Copy Markdown
Contributor

@michaeltaranto michaeltaranto left a comment

Choose a reason for hiding this comment

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

A couple of minor improvements, but im looking forward to this one landing. Nice work.

@SEEKilian SEEKilian merged commit 2190f6c into master Apr 19, 2026
4 checks passed
@SEEKilian SEEKilian deleted the docs-jumpto branch April 19, 2026 23:47
@seek-oss-ci seek-oss-ci mentioned this pull request Apr 17, 2026
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.

2 participants