{"data":{"allMdx":{"nodes":[{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ActionList.mdx","frontmatter":{"title":"ActionList"},"rawBody":"---\ncomponentId: action_list\ntitle: ActionList\nstatus: Beta\nsource: https://github.com/primer/react/tree/main/src/ActionList\nstorybook: '/react/storybook?path=/story/components-actionlist'\ndescription: An ActionList is a list of items that can be activated or selected. ActionList is the base component for many menu-type components, including ActionMenu and SelectPanel.\n---\n\nimport data from '../../src/ActionList/ActionList.docs.json'\n\nimport {ActionList, Avatar} from '@primer/react'\nimport {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'\nimport InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'\n\n<Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6, marginBottom: 3}}>\n  <ActionList sx={{width: 320}}>\n    <ActionList.Item>\n      <ActionList.LeadingVisual>\n        <LinkIcon />\n      </ActionList.LeadingVisual>\n      github.com/primer\n      <ActionList.Description variant=\"block\">\n        A React implementation of GitHub's Primer Design System\n      </ActionList.Description>\n    </ActionList.Item>\n    <ActionList.Item>\n      <ActionList.LeadingVisual>\n        <Avatar src=\"https://github.com/mona.png\" />\n      </ActionList.LeadingVisual>\n      mona\n      <ActionList.Description>Monalisa Octocat</ActionList.Description>\n    </ActionList.Item>\n    <ActionList.Item variant=\"danger\">\n      <ActionList.LeadingVisual>\n        <AlertIcon />\n      </ActionList.LeadingVisual>\n      4 vulnerabilities\n      <ActionList.TrailingVisual>\n        <ArrowRightIcon />\n      </ActionList.TrailingVisual>\n    </ActionList.Item>\n  </ActionList>\n</Box>\n\n```js\nimport {ActionList} from '@primer/react'\n```\n\n## Examples\n\n### Minimal example\n\n```jsx live\n<ActionList>\n  <ActionList.Item>New file</ActionList.Item>\n  <ActionList.Item>Copy link</ActionList.Item>\n  <ActionList.Item>Edit file</ActionList.Item>\n  <ActionList.Divider />\n  <ActionList.Item variant=\"danger\">Delete file</ActionList.Item>\n</ActionList>\n```\n\n### With leading visual\n\nLeading visuals are optional and appear at the start of an item. They can be octicons, avatars, and other custom visuals that fit a small area.\n\n```jsx live\n<ActionList>\n  <ActionList.Item>\n    <ActionList.LeadingVisual>\n      <LinkIcon />\n    </ActionList.LeadingVisual>\n    github.com/primer\n  </ActionList.Item>\n  <ActionList.Item variant=\"danger\">\n    <ActionList.LeadingVisual>\n      <AlertIcon />\n    </ActionList.LeadingVisual>\n    4 vulnerabilities\n  </ActionList.Item>\n  <ActionList.Item>\n    <ActionList.LeadingVisual>\n      <Avatar src=\"https://github.com/mona.png\" />\n    </ActionList.LeadingVisual>\n    mona\n  </ActionList.Item>\n</ActionList>\n```\n\n### With trailing visual\n\nTrailing visual and trailing text can display auxiliary information. They're placed at the right of the item, and can denote status, keyboard shortcuts, or be used to set expectations about what the action does.\n\n```jsx live\n<ActionList>\n  <ActionList.Item>\n    New file\n    <ActionList.TrailingVisual>⌘ + N</ActionList.TrailingVisual>\n  </ActionList.Item>\n  <ActionList.Item>\n    Copy link\n    <ActionList.TrailingVisual>⌘ + C</ActionList.TrailingVisual>\n  </ActionList.Item>\n  <ActionList.Item>\n    Edit file\n    <ActionList.TrailingVisual>⌘ + E</ActionList.TrailingVisual>\n  </ActionList.Item>\n  <ActionList.Item variant=\"danger\">\n    Delete file\n    <ActionList.TrailingVisual>⌫</ActionList.TrailingVisual>\n  </ActionList.Item>\n</ActionList>\n```\n\n### With description and dividers\n\nItem dividers allow users to parse heavier amounts of information. They're placed between items and are useful in complex lists, particularly when descriptions or multi-line text is present.\n\n```jsx live\n<ActionList showDividers>\n  <ActionList.Item>\n    <ActionList.LeadingVisual>\n      <Avatar src=\"https://github.com/mona.png\" />\n    </ActionList.LeadingVisual>\n    mona\n    <ActionList.Description>Monalisa Octocat</ActionList.Description>\n  </ActionList.Item>\n  <ActionList.Item>\n    <ActionList.LeadingVisual>\n      <Avatar src=\"https://github.com/hubot.png\" />\n    </ActionList.LeadingVisual>\n    hubot\n    <ActionList.Description>Hubot</ActionList.Description>\n  </ActionList.Item>\n  <ActionList.Item>\n    <ActionList.LeadingVisual>\n      <Avatar src=\"https://github.com/primer-css.png\" />\n    </ActionList.LeadingVisual>\n    primer-css\n    <ActionList.Description>GitHub Design Systems Bot</ActionList.Description>\n  </ActionList.Item>\n</ActionList>\n```\n\n### With links\n\nWhen you want to add links to the List instead of actions, use `ActionList.LinkItem`\n\n```jsx live\n<ActionList>\n  <ActionList.LinkItem href=\"https://github.com/primer\">\n    <ActionList.LeadingVisual>\n      <LinkIcon />\n    </ActionList.LeadingVisual>\n    github/primer\n  </ActionList.LinkItem>\n  <ActionList.LinkItem as={ReactRouterLink} to=\"/\">\n    <ActionList.LeadingVisual>\n      <LawIcon />\n    </ActionList.LeadingVisual>\n    MIT License\n  </ActionList.LinkItem>\n  <ActionList.LinkItem href=\"https://github.com/primer/react/stargazers\" target=\"_blank\" rel=\"noopener noreferrer\">\n    <ActionList.LeadingVisual>\n      <StarIcon />\n    </ActionList.LeadingVisual>\n    1.4k stars\n  </ActionList.LinkItem>\n</ActionList>\n```\n\n### With groups\n\n```javascript live noinline\nconst SelectFields = () => {\n  const [options, setOptions] = React.useState([\n    {text: 'Status', selected: true},\n    {text: 'Stage', selected: true},\n    {text: 'Assignee', selected: true},\n    {text: 'Team', selected: true},\n    {text: 'Estimate', selected: false},\n    {text: 'Due Date', selected: false},\n  ])\n\n  const visibleOptions = options.filter(option => option.selected)\n  const hiddenOptions = options.filter(option => !option.selected)\n\n  const toggle = text => {\n    setOptions(\n      options.map(option => {\n        if (option.text === text) option.selected = !option.selected\n        return option\n      }),\n    )\n  }\n\n  return (\n    <ActionList selectionVariant=\"multiple\">\n      <ActionList.Group title=\"Visible fields\">\n        {visibleOptions.map(option => (\n          <ActionList.Item key={option.text} selected={true} onSelect={() => toggle(option.text)}>\n            {option.text}\n          </ActionList.Item>\n        ))}\n      </ActionList.Group>\n      <ActionList.Group\n        title=\"Hidden fields\"\n        selectionVariant={\n          /** selectionVariant override on Group: disable selection if there are no options */\n          hiddenOptions.length ? 'multiple' : false\n        }\n      >\n        {hiddenOptions.map((option, index) => (\n          <ActionList.Item key={option.text} selected={false} onSelect={() => toggle(option.text)}>\n            {option.text}\n          </ActionList.Item>\n        ))}\n        {hiddenOptions.length === 0 && <ActionList.Item disabled>No hidden fields</ActionList.Item>}\n      </ActionList.Group>\n    </ActionList>\n  )\n}\n\nrender(<SelectFields />)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: true,\n    a11yReviewed: true,\n    stableApi: false, // TODO: revisit on April 10, 2022\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: true,\n  }}\n/>\n\n## Further reading\n\n- [Interface guidelines: Action List](https://primer.style/design/components/action-list)\n\n## Related components\n\n- [ActionMenu](/ActionMenu)\n- [SelectPanel](/SelectPanel)\n","parent":{"relativeDirectory":"","name":"ActionList"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ActionMenu.mdx","frontmatter":{"title":"ActionMenu"},"rawBody":"---\ncomponentId: action_menu\ntitle: ActionMenu\nstatus: Beta\na11yReviewed: false\nsource: https://github.com/primer/react/tree/main/src/ActionMenu.tsx\nstorybook: '/react/storybook?path=/story/components-actionmenu'\ndescription: An ActionMenu is an ActionList-based component for creating a menu of actions that expands through a trigger button.\n---\n\nimport data from '../../src/ActionMenu/ActionMenu.docs.json'\n\nimport {Box, Avatar, ActionList, ActionMenu} from '@primer/react'\n\n<br />\n\n<Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6}}>\n  <ActionMenu>\n    <ActionMenu.Button>Menu</ActionMenu.Button>\n    <ActionMenu.Overlay>\n      <ActionList>\n        <ActionList.Item>\n          Copy link\n          <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>\n        </ActionList.Item>\n        <ActionList.Item>\n          Quote reply\n          <ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual>\n        </ActionList.Item>\n        <ActionList.Item>\n          Edit comment\n          <ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual>\n        </ActionList.Item>\n        <ActionList.Divider />\n        <ActionList.Item variant=\"danger\">\n          Delete file\n          <ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual>\n        </ActionList.Item>\n      </ActionList>\n    </ActionMenu.Overlay>\n  </ActionMenu>\n</Box>\n\n<br />\n\n```js\nimport {ActionMenu} from '@primer/react'\n```\n\n<br />\n\n## Examples\n\n### Minimal example\n\n`ActionMenu` ships with `ActionMenu.Button` which is an accessible trigger for the overlay. It's recommended to compose `ActionList` with `ActionMenu.Overlay`\n\n&nbsp;\n\n```jsx live\n<ActionMenu>\n  <ActionMenu.Button>Menu</ActionMenu.Button>\n\n  <ActionMenu.Overlay>\n    <ActionList>\n      <ActionList.Item onSelect={event => console.log('New file')}>New file</ActionList.Item>\n      <ActionList.Item>Copy link</ActionList.Item>\n      <ActionList.Item>Edit file</ActionList.Item>\n      <ActionList.Divider />\n      <ActionList.Item variant=\"danger\">Delete file</ActionList.Item>\n    </ActionList>\n  </ActionMenu.Overlay>\n</ActionMenu>\n```\n\n### With a custom anchor\n\nYou can choose to have a different _anchor_ for the Menu depending on the application's context.\n\n&nbsp;\n\n```jsx live\n<ActionMenu>\n  <ActionMenu.Anchor>\n    <IconButton icon={KebabHorizontalIcon} variant=\"invisible\" aria-label=\"Open column options\" />\n  </ActionMenu.Anchor>\n\n  <ActionMenu.Overlay>\n    <ActionList>\n      <ActionList.Item>\n        <ActionList.LeadingVisual>\n          <PencilIcon />\n        </ActionList.LeadingVisual>\n        Rename\n      </ActionList.Item>\n      <ActionList.Item>\n        <ActionList.LeadingVisual>\n          <ArchiveIcon />\n        </ActionList.LeadingVisual>\n        Archive all cards\n      </ActionList.Item>\n      <ActionList.Item variant=\"danger\">\n        <ActionList.LeadingVisual>\n          <TrashIcon />\n        </ActionList.LeadingVisual>\n        Delete\n      </ActionList.Item>\n    </ActionList>\n  </ActionMenu.Overlay>\n</ActionMenu>\n```\n\n### With Groups\n\n```jsx live\n<ActionMenu>\n  <ActionMenu.Button>Open column menu</ActionMenu.Button>\n\n  <ActionMenu.Overlay>\n    <ActionList showDividers>\n      <ActionList.Group title=\"Live query\">\n        <ActionList.Item>\n          <ActionList.LeadingVisual>\n            <SearchIcon />\n          </ActionList.LeadingVisual>\n          repo:github/memex,github/github\n        </ActionList.Item>\n      </ActionList.Group>\n      <ActionList.Divider />\n      <ActionList.Group title=\"Layout\" variant=\"subtle\">\n        <ActionList.Item>\n          <ActionList.LeadingVisual>\n            <NoteIcon />\n          </ActionList.LeadingVisual>\n          Table\n          <ActionList.Description variant=\"block\">\n            Information-dense table optimized for operations across teams\n          </ActionList.Description>\n        </ActionList.Item>\n        <ActionList.Item role=\"listitem\">\n          <ActionList.LeadingVisual>\n            <ProjectIcon />\n          </ActionList.LeadingVisual>\n          Board\n          <ActionList.Description variant=\"block\">Kanban-style board focused on visual states</ActionList.Description>\n        </ActionList.Item>\n      </ActionList.Group>\n      <ActionList.Divider />\n      <ActionList.Group>\n        <ActionList.Item>\n          <ActionList.LeadingVisual>\n            <FilterIcon />\n          </ActionList.LeadingVisual>\n          Save sort and filters to current view\n        </ActionList.Item>\n        <ActionList.Item>\n          <ActionList.LeadingVisual>\n            <FilterIcon />\n          </ActionList.LeadingVisual>\n          Save sort and filters to new view\n        </ActionList.Item>\n      </ActionList.Group>\n      <ActionList.Divider />\n      <ActionList.Group>\n        <ActionList.Item>\n          <ActionList.LeadingVisual>\n            <GearIcon />\n          </ActionList.LeadingVisual>\n          View settings\n        </ActionList.Item>\n      </ActionList.Group>\n    </ActionList>\n  </ActionMenu.Overlay>\n</ActionMenu>\n```\n\n### With selection\n\nUse `selectionVariant` on `ActionList` to create a menu with single or multiple selection.\n\n```javascript live noinline\nconst fieldTypes = [\n  {icon: TypographyIcon, name: 'Text'},\n  {icon: NumberIcon, name: 'Number'},\n  {icon: CalendarIcon, name: 'Date'},\n  {icon: SingleSelectIcon, name: 'Single select'},\n  {icon: IterationsIcon, name: 'Iteration'},\n]\n\nconst Example = () => {\n  const [selectedIndex, setSelectedIndex] = React.useState(1)\n  const selectedType = fieldTypes[selectedIndex]\n\n  return (\n    <ActionMenu>\n      <ActionMenu.Button aria-label=\"Select field type\" leadingIcon={selectedType.icon}>\n        {selectedType.name}\n      </ActionMenu.Button>\n      <ActionMenu.Overlay width=\"medium\">\n        <ActionList selectionVariant=\"single\">\n          {fieldTypes.map((type, index) => (\n            <ActionList.Item key={index} selected={index === selectedIndex} onSelect={() => setSelectedIndex(index)}>\n              <ActionList.LeadingVisual>\n                <type.icon />\n              </ActionList.LeadingVisual>\n              {type.name}\n            </ActionList.Item>\n          ))}\n        </ActionList>\n      </ActionMenu.Overlay>\n    </ActionMenu>\n  )\n}\n\nrender(<Example />)\n```\n\n### With External Anchor\n\nTo create an anchor outside of the menu, you need to switch to controlled mode for the menu and pass it as `anchorRef` to `ActionMenu`. Make sure you add `aria-expanded` and `aria-haspopup` to the external anchor:\n\n```javascript live noinline\nconst Example = () => {\n  const [open, setOpen] = React.useState(false)\n  const anchorRef = React.useRef(null)\n\n  return (\n    <>\n      <Button ref={anchorRef} aria-haspopup=\"true\" aria-expanded={open} onClick={() => setOpen(!open)}>\n        {open ? 'Close Menu' : 'Open Menu'}\n      </Button>\n\n      <ActionMenu open={open} onOpenChange={setOpen} anchorRef={anchorRef}>\n        <ActionMenu.Overlay>\n          <ActionList>\n            <ActionList.Item>Copy link</ActionList.Item>\n            <ActionList.Item>Quote reply</ActionList.Item>\n            <ActionList.Item>Edit comment</ActionList.Item>\n            <ActionList.Divider />\n            <ActionList.Item variant=\"danger\">Delete file</ActionList.Item>\n          </ActionList>\n        </ActionMenu.Overlay>\n      </ActionMenu>\n    </>\n  )\n}\n\nrender(<Example />)\n```\n\n### With Overlay Props\n\nTo create an anchor outside of the menu, you need to switch to controlled mode for the menu and pass it as `anchorRef` to `ActionMenu`:\n\n```javascript live noinline\nconst handleEscape = () => alert('you hit escape!')\n\nrender(\n  <ActionMenu>\n    <ActionMenu.Button>Open Actions Menu</ActionMenu.Button>\n    <ActionMenu.Overlay width=\"medium\" onEscape={handleEscape}>\n      <ActionList>\n        <ActionList.Item>\n          Open current Codespace\n          <ActionList.Description variant=\"block\">\n            Your existing Codespace will be opened to its previous state, and you&apos;ll be asked to manually switch to\n            new-branch.\n          </ActionList.Description>\n          <ActionList.TrailingVisual>⌘O</ActionList.TrailingVisual>\n        </ActionList.Item>\n        <ActionList.Item>\n          Create new Codespace\n          <ActionList.Description variant=\"block\">\n            Create a brand new Codespace with a fresh image and checkout this branch.\n          </ActionList.Description>\n          <ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual>\n        </ActionList.Item>\n      </ActionList>\n    </ActionMenu.Overlay>\n  </ActionMenu>,\n)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: true,\n    a11yReviewed: true,\n    stableApi: true,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: true,\n  }}\n/>\n\n## Further reading\n\n[Interface guidelines: Action List + Menu](https://primer.style/design/components/action-list)\n\n## Related components\n\n- [ActionList](/ActionList)\n- [SelectPanel](/SelectPanel)\n- [Button](/Button)\n","parent":{"relativeDirectory":"","name":"ActionMenu"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/AnchoredOverlay.mdx","frontmatter":{"title":"AnchoredOverlay"},"rawBody":"---\ncomponentId: anchored_overlay\ntitle: AnchoredOverlay\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/AnchoredOverlay/AnchoredOverlay.tsx\nstorybook: '/react/storybook?path=/story/behaviors-anchoredoverlay--default-portal'\n---\n\nimport data from '../../src/AnchoredOverlay/AnchoredOverlay.docs.json'\n\nAn `AnchoredOverlay` provides an anchor that will open a floating overlay positioned relative to the anchor.\nThe overlay can be opened and navigated using keyboard or mouse.\n\nSee also [Overlay positioning](/Overlay#positioning).\n\n## Examples\n\n```jsx live\n<State default={false}>\n  {([isOpen, setIsOpen]) => {\n    const openOverlay = React.useCallback(() => setIsOpen(true), [setIsOpen])\n    const closeOverlay = React.useCallback(() => setIsOpen(false), [setIsOpen])\n    return (\n      <AnchoredOverlay\n        renderAnchor={anchorProps => (\n          <Button {...anchorProps} trailingAction={TriangleDownIcon}>\n            Click me to open\n          </Button>\n        )}\n        open={isOpen}\n        onOpen={openOverlay}\n        onClose={closeOverlay}\n      >\n        <Box display=\"flex\" flexDirection=\"column\" maxWidth=\"300px\" padding={2}>\n          <p>\n            This menu automatically receives a focus trap and focus zone. Use up/down keys to navigate between buttons\n          </p>\n          <Button mb={1}>Button 1</Button>\n          <Button mb={1}>Button 2</Button>\n          <Button>Button 3</Button>\n        </Box>\n      </AnchoredOverlay>\n    )\n  }}\n</State>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"AnchoredOverlay"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Autocomplete.mdx","frontmatter":{"title":"Autocomplete"},"rawBody":"---\ncomponentId: autocomplete\ntitle: Autocomplete\nstatus: Alpha\ndescription: Used to render a text input that allows a user to quickly filter through a list of options to pick one or more values.\nsource: https://github.com/primer/react/tree/main/src/Autocomplete\nstorybook: '/react/storybook?path=/story/components-forms-autocomplete'\n---\n\nimport data from '../../src/Autocomplete/Autocomplete.docs.json'\nimport {Autocomplete} from '@primer/react'\n\nThe `Autocomplete` component is comprised of an `Autocomplete.Input` component that a user types into, and a `Autocomplete.Menu` component that displays the list of selectable values.\n\n## Anatomy\n\n### Autocomplete.Input\n\nThe text input is used to filter the options in the dropdown menu. It is also used to show the selected value (or values).\n\nThe default input rendered is the `TextInput` component. A different text input component may be rendered by passing a different component to the `as` prop.\n\nThe `Autocomplete.Input` should not be rendered without a `<label>` who's `htmlFor` prop matches the `Autocomplete.Input`'s `id` prop\n\n### Autocomplete.Overlay\n\nThe `Autocomplete.Overlay` wraps the `Autocomplete.Menu` to display it in an [Overlay](./Overlay) component.\nThis component takes the same props as the `Overlay` component.\nMost `Autocomplete` implementations will use the `Autocomplete.Overlay` component, but there could be special cases where the `Autocomplete.Menu` should be rendered directly after the `Autocomplete.Input` (for example: an `Autocomplete` that is already being rendered in an `Overlay`).\n\n### Autocomplete.Menu\n\nThe `Autocomplete.Menu` component renders a list of selectable options in a non-modal dialog. The list is filtered and sorted to make it as easy as possible to find the option/s that a user is looking for.\n\nThe `Autocomplete.Menu` component should be passed an `aria-labelledby` prop that matches the `id` prop of the `<label>` associated with the `Autocomplete.Input`\n\n#### Customizing how menu items are rendered\n\nBy default, menu items are just rendered as a single line of text. The list in the menu is rendered using the [Action List](/ActionList) component, so menu items can be rendered with all of the same options as Action List items.\nHowever, the `renderGroup`, `groupMetadata`, and `renderItem` props have not been implemented yet.\n\n#### Sorting menu items\n\nItems can be displayed in any order that makes sense, but the `Autocomplete.Menu` component comes with a default sort behavior to make it easy to find selected items. The default behavior is to sort selected items to the top of the list after the menu has been closed.\n\nA function may be passed to the `sortOnCloseFn` prop if this default sorting logic is not helpful for your use case. The sort function will be only be called after the menu is closed so that items don't shift while users are trying to make a selection.\n\n#### Filtering menu items\n\nBy default, menu items are filtered based on whether or not they match the value of the text input. The default filter is case-insensitive.\n\nA function may be passed to the `filterFn` prop if this default filtering behavior does not make sense for your use case.\n\n## Examples\n\n### Basic example\n\n```jsx live\n<FormControl>\n  <FormControl.Label id=\"autocompleteLabel-basic\">Pick a branch</FormControl.Label>\n  <Autocomplete>\n    <Autocomplete.Input />\n    <Autocomplete.Overlay>\n      <Autocomplete.Menu\n        items={[\n          {text: 'main', id: 0},\n          {text: 'autocomplete-tests', id: 1},\n          {text: 'a11y-improvements', id: 2},\n          {text: 'button-bug-fixes', id: 3},\n          {text: 'radio-input-component', id: 4},\n          {text: 'release-1.0.0', id: 5},\n          {text: 'text-input-implementation', id: 6},\n          {text: 'visual-design-tweaks', id: 7},\n        ]}\n        selectedItemIds={[]}\n        aria-labelledby=\"autocompleteLabel-basic\"\n      />\n    </Autocomplete.Overlay>\n  </Autocomplete>\n</FormControl>\n```\n\n### Autocomplete.Input with a custom text input\n\nIn this example, we're passing a [TextInputWithTokens](/TextInputWithTokens) component\n\n```javascript live noinline\nconst CustomTextInputExample = () => {\n  const [tokens, setTokens] = React.useState([{text: 'zero', id: 0}])\n  const selectedTokenIds = tokens.map(token => token.id)\n  const [selectedItemIds, setSelectedItemIds] = React.useState(selectedTokenIds)\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n    setSelectedItemIds(selectedItemIds.filter(id => id !== tokenId))\n  }\n  const onSelectedChange = newlySelectedItems => {\n    if (!Array.isArray(newlySelectedItems)) {\n      return\n    }\n\n    setSelectedItemIds(newlySelectedItems.map(item => item.id))\n\n    if (newlySelectedItems.length < selectedItemIds.length) {\n      const newlySelectedItemIds = newlySelectedItems.map(({id}) => id)\n      const removedItemIds = selectedTokenIds.filter(id => !newlySelectedItemIds.includes(id))\n\n      for (const removedItemId of removedItemIds) {\n        onTokenRemove(removedItemId)\n      }\n\n      return\n    }\n\n    setTokens(newlySelectedItems.map(({id, text}) => ({id, text})))\n  }\n\n  return (\n    <FormControl>\n      <FormControl.Label id=\"autocompleteLabel-customInput\">Pick options</FormControl.Label>\n      <Autocomplete>\n        <Autocomplete.Input as={TextInputWithTokens} tokens={tokens} onTokenRemove={onTokenRemove} />\n        <Autocomplete.Overlay>\n          <Autocomplete.Menu\n            items={[\n              {text: 'zero', id: 0},\n              {text: 'one', id: 1},\n              {text: 'two', id: 2},\n              {text: 'three', id: 3},\n              {text: 'four', id: 4},\n              {text: 'five', id: 5},\n              {text: 'six', id: 6},\n              {text: 'seven', id: 7},\n            ]}\n            selectedItemIds={selectedItemIds}\n            onSelectedChange={onSelectedChange}\n            selectionVariant=\"multiple\"\n            aria-labelledby=\"autocompleteLabel-customInput\"\n          />\n        </Autocomplete.Overlay>\n      </Autocomplete>\n    </FormControl>\n  )\n}\n\nrender(<CustomTextInputExample />)\n```\n\n### Without `Autocomplete.Overlay`\n\n```jsx live\n<FormControl>\n  <FormControl.Label id=\"autocompleteLabel-withoutOverlay\">Pick a branch</FormControl.Label>\n  <Autocomplete>\n    <Autocomplete.Input />\n    <Autocomplete.Menu\n      items={[\n        {text: 'main', id: 0},\n        {text: 'autocomplete-tests', id: 1},\n        {text: 'a11y-improvements', id: 2},\n        {text: 'button-bug-fixes', id: 3},\n        {text: 'radio-input-component', id: 4},\n        {text: 'release-1.0.0', id: 5},\n        {text: 'text-input-implementation', id: 6},\n        {text: 'visual-design-tweaks', id: 7},\n      ]}\n      selectedItemIds={[]}\n      aria-labelledby=\"autocompleteLabel-withoutOverlay\"\n    />\n  </Autocomplete>\n</FormControl>\n```\n\n#### Render items using `ActionList.Item` props\n\n```javascript live noinline\nfunction getColorCircle(color) {\n  return function () {\n    return (\n      <Box\n        bg={color}\n        borderColor={color}\n        width={14}\n        height={14}\n        borderRadius={10}\n        margin=\"auto\"\n        borderWidth=\"1px\"\n        borderStyle=\"solid\"\n      />\n    )\n  }\n}\n\nconst CustomRenderedItemExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'enhancement', id: 1, fillColor: '#a2eeef'},\n    {text: 'bug', id: 2, fillColor: '#d73a4a'},\n    {text: 'good first issue', id: 3, fillColor: '#0cf478'},\n  ])\n  const selectedTokenIds = tokens.map(token => token.id)\n  const [selectedItemIds, setSelectedItemIds] = React.useState(selectedTokenIds)\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n    setSelectedItemIds(selectedItemIds.filter(id => id !== tokenId))\n  }\n  const onSelectedChange = newlySelectedItems => {\n    if (!Array.isArray(newlySelectedItems)) {\n      return\n    }\n\n    setSelectedItemIds(newlySelectedItems.map(item => item.id))\n\n    if (newlySelectedItems.length < selectedItemIds.length) {\n      const newlySelectedItemIds = newlySelectedItems.map(({id}) => id)\n      const removedItemIds = selectedTokenIds.filter(id => !newlySelectedItemIds.includes(id))\n\n      for (const removedItemId of removedItemIds) {\n        onTokenRemove(removedItemId)\n      }\n\n      return\n    }\n\n    setTokens(newlySelectedItems.map(({id, text, metadata}) => ({id, text, fillColor: metadata.fillColor})))\n  }\n\n  return (\n    <FormControl>\n      <FormControl.Label id=\"autocompleteLabel-customRenderedItem\">Pick labels</FormControl.Label>\n      <Autocomplete>\n        <Autocomplete.Input\n          as={TextInputWithTokens}\n          tokens={tokens}\n          tokenComponent={IssueLabelToken}\n          onTokenRemove={onTokenRemove}\n        />\n        <Autocomplete.Overlay>\n          <Autocomplete.Menu\n            items={[\n              {leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', id: 1, metadata: {fillColor: '#a2eeef'}},\n              {leadingVisual: getColorCircle('#d73a4a'), text: 'bug', id: 2, metadata: {fillColor: '#d73a4a'}},\n              {\n                leadingVisual: getColorCircle('#0cf478'),\n                text: 'good first issue',\n                id: 3,\n                metadata: {fillColor: '#0cf478'},\n              },\n              {leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4, metadata: {fillColor: '#ffd78e'}},\n              {leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5, metadata: {fillColor: '#ff0000'}},\n              {leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6, metadata: {fillColor: '#a4f287'}},\n              {leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7, metadata: {fillColor: '#8dc6fc'}},\n            ]}\n            selectedItemIds={selectedItemIds}\n            onSelectedChange={onSelectedChange}\n            selectionVariant=\"multiple\"\n            aria-labelledby=\"autocompleteLabel-customRenderedItem\"\n          />\n        </Autocomplete.Overlay>\n      </Autocomplete>\n    </FormControl>\n  )\n}\n\nrender(<CustomRenderedItemExample />)\n```\n\n#### Customize sort when the menu is re-opened\n\nIn this example, selected items get sorted to the end. By default, they are sorted to the beginning.\n\n```javascript live noinline\nconst CustomSortAfterMenuClose = () => {\n  const [selectedItemIds, setSelectedItemIds] = React.useState([])\n  const isItemSelected = itemId => selectedItemIds.includes(itemId)\n  const onSelectedChange = newlySelectedItems => {\n    if (!Array.isArray(newlySelectedItems)) {\n      return\n    }\n\n    setSelectedItemIds(newlySelectedItems.map(item => item.id))\n  }\n  const customSortFn = (itemIdA, itemIdB) =>\n    isItemSelected(itemIdA) === isItemSelected(itemIdB) ? 0 : isItemSelected(itemIdA) ? 1 : -1\n\n  return (\n    <FormControl>\n      <FormControl.Label id=\"autocompleteLabel-sortAfterClose\">Pick branches</FormControl.Label>\n      <Autocomplete>\n        <Autocomplete.Input />\n        <Autocomplete.Overlay>\n          <Autocomplete.Menu\n            items={[\n              {text: 'main', id: 0},\n              {text: 'autocomplete-tests', id: 1},\n              {text: 'a11y-improvements', id: 2},\n              {text: 'button-bug-fixes', id: 3},\n              {text: 'radio-input-component', id: 4},\n              {text: 'release-1.0.0', id: 5},\n              {text: 'text-input-implementation', id: 6},\n              {text: 'visual-design-tweaks', id: 7},\n            ]}\n            selectedItemIds={selectedItemIds}\n            aria-labelledby=\"autocompleteLabel-sortAfterClose\"\n            onSelectedChange={onSelectedChange}\n            sortOnCloseFn={customSortFn}\n            selectionVariant=\"multiple\"\n          />\n        </Autocomplete.Overlay>\n      </Autocomplete>\n    </FormControl>\n  )\n}\n\nrender(<CustomSortAfterMenuClose />)\n```\n\n#### Custom filtering\n\nIn this example, we show any items whose `text` **contains** the input value. By default, we only show items that start with the input value.\n\n```javascript live noinline\nconst CustomSearchFilter = () => {\n  const [filterVal, setFilterVal] = React.useState('')\n  const handleChange = event => {\n    setFilterVal(event.currentTarget.value)\n  }\n  const customFilterFn = item => item.text.includes(filterVal)\n\n  return (\n    <FormControl>\n      <FormControl.Label id=\"autocompleteLabel-customFilter\">Pick a branch</FormControl.Label>\n      <Autocomplete>\n        <Autocomplete.Input onChange={handleChange} />\n        <Autocomplete.Overlay>\n          <Autocomplete.Menu\n            items={[\n              {text: 'main', id: 0},\n              {text: 'autocomplete-tests', id: 1},\n              {text: 'a11y-improvements', id: 2},\n              {text: 'button-bug-fixes', id: 3},\n              {text: 'radio-input-component', id: 4},\n              {text: 'release-1.0.0', id: 5},\n              {text: 'text-input-implementation', id: 6},\n              {text: 'visual-design-tweaks', id: 7},\n            ]}\n            selectedItemIds={[]}\n            aria-labelledby=\"autocompleteLabel-customFilter\"\n            filterFn={customFilterFn}\n          />\n        </Autocomplete.Overlay>\n      </Autocomplete>\n    </FormControl>\n  )\n}\n\nrender(<CustomSearchFilter />)\n```\n\n#### Rendered without `Autocomplete.Overlay` with a `customScrollContainerRef`\n\nIf a `Autocomplete.Menu` is rendered without an `Autocomplete.Overlay` inside of a scrollable container, the ref of the scrollable container must be passed to the `customScrollContainerRef` to ensure that highlighted items are always scrolled into view.\n\n```javascript live noinline\nconst InOverlayWithCustomScrollContainerRef = () => {\n  const scrollContainerRef = React.useRef(null)\n  const inputRef = React.useRef(null)\n\n  const [isOpen, setIsOpen] = React.useState(false)\n  const handleOpen = () => {\n    setIsOpen(true)\n    inputRef.current && inputRef.current.focus()\n  }\n\n  return (\n    <AnchoredOverlay\n      open={isOpen}\n      onOpen={handleOpen}\n      onClose={() => setIsOpen(false)}\n      width=\"large\"\n      height=\"xsmall\"\n      focusTrapSettings={{initialFocusRef: inputRef}}\n      side=\"inside-top\"\n      renderAnchor={props => (\n        <Button variant=\"invisible\" {...props}>\n          Pick branches\n        </Button>\n      )}\n    >\n      <FormControl>\n        <FormControl.Label visuallyHidden id=\"autocompleteLabel-withCustomScrollRef\">\n          Pick branches\n        </FormControl.Label>\n        <Autocomplete>\n          <Box display=\"flex\" flexDirection=\"column\" height=\"100%\">\n            <Box\n              paddingX=\"3\"\n              paddingY=\"1\"\n              borderWidth={0}\n              borderBottomWidth={1}\n              borderColor=\"border.default\"\n              borderStyle=\"solid\"\n            >\n              <Autocomplete.Input\n                block\n                as={TextInput}\n                ref={inputRef}\n                id=\"autocompleteInput\"\n                sx={{\n                  display: 'flex',\n                  border: '0',\n                  padding: '0',\n                  boxShadow: 'none',\n                  ':focus-within': {\n                    border: '0',\n                    boxShadow: 'none',\n                  },\n                }}\n              />\n            </Box>\n            <Box overflow=\"auto\" flexGrow={1} ref={scrollContainerRef}>\n              <Autocomplete.Menu\n                items={[\n                  {text: 'main', id: 0},\n                  {text: 'autocomplete-tests', id: 1},\n                  {text: 'a11y-improvements', id: 2},\n                  {text: 'button-bug-fixes', id: 3},\n                  {text: 'radio-input-component', id: 4},\n                  {text: 'release-1.0.0', id: 5},\n                  {text: 'text-input-implementation', id: 6},\n                  {text: 'visual-design-tweaks', id: 7},\n                ]}\n                selectedItemIds={[]}\n                customScrollContainerRef={scrollContainerRef}\n                aria-labelledby=\"autocompleteLabel-withCustomScrollRef\"\n              />\n            </Box>\n          </Box>\n        </Autocomplete>\n      </FormControl>\n    </AnchoredOverlay>\n  )\n}\n\nrender(<InOverlayWithCustomScrollContainerRef />)\n```\n\n#### Select multiple values\n\n```javascript live noinline\nconst MultiSelect = () => {\n  const items = [\n    {text: 'main', id: 0},\n    {text: 'autocomplete-tests', id: 1},\n    {text: 'a11y-improvements', id: 22},\n    {text: 'button-bug-fixes', id: 3},\n    {text: 'radio-input-component', id: 4},\n    {text: 'release-1.0.0', id: 5},\n    {text: 'text-input-implementation', id: 6},\n    {text: 'visual-design-tweaks', id: 7},\n  ]\n  const [selectedItemIds, setSelectedItemIds] = React.useState([])\n  const onSelectedChange = newlySelectedItems => {\n    if (!Array.isArray(newlySelectedItems)) {\n      return\n    }\n\n    setSelectedItemIds(newlySelectedItems.map(item => item.id))\n  }\n\n  const getItemById = id => items.find(item => item.id === id)\n\n  return (\n    <Box display=\"flex\" flexDirection=\"column\" sx={{gap: '1em'}}>\n      <FormControl>\n        <FormControl.Label id=\"autocompleteLabel-multiselect\">Pick branches</FormControl.Label>\n        <Autocomplete>\n          <Autocomplete.Input />\n          <Autocomplete.Overlay>\n            <Autocomplete.Menu\n              items={items}\n              selectedItemIds={selectedItemIds}\n              aria-labelledby=\"autocompleteLabel-multiselect\"\n              onSelectedChange={onSelectedChange}\n              selectionVariant=\"multiple\"\n            />\n          </Autocomplete.Overlay>\n        </Autocomplete>\n      </FormControl>\n      <div>\n        <div>Selected items:</div>\n        <Box as=\"ul\" my={0}>\n          {selectedItemIds.map(selectedItemId => (\n            <li key={selectedItemId}>{getItemById(selectedItemId).text}</li>\n          ))}\n        </Box>\n      </div>\n    </Box>\n  )\n}\n\nrender(<MultiSelect />)\n```\n\n#### Select multiple values - new values can be added\n\n```javascript live noinline\nconst MultiSelectAddNewItem = () => {\n  const [selectedItemIds, setSelectedItemIds] = React.useState([])\n  const onSelectedChange = newlySelectedItems => {\n    if (!Array.isArray(newlySelectedItems)) {\n      return\n    }\n\n    setSelectedItemIds(newlySelectedItems.map(item => item.id))\n  }\n\n  const [localItemsState, setLocalItemsState] = React.useState([\n    {text: 'main', id: 0},\n    {text: 'autocomplete-tests', id: 1},\n    {text: 'a11y-improvements', id: 22},\n    {text: 'button-bug-fixes', id: 3},\n    {text: 'radio-input-component', id: 4},\n    {text: 'release-1.0.0', id: 5},\n    {text: 'text-input-implementation', id: 6},\n    {text: 'visual-design-tweaks', id: 7},\n  ])\n  const getItemById = id => localItemsState.find(item => item.id === id)\n  const [filterVal, setFilterVal] = React.useState('')\n\n  const onItemSelect = item => {\n    onSelectedChange([...selectedItemIds.map(id => localItemsState.find(selectedItem => selectedItem.id === id)), item])\n\n    if (!localItemsState.some(localItem => localItem.id === item.id)) {\n      setLocalItemsState([...localItemsState, item])\n    }\n  }\n\n  const handleChange = event => {\n    setFilterVal(event.currentTarget.value)\n  }\n\n  return (\n    <Box display=\"flex\" flexDirection=\"column\" sx={{gap: '1em'}}>\n      <FormControl>\n        <FormControl.Label id=\"autocompleteLabel-addItem\">Pick or add branches</FormControl.Label>\n        <Autocomplete>\n          <Autocomplete.Input onChange={handleChange} />\n          <Autocomplete.Overlay>\n            <Autocomplete.Menu\n              addNewItem={\n                filterVal && !localItemsState.map(localItem => localItem.text).includes(filterVal)\n                  ? {\n                      text: `Add '${filterVal}'`,\n                      handleAddItem: item => {\n                        onItemSelect({\n                          ...item,\n                          text: filterVal,\n                          selected: true,\n                        })\n                        setFilterVal('')\n                      },\n                    }\n                  : undefined\n              }\n              items={localItemsState}\n              selectedItemIds={selectedItemIds}\n              onSelectedChange={onSelectedChange}\n              selectionVariant=\"multiple\"\n              aria-labelledby=\"autocompleteLabel-addItem\"\n            />\n          </Autocomplete.Overlay>\n        </Autocomplete>\n      </FormControl>\n      <div>\n        <div>Selected items:</div>\n        <Box as=\"ul\" my={0}>\n          {selectedItemIds.map(selectedItemId => (\n            <li key={selectedItemId}>{getItemById(selectedItemId).text}</li>\n          ))}\n        </Box>\n      </div>\n    </Box>\n  )\n}\n\nrender(<MultiSelectAddNewItem />)\n```\n\n#### Rendered with `Autocomplete.Context`\n\nThe `Autocomplete.Context` can be used to control the menu open/closed state and customize certain `Autocomplete` behaviors\n\n```javascript live noinline\nexport function AutocompleteWithContext() {\n  return (\n    <Autocomplete>\n      <AutocompleteWithContextInternal />\n    </Autocomplete>\n  )\n}\n\nexport function AutocompleteWithContextInternal() {\n  const autocompleteContext = useContext(Autocomplete.Context)\n  if (autocompleteContext === null) {\n    throw new Error('AutocompleteContext returned null values')\n  }\n\n  const {setShowMenu, showMenu} = autocompleteContext\n  const inputRef = useRef < HTMLInputElement > null\n  const [filterText, setFilterText] = useState('')\n\n  useEffect(() => {\n    if (!showMenu) {\n      // keep the menu open\n      setShowMenu(true)\n    }\n  }, [showMenu, setShowMenu])\n\n  const change = event => setFilterText?.(event.target.value)\n\n  return (\n    <Autocomplete.Context.Provider\n      value={{...autocompleteContext, autocompleteSuggestion: '', setAutocompleteSuggestion: () => false}}\n    >\n      <Autocomplete.Input ref={inputRef} value={filterText} onChange={change} />\n      <Autocomplete.Overlay>\n        <Autocomplete.Menu\n          items={[\n            {text: 'main', id: 0},\n            {text: 'autocomplete-tests', id: 1},\n            {text: 'a11y-improvements', id: 2},\n            {text: 'button-bug-fixes', id: 3},\n            {text: 'radio-input-component', id: 4},\n            {text: 'release-1.0.0', id: 5},\n            {text: 'text-input-implementation', id: 6},\n            {text: 'visual-design-tweaks', id: 7},\n          ]}\n          selectedItemIds={[]}\n          selectionVariant=\"single\"\n        />\n      </Autocomplete.Overlay>\n    </Autocomplete.Context.Provider>\n  )\n}\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: true,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Autocomplete"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Avatar.mdx","frontmatter":{"title":"Avatar"},"rawBody":"---\ntitle: Avatar\nstatus: Alpha\ncomponentId: avatar\nsource: https://github.com/primer/react/blob/main/src/Avatar\n---\n\nimport data from '../../src/Avatar/Avatar.docs.json'\n\nimport {Avatar, Box} from '@primer/react'\n\n```js\nimport {Avatar} from '@primer/react'\n```\n\n## Examples\n\n### Default\n\n```jsx live\n<Avatar src=\"https://avatars.githubusercontent.com/primer\" />\n```\n\n### Square\n\n```jsx live\n<Avatar square src=\"https://avatars.githubusercontent.com/primer\" />\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Avatar"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/AvatarPair.mdx","frontmatter":{"title":"AvatarPair"},"rawBody":"---\ncomponentId: avatar_pair\ntitle: AvatarPair\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/AvatarPair\n---\n\nimport data from '../../src/AvatarPair/AvatarPair.docs.json'\n\n```js\nimport {AvatarPair} from '@primer/react'\n```\n\n## Examples\n\n```jsx live\n<AvatarPair>\n  <Avatar src=\"https://avatars.githubusercontent.com/github\" />\n  <Avatar src=\"https://avatars.githubusercontent.com/primer\" />\n</AvatarPair>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"AvatarPair"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/AvatarStack.mdx","frontmatter":{"title":"AvatarStack"},"rawBody":"---\ncomponentId: avatar_stack\ntitle: AvatarStack\nstatus: Alpha\ndescription: Use an avatar stack to display two or more avatars in an inline stack.\nsource: https://github.com/primer/react/blob/main/src/AvatarStack\nstorybook: '/react/storybook?path=/story/components-avatarstack--default'\n---\n\nimport data from '../../src/AvatarStack/AvatarStack.docs.json'\n\nimport {AvatarStack} from '@primer/react'\n\n```js\nimport {AvatarStack} from '@primer/react'\n```\n\n## Examples\n\n### Default\n\n```jsx live\n<AvatarStack>\n  <Avatar alt=\"Primer\" src=\"https://avatars.githubusercontent.com/primer\" />\n  <Avatar alt=\"GitHub\" src=\"https://avatars.githubusercontent.com/github\" />\n  <Avatar alt=\"Atom\" src=\"https://avatars.githubusercontent.com/atom\" />\n  <Avatar alt=\"Desktop\" src=\"https://avatars.githubusercontent.com/desktop\" />\n</AvatarStack>\n```\n\n### Right aligned\n\n```jsx live\n<AvatarStack alignRight>\n  <Avatar alt=\"Primer\" src=\"https://avatars.githubusercontent.com/primer\" />\n  <Avatar alt=\"GitHub\" src=\"https://avatars.githubusercontent.com/github\" />\n  <Avatar alt=\"Atom\" src=\"https://avatars.githubusercontent.com/atom\" />\n  <Avatar alt=\"Desktop\" src=\"https://avatars.githubusercontent.com/desktop\" />\n</AvatarStack>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"AvatarStack"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Box.mdx","frontmatter":{"title":"Box"},"rawBody":"---\ncomponentId: box\ntitle: Box\nstatus: Beta\ndescription: A low-level utility component that accepts styles to enable custom theme-aware styling\nsource: https://github.com/primer/react/blob/main/src/Box.tsx\n---\n\nimport data from '../../src/Box/Box.docs.json'\n\n```js\nimport {Box} from '@primer/react'\n```\n\n## Examples\n\n### Border on all sides\n\n```jsx live\n<Box sx={{borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default', p: 3}}>Hello</Box>\n```\n\n### Border on one side\n\n```jsx live\n<Box sx={{borderBottomWidth: 1, borderBottomStyle: 'solid', borderColor: 'border.default', pb: 3}}>Hello</Box>\n```\n\n### Flexbox\n\nUse Box to create [flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox) layouts.\n\n```jsx live\n<Box sx={{display: 'flex'}}>\n  <Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>1</Box>\n  <Box sx={{flexGrow: 1, p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>2</Box>\n  <Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>3</Box>\n</Box>\n```\n\n### Grid\n\nUse Box to create [grid](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Grids) layouts.\n\n```jsx live\n<Box sx={{display: 'grid', gridTemplateColumns: '1fr 1fr', gridGap: 3}}>\n  <Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>1</Box>\n  <Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>2</Box>\n  <Box sx={{p: 3, borderWidth: 1, borderStyle: 'solid', borderColor: 'border.default'}}>3</Box>\n</Box>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: null,\n    a11yReviewed: null,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: null,\n    hasFigmaComponent: null,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Box"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/BranchName.mdx","frontmatter":{"title":"BranchName"},"rawBody":"---\ncomponentId: branch_name\ntitle: BranchName\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/BranchName/BranchName.tsx\n---\n\nimport data from '../../src/BranchName/BranchName.docs.json'\n\n```js\nimport {BranchName} from '@primer/react'\n```\n\nBranchName is a label-type component rendered as an `<a>` tag by default with monospace font.\n\n## Examples\n\n```jsx live\n<BranchName href=\"#\">a_new_feature_branch</BranchName>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"BranchName"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Breadcrumbs.mdx","frontmatter":{"title":"Breadcrumbs"},"rawBody":"---\ncomponentId: breadcrumbs\ntitle: Breadcrumbs\nstatus: Alpha\ndescription: Use breadcrumbs to show navigational context on pages that are many levels deep in a site’s hierarchy. Breadcrumbs show and link to parent, grandparent, and sometimes great-grandparent pages.\nsource: https://github.com/primer/react/blob/main/src/Breadcrumbs/Breadcrumbs.tsx\n---\n\nimport data from '../../src/Breadcrumbs/Breadcrumbs.docs.json'\n\n```js\nimport {Breadcrumbs} from '@primer/react'\n```\n\nBreadcrumbs are used to show taxonomical context on pages that are many levels deep in a site’s hierarchy. Breadcrumbs show and link to parent, grandparent, and sometimes great-grandparent pages. Breadcrumbs are most appropriate on pages that:\n\n- Are many levels deep on a site\n- Do not have a section-level navigation\n- May need the ability to quickly go back to the previous (parent) page\n\nTo use Breadcrumbs with [react-router](https://github.com/ReactTraining/react-router) or\n[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass\n`as={NavLink}` and omit the `selected` prop.\nThis ensures that the NavLink gets `activeClassName='selected'`\n\n## Examples\n\n```jsx live\n<Breadcrumbs>\n  <Breadcrumbs.Item href=\"/\">Home</Breadcrumbs.Item>\n  <Breadcrumbs.Item href=\"/about\">About</Breadcrumbs.Item>\n  <Breadcrumbs.Item href=\"/about/team\" selected>\n    Team\n  </Breadcrumbs.Item>\n</Breadcrumbs>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Breadcrumbs"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Button.mdx","frontmatter":{"title":"Button"},"rawBody":"---\ncomponentId: button\ntitle: Button\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/Button\nstorybook: '/react/storybook?path=/story/components-button--playground'\ndescription: Use button for the main actions on a page or form.\n---\n\nimport data from '../../src/Button/Button.docs.json'\n\n```js\nimport {Button} from '@primer/react'\n```\n\n## Examples\n\n### Default button\n\nThis is the default variant for the `Button` component.\n\n```jsx live\n<Button>Default</Button>\n```\n\n### Danger button\n\nThe `danger` variant of `Button` is used to warn users about potentially destructive actions\n\n```jsx live\n<Button variant=\"danger\">Danger</Button>\n```\n\n### Outline button\n\nThe `outline` variant of `Button` is typically used as a secondary button\n\n```jsx live\n<Button variant=\"outline\">Outline</Button>\n```\n\n### Invisible button\n\nThe `invisible` variant of `Button` indicates that the action is a low priority one.\n\n```jsx live\n<Button variant=\"invisible\">Invisible</Button>\n```\n\n### Different sized buttons\n\n`Button` component supports three different sizes. `small`, `medium`, `large`.\n\n```jsx live\n<>\n  <Button size=\"small\">Search</Button>\n  <Button sx={{mt: 2}}>Search</Button>\n  <Button sx={{mt: 2}} size=\"large\">\n    Search\n  </Button>\n</>\n```\n\n### Appending an icon\n\nWe can place an icon inside the `Button` in either the leading or the trailing position to enhance the visual context.\nIt is recommended to use an octicon here.\n\n```jsx live\n<>\n  <Button leadingIcon={SearchIcon}>Search</Button>\n  <Button trailingIcon={SearchIcon} sx={{mt: 2}}>\n    Search\n  </Button>\n  <Button leadingIcon={SearchIcon} trailingIcon={CheckIcon} sx={{mt: 2}}>\n    Search\n  </Button>\n</>\n```\n\n### Icon only button\n\nA separate component called `IconButton` is used if the action shows only an icon with no text. This button will remain square in shape.\n\n```jsx live\n<IconButton aria-label=\"Search\" icon={SearchIcon} />\n```\n\n### Different sized icon buttons\n\n`IconButton` also supports the three different sizes. `small`, `medium`, `large`.\n\n```jsx live\n<>\n  <IconButton aria-label=\"Search\" size=\"small\" icon={SearchIcon} />\n  <IconButton aria-label=\"Search\" icon={SearchIcon} sx={{ml: 2}} />\n  <IconButton aria-label=\"Search\" size=\"large\" icon={SearchIcon} sx={{ml: 2}} />\n</>\n```\n\n### Counter component\n\nA common use case for primer is a button with a counter component which shows the child count value.\nWe provide `Button.Counter` as a composite component which requires you to provide a number as child.\nThe counter will match the `variant` styles of the parent button.\n\n```jsx live\n<Button>\n  Watch\n  <Button.Counter>1</Button.Counter>\n</Button>\n```\n\n### Block button\n\nUse the `block` prop for full width buttons.\n\n```jsx live\n<Button block>Block</Button>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [ButtonGroup](/ButtonGroup)\n","parent":{"relativeDirectory":"","name":"Button"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ButtonGroup.mdx","frontmatter":{"title":"ButtonGroup"},"rawBody":"---\ntitle: ButtonGroup\ncomponentId: button_group\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/ButtonGroup\nstorybook: '/react/storybook?path=/story/components-buttongroup--default'\n---\n\nimport data from '../../src/ButtonGroup/ButtonGroup.docs.json'\n\n```js\nimport {ButtonGroup} from '@primer/react'\n```\n\n## Examples\n\n### Default\n\n```jsx live\n<ButtonGroup>\n  <Button>Button 1</Button>\n  <Button>Button 2</Button>\n  <Button>Button 3</Button>\n</ButtonGroup>\n```\n\n### With icon buttons\n\n```jsx live\n<ButtonGroup>\n  <IconButton aria-label=\"Zoom out\" icon={DashIcon} />\n  <IconButton aria-label=\"Zoom in\" icon={PlusIcon} />\n</ButtonGroup>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [Button](/Button)\n","parent":{"relativeDirectory":"","name":"ButtonGroup"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Checkbox.mdx","frontmatter":{"title":"Checkbox"},"rawBody":"---\ntitle: Checkbox\ndescription: Use checkboxes to toggle between checked and unchecked states in a list or as a standalone form field\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Checkbox.tsx\nstorybook: '/react/storybook?path=/story/components-forms-checkbox'\ncomponentId: checkbox\n---\n\nimport data from '../../src/Checkbox/Checkbox.docs.json'\n\n## Examples\n\n<Note variant=\"warning\">\n\n**Use [FormControl](/FormControl) to display an accessible checkbox form field**. This `Checkbox` component is intended only as an ingredient for other custom components, or as a drop-in replacement for native HTML checkboxes outside of form use-cases.\n\nIf you do use this component to build a custom checkbox, it should always be accompanied by a corresponding `<label>` to improve support for assistive technologies.\n\n</Note>\n\nThe `Checkbox` component can be used in controlled and uncontrolled modes.\n\n```jsx live\n<form>\n  <FormControl>\n    <Checkbox id=\"default-checkbox\" />\n    <FormControl.Label>Default checkbox</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox id=\"always-checked-checkbox\" checked />\n    <FormControl.Label>Always checked</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox id=\"always-unchecked-checkbox\" />\n    <FormControl.Label>Always unchecked</FormControl.Label>\n  </FormControl>\n  <FormControl disabled>\n    <Checkbox id=\"inactive-checkbox\" checked />\n    <FormControl.Label>Inactive</FormControl.Label>\n  </FormControl>\n</form>\n```\n\n<Note variant=\"warning\">\n  Checkbox components should always be accompanied by a corresponding label to improve support for assistive\n  technologies.\n</Note>\n\n### Indeterminate\n\nAn `indeterminate` checkbox state should be used if the input value is neither true nor false. This can be useful in situations where you are required to display an incomplete state, or one that is dependent on other input selections to determine a value.\n\n```jsx live\n<form>\n  <FormControl>\n    <Checkbox onChange={() => {}} indeterminate={true} />\n    <FormControl.Label>Default checkbox</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox checked={true} onChange={() => {}} />\n    <FormControl.Label>Checkbox 1</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox checked={false} onChange={() => {}} />\n    <FormControl.Label>Checkbox 2</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox checked={false} onChange={() => {}} />\n    <FormControl.Label>Checkbox 3</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox checked={false} onChange={() => {}} />\n    <FormControl.Label>Checkbox 4</FormControl.Label>\n  </FormControl>\n</form>\n```\n\n### Grouping Checkbox components\n\nIf you're not building something custom, you should use the [CheckboxGroup](/CheckboxGroup) component to render a group of checkbox inputs.\n\n```jsx live\n<form>\n  <CheckboxGroup>\n    <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n    <FormControl>\n      <Checkbox value=\"1\" />\n      <FormControl.Label>Checkbox 1</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"2\" />\n      <FormControl.Label>Checkbox 2</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"3\" />\n      <FormControl.Label>Checkbox 3</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"4\" />\n      <FormControl.Label>Checkbox 4</FormControl.Label>\n    </FormControl>\n  </CheckboxGroup>\n</form>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [CheckboxInputField](/CheckboxInputField)\n","parent":{"relativeDirectory":"","name":"Checkbox"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/CheckboxGroup.mdx","frontmatter":{"title":"CheckboxGroup"},"rawBody":"---\ntitle: CheckboxGroup\ncomponentId: checkbox_group\ndescription: Renders a set of checkboxes to let users make one or more selections from a short list of options\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/CheckboxGroup/CheckboxGroup.tsx\nstorybook: '/react/storybook/?path=/story/components-forms-checkboxgroup-examples'\n---\n\nimport data from '../../src/CheckboxGroup/CheckboxGroup.docs.json'\n\nimport {CheckboxGroup, Checkbox, Box} from '@primer/components'\nimport {CheckIcon, XIcon, AlertIcon} from '@primer/octicons-react'\n\n## Examples\n\n### Basic\n\n```jsx live\n<Box display=\"grid\" sx={{gap: 3}}>\n  <CheckboxGroup>\n    <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n    <FormControl>\n      <Checkbox value=\"one\" />\n      <FormControl.Label>Choice one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"two\" />\n      <FormControl.Label>Choice two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"three\" />\n      <FormControl.Label>Choice three</FormControl.Label>\n    </FormControl>\n  </CheckboxGroup>\n</Box>\n```\n\n### Using onChange handlers\n\n```javascript live noinline\nconst WithOnChangeHandlers = () => {\n  const [selectedCheckboxValues, setSelectedCheckboxValues] = React.useState(['one', 'two'])\n  const [lastSelectedCheckboxValue, setLastSelectedCheckboxValue] = React.useState()\n\n  const handleCheckboxGroupChange = (selectedValues, e) => {\n    setSelectedCheckboxValues(selectedValues)\n    setLastSelectedCheckboxValue(e.currentTarget.value)\n  }\n\n  const handleChoiceOneChange = e => {\n    alert('Choice one has its own handler')\n  }\n\n  return (\n    <Box display=\"grid\" sx={{gap: 1}}>\n      <CheckboxGroup onChange={handleCheckboxGroupChange}>\n        <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n        <FormControl>\n          <Checkbox value=\"one\" defaultChecked onChange={handleChoiceOneChange} />\n          <FormControl.Label>Choice one</FormControl.Label>\n        </FormControl>\n        <FormControl>\n          <Checkbox value=\"two\" defaultChecked />\n          <FormControl.Label>Choice two</FormControl.Label>\n        </FormControl>\n        <FormControl>\n          <Checkbox value=\"three\" />\n          <FormControl.Label>Choice three</FormControl.Label>\n        </FormControl>\n      </CheckboxGroup>\n\n      {Boolean(selectedCheckboxValues.length) && (\n        <div>The selected checkbox values are {selectedCheckboxValues.join(', ')}</div>\n      )}\n      {Boolean(lastSelectedCheckboxValue) && <div>The last affected checkbox value is {lastSelectedCheckboxValue}</div>}\n    </Box>\n  )\n}\n\nrender(<WithOnChangeHandlers />)\n```\n\n### Disabled\n\n```jsx live\n<CheckboxGroup disabled>\n  <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n  <FormControl>\n    <Checkbox value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</CheckboxGroup>\n```\n\n### Required\n\n```jsx live\n<CheckboxGroup required>\n  <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n  <FormControl>\n    <Checkbox value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</CheckboxGroup>\n```\n\n### With validation\n\n```jsx live\n<CheckboxGroup>\n  <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n  <FormControl>\n    <Checkbox value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n  <CheckboxGroup.Validation variant=\"error\">Your choices are wrong</CheckboxGroup.Validation>\n</CheckboxGroup>\n```\n\n### With caption\n\n```jsx live\n<CheckboxGroup>\n  <CheckboxGroup.Label>Choices</CheckboxGroup.Label>\n  <CheckboxGroup.Caption>You can pick any or all of these choices</CheckboxGroup.Caption>\n  <FormControl>\n    <Checkbox value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</CheckboxGroup>\n```\n\n### A visually hidden label\n\n```jsx live\n<CheckboxGroup>\n  <CheckboxGroup.Label visuallyHidden>Choices</CheckboxGroup.Label>\n  <FormControl>\n    <Checkbox value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Checkbox value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</CheckboxGroup>\n```\n\n### With an external label\n\n```jsx live\n<>\n  <Box\n    id=\"choiceHeading\"\n    borderBottomWidth=\"1px\"\n    borderBottomStyle=\"solid\"\n    borderBottomColor=\"border.default\"\n    pb={2}\n    mb={3}\n    fontSize={3}\n  >\n    Choices\n  </Box>\n  <CheckboxGroup aria-labelledby=\"choiceHeading\">\n    <FormControl>\n      <Checkbox value=\"one\" />\n      <FormControl.Label>Choice one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"two\" />\n      <FormControl.Label>Choice two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"three\" />\n      <FormControl.Label>Choice three</FormControl.Label>\n    </FormControl>\n  </CheckboxGroup>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"CheckboxGroup"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/CircleBadge.mdx","frontmatter":{"title":"CircleBadge"},"rawBody":"---\ncomponentId: circle_badge\ntitle: CircleBadge\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/CircleBadge.tsx\n---\n\nimport data from '../../src/CircleBadge/CircleBadge.docs.json'\n\n```js\nimport {CircleBadge} from '@primer/react'\n```\n\nUse CircleBadge to visually connect logos of third party services like in marketplace. Use CircleBadge.Icon to add an Octicon to the CircleBadge.\n\n## Examples\n\n```jsx live\n<CircleBadge>\n  <CircleBadge.Icon icon={ZapIcon} />\n</CircleBadge>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: false,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"CircleBadge"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/CircleOcticon.mdx","frontmatter":{"title":"CircleOcticon"},"rawBody":"---\ncomponentId: circle_octicon\ntitle: CircleOcticon\nstatus: Alpha\n---\n\nimport data from '../../src/CircleOcticon/CircleOcticon.docs.json'\n\nCircleOcticon renders any Octicon with a circle background. CircleOcticons are most commonly used to represent the status of a pull request in the comment timeline.\n\n## Examples\n\n```jsx live\n<CircleOcticon icon={CheckIcon} size={32} sx={{bg: 'success.fg', color: 'fg.onEmphasis'}} />\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"CircleOcticon"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/CounterLabel.mdx","frontmatter":{"title":"CounterLabel"},"rawBody":"---\ncomponentId: counter_label\ntitle: CounterLabel\ndescription: Use the CounterLabel component to add a count to navigational elements and buttons.\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/CounterLabel/CounterLabel.tsx\n---\n\nimport data from '../../src/CounterLabel/CounterLabel.docs.json'\n\n## Example\n\n```jsx live\n<>\n  <CounterLabel>12</CounterLabel>\n  <CounterLabel scheme=\"primary\">13</CounterLabel>\n  <CounterLabel scheme=\"secondary\">13</CounterLabel>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: true,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"CounterLabel"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Details.mdx","frontmatter":{"title":"Details"},"rawBody":"---\ncomponentId: details\ntitle: Details\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/Details\nstorybook: '/react/storybook/?path=/story/components-details--default'\n---\n\nimport data from '../../src/Details/Details.docs.json'\n\n`Details` is a styled `details` element for use with the `useDetails` hook. The `useDetails` hook returns the `open` state, a `setOpen` function to manually change the open state, and **`getDetailsProps` which must be spread onto your `Details` element in order for `Details` to get receive the proper behaviors provided by the hook**. See [Kent Dodd's article on this pattern](https://kentcdodds.com/blog/how-to-give-rendering-control-to-users-with-prop-getters).\n\nThe `useDetails` hook also takes a few configuration options as parameters which are noted in the table below.\n\nYou must use a `summary` element as your `Details` trigger button. To style your summary element like a [Button](./Button), you can use the `as` prop (see example below).\n\nIt's also possible to use the `useDetails` hook with components other than the Primer `Details`, such as a custom `Details` or `Modal` wrapper in your consuming application. All that matters is that the outer element is a `details` and it contains a `summary` for the button that opens and closes the component, and that `getDetailsProps` is properly spread onto the component rendering your `details` element.\n\n```jsx live\n<State>\n  {([]) => {\n    const {getDetailsProps} = useDetails({closeOnOutsideClick: true})\n    return (\n      <Details {...getDetailsProps()}>\n        <Button as=\"summary\">Hello</Button>\n        This is some content\n      </Details>\n    )\n  }}\n</State>\n```\n\nYou can use the `open` state returned from the hook to conditionally render content:\n\n```jsx live\n<State>\n  {([]) => {\n    const {getDetailsProps, open} = useDetails({closeOnOutsideClick: true})\n    return (\n      <Details {...getDetailsProps()}>\n        <Button as=\"summary\">{open ? 'open' : 'close'}</Button>\n        This is some content\n      </Details>\n    )\n  }}\n</State>\n```\n\nYou can also manually show/hide the content using the `setOpen` function returned from the hook. This can be useful if you have action items in the content of the component such as confirmation buttons:\n\n```jsx live\n<State>\n  {([]) => {\n    const {getDetailsProps, setOpen} = useDetails({closeOnOutsideClick: true})\n    return (\n      <Details {...getDetailsProps()}>\n        <Button as=\"summary\">Delete item</Button>\n        Are you sure?\n        <Button variant=\"danger\" onClick={() => setOpen(false)}>\n          Yes I'm sure\n        </Button>\n      </Details>\n    )\n  }}\n</State>\n```\n\nIn previous versions of Primer React Components, we allowed users to pass in a custom `onToggle` function. You can do this now by overriding the `onToggle` function returned in `getDetailsProps`. Please note that in most cases, you'll want the hook's handling of `onToggle` to be run as well, so that the internal state is properly updated. To do this, manually call the `onToggle` handler returned from `useDetails` before executing your custom `onToggle` code.\n\n```jsx live\n<State>\n  {([]) => {\n    const {getDetailsProps, open, setOpen} = useDetails({closeOnOutsideClick: true})\n    const {onToggle, ...detailsProps} = getDetailsProps()\n    const customToggle = e => {\n      onToggle(e)\n      window.alert('hi')\n    }\n    return (\n      <Details {...detailsProps} onToggle={customToggle}>\n        <Button as=\"summary\">{open ? 'Open' : 'Closed'}</Button>\n        Hello World\n      </Details>\n    )\n  }}\n</State>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## `useDetails` hook configuration options\n\n| Name                | Type      | Default | Description                                                               |\n| :------------------ | :-------- | :-----: | :------------------------------------------------------------------------ |\n| defaultOpen         | Boolean   |         | Sets the initial open/closed state                                        |\n| closeOnOutsideClick | Boolean   |  false  | Sets whether or not element will close when the user clicks outside of it |\n| ref                 | React ref |         | optional ref to pass down to Details component                            |\n\n### Values returned by the `useDetails` hook\n\n| Name            | Type     | Description                                                                                                                                                                                                                              |\n| :-------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| open            | string   | Whether or not Details is currently open                                                                                                                                                                                                 |\n| setOpen         | function | Used to manually change the open state of the Details component                                                                                                                                                                          |\n| getDetailsProps | Object   | Contains an `onToggle` function, the `ref` to pass down to `Details` and the `open` attribute. In most cases, you won't need to interact with any of these values directly, but if you'd like to override any of these yourself you may. |\n","parent":{"relativeDirectory":"","name":"Details"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Dialog.mdx","frontmatter":{"title":"Dialog"},"rawBody":"---\ntitle: Dialog\nstatus: Alpha\n---\n\nimport data from '../../src/Dialog.docs.json'\n\nThe dialog component is used for all modals. It renders on top of the rest of the app with an overlay.\n\nYou'll need to manage the `isOpen` state in a wrapper component of your own and pass in a function to be used to close the Dialog. For documentation purposes only we've created a mock `State` to handle this, but you should handle the state in the component you consume `Dialog` in or in a wrapper component.\n\n## Accessibility\n\nA few considerations must be made to ensure your use of the `Dialog` component is accessible:\n\n- Always be sure to provide either `aria-labelledby` or `aria-label` to your `Dialog` component. In most cases you should use `aria-labelledby` and pass it the `id` of your `Dialog.Header`. If there is no text in your header, or you chose not to use a header, you can use `aria-label` to describe the purpose of the `Dialog`.\n\n- Be sure to pass a ref to return the focus back to once the `Dialog` closes via the `returnFocusRef` prop. In most cases this should be the element that opened the Dialog. If you decide to manage focus within your application and want to bypass Primer React Components from doing so when the `Dialog` closes, you can omit the `returnFocusProp`.\n\n## Z-index\n\nIf you're running into z-index issues or are rendering the component inside of an absolutely positioned element, you can wrap your `Dialog` in a [React Portal](https://reactjs.org/docs/portals.html).\n\n## Examples\n\n```jsx live\n<State default={false}>\n  {([isOpen, setIsOpen]) => {\n    const returnFocusRef = React.useRef(null)\n    return (\n      <>\n        <Button ref={returnFocusRef} onClick={() => setIsOpen(true)}>\n          Open\n        </Button>\n        <Dialog\n          returnFocusRef={returnFocusRef}\n          isOpen={isOpen}\n          onDismiss={() => setIsOpen(false)}\n          aria-labelledby=\"header-id\"\n        >\n          <Dialog.Header id=\"header-id\">Title</Dialog.Header>\n          <Box p={3}>\n            <Text fontFamily=\"sans-serif\">Some content</Text>\n          </Box>\n        </Dialog>\n      </>\n    )\n  }}\n</State>\n```\n\nYou can also pass any non-text content into the header:\n\n```jsx live\n<State default={false}>\n  {([isOpen, setIsOpen]) => {\n    const returnFocusRef = React.useRef(null)\n    return (\n      <>\n        <Button ref={returnFocusRef} onClick={() => setIsOpen(true)}>\n          Open\n        </Button>\n        <Dialog\n          isOpen={isOpen}\n          returnFocusRef={returnFocusRef}\n          onDismiss={() => setIsOpen(false)}\n          aria-labelledby=\"label\"\n        >\n          <Dialog.Header>\n            <ZapIcon />\n          </Dialog.Header>\n          <Box p={3}>\n            <Text id=\"label\" fontFamily=\"sans-serif\">\n              Are you sure you'd like to delete this issue?\n            </Text>\n            <Box display=\"flex\" mt={3} justifyContent=\"flex-end\">\n              <Button sx={{mr: 1}}>Cancel</Button>\n              <Button variant=\"danger\">Delete</Button>\n            </Box>\n          </Box>\n        </Dialog>\n      </>\n    )\n  }}\n</State>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Dialog"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/FilterList.mdx","frontmatter":{"title":"FilterList"},"rawBody":"---\ncomponentId: filter_list\ntitle: FilterList\nstatus: Alpha\n---\n\nimport data from '../../src/FilterList/FilterList.docs.json'\n\nThe FilterList component is a menu with filter options that filter the main content of the page.\n\n## Examples\n\n```jsx live\n<FilterList>\n  <FilterList.Item selected count={32} href=\"#foo\">\n    First Filter\n  </FilterList.Item>\n  <FilterList.Item count={2} href=\"#bar\">\n    Second Filter\n  </FilterList.Item>\n  <FilterList.Item href=\"#baz\">Third Filter</FilterList.Item>\n</FilterList>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"FilterList"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/FilteredSearch.mdx","frontmatter":{"title":"FilteredSearch"},"rawBody":"---\ncomponentId: filtered_search\ntitle: FilteredSearch\nstatus: Alpha\n---\n\nimport data from '../../src/FilteredSearch/FilteredSearch.docs.json'\n\nThe FilteredSearch component helps style an ActionMenu and a TextInput side-by-side.\n\n**Note:** You _must_ use a `TextInput` and `ActionMenu` (or native `<details>` and `<summary>`) in order for this component to work properly.\n\n## Examples\n\n```jsx live\n<FilteredSearch>\n  <ActionMenu>\n    <ActionMenu.Button>Filter</ActionMenu.Button>\n    <ActionMenu.Overlay>\n      <ActionList>\n        <ActionList.Item>Item 1</ActionList.Item>\n        <ActionList.Item>Item 2</ActionList.Item>\n        <ActionList.Item>Item 3</ActionList.Item>\n      </ActionList>\n    </ActionMenu.Overlay>\n  </ActionMenu>\n  <TextInput leadingVisual={SearchIcon} />\n</FilteredSearch>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"FilteredSearch"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Flash.mdx","frontmatter":{"title":"Flash"},"rawBody":"---\ncomponentId: flash\ntitle: Flash\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Flash\n---\n\nimport data from '../../src/Flash/Flash.docs.json'\n\n```js\nimport {Flash} from '@primer/react'\n```\n\nThe Flash component informs users of successful or pending actions.\n\n## Examples\n\n### Default\n\n```jsx live\n<>\n  <Flash>Default Flash</Flash>\n  <Flash variant=\"success\">Success Flash</Flash>\n  <Flash variant=\"warning\">Warning Flash</Flash>\n  <Flash variant=\"danger\">Danger Flash</Flash>\n</>\n```\n\n### With an icon\n\nFlash components with icons inside of them will automatically set the correct color for the icon depending on the type of Flash, as well as applying the correct right margin.\n\n```jsx live\n<Flash variant=\"success\">\n  <Octicon icon={CheckIcon} />\n  Success!\n</Flash>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Flash"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/FormControl.mdx","frontmatter":{"title":"FormControl"},"rawBody":"---\ncomponentId: form_control\ntitle: FormControl\nstatus: Alpha\ndescription: Renders a labelled input and, optionally, associated validation text and/or hint text.\nsource: https://github.com/primer/react/blob/main/src/FormControl/FormControl.tsx\nstorybook: '/react/storybook?path=/story/components-forms-autocomplete'\n---\n\nimport data from '../../src/FormControl/FormControl.docs.json'\n\nimport {\n  FormControl,\n  TextInputWithTokens,\n  Autocomplete,\n  Select,\n  Textarea,\n  Checkbox,\n  CheckboxGroup,\n  Radio,\n  RadioGroup,\n  Text,\n} from '@primer/react'\nimport {MarkGithubIcon} from '@primer/octicons-react'\n\n## Examples\n\n### Basic\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Name</FormControl.Label>\n  <TextInput />\n</FormControl>\n```\n\n### With complex inputs\n\n```javascript live noinline\nconst DifferentInputs = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <Box display=\"grid\" gridGap={3}>\n      <FormControl>\n        <FormControl.Label>TextInputWithTokens</FormControl.Label>\n        <TextInputWithTokens onTokenRemove={onTokenRemove} tokens={tokens} />\n      </FormControl>\n      <FormControl>\n        <FormControl.Label>Autocomplete</FormControl.Label>\n        <Autocomplete>\n          <Autocomplete.Input block />\n          <Autocomplete.Overlay>\n            <Autocomplete.Menu\n              items={[\n                {text: 'css', id: 0},\n                {text: 'css-in-js', id: 1},\n                {text: 'styled-system', id: 2},\n                {text: 'javascript', id: 3},\n                {text: 'typescript', id: 4},\n                {text: 'react', id: 5},\n                {text: 'design-systems', id: 6},\n              ]}\n              selectedItemIds={[]}\n            />\n          </Autocomplete.Overlay>\n        </Autocomplete>\n      </FormControl>\n      <FormControl>\n        <FormControl.Label>Select</FormControl.Label>\n        <Select>\n          <Select.Option value=\"figma\">Figma</Select.Option>\n          <Select.Option value=\"css\">Primer CSS</Select.Option>\n          <Select.Option value=\"prc\">Primer React components</Select.Option>\n          <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n        </Select>\n      </FormControl>\n      <FormControl>\n        <FormControl.Label>Textarea</FormControl.Label>\n        <Textarea />\n      </FormControl>\n    </Box>\n  )\n}\n\nrender(DifferentInputs)\n```\n\n### With a custom input\n\n<Note variant=\"warning\">\n\nWhen rendering an input other than a form component from Primer, you must manually pass the attributes that make the form control accessible:\n\n- The input should have an ID\n- `FormControl.Label` should be associated with the text input by using `htmlFor`\n- If there is a caption, the input should be associated with the caption by passing the message's ID to `aria-describedby`\n- If there is a validation message, the input should be associated with the message by passing the message's ID to `aria-describedby`\n- If there is both a caption and a validation message, the input should be associated with the message by passing the both the validation message's ID and the caption's ID to `aria-describedby`. Example: `aria-describedby=\"caption-id validation-id\"`\n- If the input's value is invalid, `aria-invalid={true}` should be passed to the input.\n- If the input is disabled, `disabled` should be passed.\n- If the input is required, `required` should be passed.\n\nWhen rendering a custom checkbox or radio component, you must also pass `layout=\"horizontal\"` to the `FormControl` component.\n\n</Note>\n\n```javascript live noinline\nconst CustomTextInput = props => <input type=\"text\" {...props} />\nconst CustomCheckboxInput = props => <input type=\"checkbox\" {...props} />\nconst FormControlWithCustomInput = () => {\n  const [value, setValue] = React.useState('mona lisa')\n  const [validationResult, setValidationResult] = React.useState()\n  const doesValueContainSpaces = inputValue => /\\s/g.test(inputValue)\n  const handleInputChange = e => {\n    setValue(e.currentTarget.value)\n  }\n\n  React.useEffect(() => {\n    if (doesValueContainSpaces(value)) {\n      setValidationResult('noSpaces')\n    } else if (value) {\n      setValidationResult('validName')\n    }\n  }, [value])\n\n  return (\n    <Box display=\"grid\" gridGap={3}>\n      <FormControl>\n        <FormControl.Label htmlFor=\"custom-input\">GitHub handle</FormControl.Label>\n        <CustomTextInput\n          id=\"custom-input\"\n          aria-describedby=\"custom-input-caption custom-input-validation\"\n          aria-invalid={validationResult === 'noSpaces'}\n          onChange={handleInputChange}\n        />\n        {validationResult === 'noSpaces' && (\n          <FormControl.Validation id=\"custom-input-validation\" variant=\"error\">\n            GitHub handles cannot contain spaces\n          </FormControl.Validation>\n        )}\n        {validationResult === 'validName' && (\n          <FormControl.Validation id=\"custom-input-validation\" variant=\"success\">\n            Valid name\n          </FormControl.Validation>\n        )}\n        <FormControl.Caption id=\"custom-input-caption\">\n          With or without \"@\". For example \"monalisa\" or \"@monalisa\"\n        </FormControl.Caption>\n      </FormControl>\n\n      <CheckboxGroup>\n        <CheckboxGroup.Label>Checkboxes</CheckboxGroup.Label>\n        <FormControl layout=\"horizontal\">\n          <CustomCheckboxInput id=\"custom-checkbox-one\" value=\"checkOne\" />\n          <FormControl.Label htmlFor=\"custom-checkbox-one\">Checkbox one</FormControl.Label>\n          <FormControl.Caption id=\"custom-checkbox-one-caption\">Hint text for checkbox one</FormControl.Caption>\n        </FormControl>\n        <FormControl layout=\"horizontal\">\n          <CustomCheckboxInput id=\"custom-checkbox-two\" value=\"checkTwo\" />\n          <FormControl.Label htmlFor=\"custom-checkbox-two\">Checkbox two</FormControl.Label>\n          <FormControl.Caption id=\"custom-checkbox-two-caption\">Hint text for checkbox two</FormControl.Caption>\n        </FormControl>\n      </CheckboxGroup>\n    </Box>\n  )\n}\n\nrender(FormControlWithCustomInput)\n```\n\n### With checkbox and radio inputs\n\n```jsx live\n<Box display=\"grid\" sx={{gap: 3}}>\n  <CheckboxGroup>\n    <CheckboxGroup.Label>Checkboxes</CheckboxGroup.Label>\n    <FormControl>\n      <Checkbox value=\"checkOne\" />\n      <FormControl.Label>Checkbox one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"checkTwo\" />\n      <FormControl.Label>Checkbox two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Checkbox value=\"checkThree\" />\n      <FormControl.Label>Checkbox three</FormControl.Label>\n    </FormControl>\n  </CheckboxGroup>\n\n  <RadioGroup>\n    <RadioGroup.Label>Radios</RadioGroup.Label>\n    <FormControl>\n      <Radio name=\"radioChoices\" value=\"radioOne\" />\n      <FormControl.Label>Radio one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio name=\"radioChoices\" value=\"radioTwo\" />\n      <FormControl.Label>Radio two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio name=\"radioChoices\" value=\"radioThree\" />\n      <FormControl.Label>Radio three</FormControl.Label>\n    </FormControl>\n  </RadioGroup>\n</Box>\n```\n\n### Required\n\n```jsx live\n<FormControl required>\n  <FormControl.Label>Name</FormControl.Label>\n  <TextInput />\n</FormControl>\n```\n\n<Note>\n  Checkbox and radio form controls cannot be required individually. Instead, you can require a selection from the entire\n  group of checkboxes or radios.\n</Note>\n\n### Disabled\n\n```jsx live\n<Box display=\"grid\" gridGap={3}>\n  <FormControl disabled>\n    <FormControl.Label>Name</FormControl.Label>\n    <TextInput />\n  </FormControl>\n\n  <FormControl disabled>\n    <FormControl.Label>Checkbox option</FormControl.Label>\n    <Checkbox />\n  </FormControl>\n</Box>\n```\n\n### With a visually hidden label\n\n```jsx live\n<Box display=\"grid\" gridGap={3}>\n  <FormControl>\n    <FormControl.Label visuallyHidden>Name</FormControl.Label>\n    <TextInput />\n  </FormControl>\n  <FormControl>\n    <FormControl.Label visuallyHidden>Checkbox option</FormControl.Label>\n    <Checkbox />\n  </FormControl>\n</Box>\n```\n\n<Note>\n\nWe encourage using `FormControl` alongside all standalone form components like [`TextInput`](/TextInput), as every input must have a corresponding label to be accessible to assistive technology.\n\n`FormControl` also provides an interface for showing a hint text caption and a validation message, and associating those with the input for assistive technology.\n\n</Note>\n\n### With a caption\n\n```jsx live\n<Box display=\"grid\" gridGap={3}>\n  <FormControl>\n    <FormControl.Label>Name</FormControl.Label>\n    <TextInput />\n    <FormControl.Caption>Hint: your first name</FormControl.Caption>\n  </FormControl>\n  <FormControl>\n    <FormControl.Label>Option one</FormControl.Label>\n    <Checkbox />\n    <FormControl.Caption>Hint: the first and only option</FormControl.Caption>\n  </FormControl>\n</Box>\n```\n\n### With validation\n\n<Note>Validation messages are not used for an individual checkbox or radio form control.</Note>\n\n```javascript live noinline\nconst ValidationExample = () => {\n  const [value, setValue] = React.useState('mona lisa')\n  const [validationResult, setValidationResult] = React.useState()\n  const doesValueContainSpaces = inputValue => /\\s/g.test(inputValue)\n  const handleInputChange = e => {\n    setValue(e.currentTarget.value)\n  }\n\n  React.useEffect(() => {\n    if (doesValueContainSpaces(value)) {\n      setValidationResult('noSpaces')\n    } else if (value) {\n      setValidationResult('validName')\n    }\n  }, [value])\n\n  return (\n    <FormControl>\n      <FormControl.Label>GitHub handle</FormControl.Label>\n      <TextInput block value={value} onChange={handleInputChange} />\n      {validationResult === 'noSpaces' && (\n        <FormControl.Validation variant=\"error\">GitHub handles cannot contain spaces</FormControl.Validation>\n      )}\n      {validationResult === 'validName' && (\n        <FormControl.Validation variant=\"success\">Valid name</FormControl.Validation>\n      )}\n      <FormControl.Caption>With or without \"@\". For example \"monalisa\" or \"@monalisa\"</FormControl.Caption>\n    </FormControl>\n  )\n}\n\nrender(ValidationExample)\n```\n\n### With a leading visual\n\n<Note>Only a checkbox or radio form control may have a leading visual.</Note>\n\n```jsx live\n<>\n  <FormControl>\n    <FormControl.Label>Option one</FormControl.Label>\n    <FormControl.LeadingVisual>\n      <MarkGithubIcon />\n    </FormControl.LeadingVisual>\n    <Checkbox />\n  </FormControl>\n\n  <FormControl>\n    <FormControl.Label>Option two</FormControl.Label>\n    <FormControl.LeadingVisual>\n      <MarkGithubIcon />\n    </FormControl.LeadingVisual>\n    <Checkbox />\n    <FormControl.Caption>This one has a caption</FormControl.Caption>\n  </FormControl>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Component status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"FormControl"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Header.mdx","frontmatter":{"title":"Header"},"rawBody":"---\ntitle: Header\ndescription: Use the Header component to create a header that has all of its items aligned vertically with consistent horizontal spacing\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Header\ncomponentId: header\n---\n\nimport data from '../../src/Header/Header.docs.json'\n\n## Examples\n\nAll items directly under the Header component should be a `Header.Item` component. Inside these components can be anything (text, forms, images...), and the `Header.Item` component will make sure these elements vertically align with each other.\n\n`Header.Item` elements have a built-in margin that will need to be overridden with the `mr={0}` props for the last element in the container. We relied on the prop here instead of `:last-child` because the last child isn't always the item visible. On responsive pages, there's a mobile menu that gets presented to the user at smaller breakpoints.\n\n```jsx live\n<Header>\n  <Header.Item>\n    <Header.Link href=\"#\" fontSize={2}>\n      <Octicon icon={MarkGithubIcon} size={32} sx={{mr: 2}} />\n      <span>GitHub</span>\n    </Header.Link>\n  </Header.Item>\n  <Header.Item full>Menu</Header.Item>\n  <Header.Item sx={{mr: 0}}>\n    <Avatar src=\"https://github.com/octocat.png\" size={20} square alt=\"@octocat\" />\n  </Header.Item>\n</Header>\n```\n\n### With full-size item\n\n```jsx live\n<Header>\n  <Header.Item>Item 1</Header.Item>\n  <Header.Item full border={1} borderStyle=\"solid\">\n    Item 2\n  </Header.Item>\n  <Header.Item sx={{mr: 0}}>Item 3</Header.Item>\n</Header>\n```\n\n### With links\n\n```jsx live\n<Header>\n  <Header.Item>\n    <Header.Link href=\"#\">About</Header.Link>\n  </Header.Item>\n  <Header.Item>\n    <Header.Link href=\"#\">Releases</Header.Link>\n  </Header.Item>\n  <Header.Item>\n    <Header.Link href=\"#\">Team</Header.Link>\n  </Header.Item>\n</Header>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Header"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Heading.mdx","frontmatter":{"title":"Heading"},"rawBody":"---\ntitle: Heading\ndescription: Use Heading to structure your content and provide an accessible experience for users of assistive technologies.\nsource: https://github.com/primer/react/blob/main/src/Heading.tsx\nstorybook: '/react/storybook?path=/story/components-heading--default'\nstatus: Alpha\ncomponentId: heading\n---\n\nimport data from '../../src/Heading/Heading.docs.json'\n\nThe Heading component will render an html `h2` tag without any default styling. Other heading level elements `h1-h6` are available through use of the `as` prop (see [System Props](/system-props) for additional explanation). Please reference the [w3 recommendations for headings](https://www.w3.org/WAI/tutorials/page-structure/headings/) to ensure your headings provide an accessible experience for screen reader users.\n\n**Attention:** Make sure to include a valid heading element to render a Heading component other than `h2` (`<Heading as=\"h1\">H1 Element</Heading>`).\n\n## Example\n\n```jsx live\n<Heading sx={{fontSize: 1, mb: 2}}>H2 heading with fontSize={1}</Heading>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Heading"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/IconButton.mdx","frontmatter":{"title":"IconButton"},"rawBody":"---\ntitle: IconButton\ncomponentId: icon_button\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/Button\nstorybook: '/react/storybook?path=/story/components-iconbutton--playground'\ndescription: An accessible button component with no text and only icon.\n---\n\nimport data from '../../src/Button/IconButton.docs.json'\n\n## Usage\n\n### Installation\n\n```js\nimport {IconButton} from '@primer/react'\n```\n\n### Icon only button\n\nA separate component called `IconButton` is used if the action shows only an icon with no text. This button will remain square in shape.\n\n```jsx live\n<IconButton aria-label=\"Search\" icon={SearchIcon} />\n```\n\n### Different sized icon buttons\n\n`IconButton` also supports the three different sizes. `small`, `medium`, `large`.\n\n```jsx live\n<>\n  <IconButton aria-label=\"Search\" icon={SearchIcon} size=\"small\" />\n  <IconButton aria-label=\"Search\" sx={{ml: 2}} icon={SearchIcon} />\n  <IconButton aria-label=\"Search\" sx={{ml: 2}} icon={SearchIcon} size=\"large\" />\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Component status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"IconButton"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Label.mdx","frontmatter":{"title":"Label"},"rawBody":"---\ntitle: Label\ncomponentId: label\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/Label\nstorybook: '/react/storybook?path=/story/components-label--label'\ndescription: Use Label components to add contextual metadata to a design.\n---\n\nimport data from '../../src/Label/Label.docs.json'\n\n## Examples\n\n### Basic\n\n```javascript live noinline\nrender(<Label>Default</Label>)\n```\n\n### Variants\n\n```javascript live noinline\nrender(\n  <>\n    <Label>Default</Label>\n    <Label variant=\"primary\">Primary</Label>\n    <Label variant=\"secondary\">Secondary</Label>\n    <Label variant=\"accent\">Accent</Label>\n    <Label variant=\"success\">Success</Label>\n    <Label variant=\"attention\">Attention</Label>\n    <Label variant=\"severe\">Severe</Label>\n    <Label variant=\"danger\">Danger</Label>\n    <Label variant=\"done\">Done</Label>\n    <Label variant=\"sponsors\">Sponsors</Label>\n  </>,\n)\n```\n\n### Sizes\n\n```javascript live noinline\nrender(\n  <>\n    <Label>Small (default)</Label>\n    <Label size=\"large\">Large</Label>\n  </>,\n)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Label"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/LabelGroup.mdx","frontmatter":{"title":"LabelGroup"},"rawBody":"---\ntitle: LabelGroup\ndescription: Use LabelGroup components to add commonly used margins and other layout constraints to groups of Labels\nsource: https://github.com/primer/react/blob/main/src/LabelGroup.tsx\nstatus: Alpha\ncomponentId: label_group\n---\n\nimport data from '../../src/LabelGroup/LabelGroup.docs.json'\n\n## Example\n\n```jsx live\n<LabelGroup>\n  <Label>Default label</Label>\n  <Label sx={{color: 'fg.onEmphasis', bg: 'danger.emphasis'}}>Label with background indicating a closed PR state</Label>\n  <Label outline>Default outline label</Label>\n</LabelGroup>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: null,\n    adaptsToScreenSizes: null,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"LabelGroup"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Link.mdx","frontmatter":{"title":"Link"},"rawBody":"---\ncomponentId: link\ntitle: Link\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Link/Link.tsx\nstorybook: '/react/storybook/?path=/story/components-link--default'\n---\n\nimport data from '../../src/Link/Link.docs.json'\n\nThe Link component styles anchor tags with default hyperlink color cues and hover text decoration. `Link` is used for destinations, or moving from one page to another.\n\nIn special cases where you'd like a `<button>` styled like a `Link`, use `<Link as='button'>`. Make sure to provide a click handler with `onClick`.\n\n**Important:** When using the `as` prop, be sure to always render an accessible element type, like `a`, `button`, `input`, or `summary`.\n\n## Examples\n\n```jsx live\n<Link href=\"https://github.com\">Link</Link>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Link"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/NavList.mdx","frontmatter":{"title":"NavList"},"rawBody":"---\ntitle: NavList\nstatus: Alpha\ncomponentId: nav_list\ndescription: Use a nav list to render a vertical list of navigation links.\nsource: https://github.com/primer/react/tree/main/src/NavList\nstorybook: '/react/storybook/?path=/story/components-navlist--simple'\n---\n\nimport data from '../../src/NavList/NavList.docs.json'\n\n```js\nimport {NavList} from '@primer/react'\n```\n\n## Examples\n\n### Simple\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/\" aria-current=\"page\">\n    Home\n  </NavList.Item>\n  <NavList.Item href=\"/about\">About</NavList.Item>\n  <NavList.Item href=\"/contact\">Contact</NavList.Item>\n</NavList>\n```\n\n### With leading icons\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/\" aria-current=\"page\">\n    <NavList.LeadingVisual>\n      <HomeIcon />\n    </NavList.LeadingVisual>\n    Dashboard\n  </NavList.Item>\n  <NavList.Item href=\"/pulls\">\n    <NavList.LeadingVisual>\n      <GitPullRequestIcon />\n    </NavList.LeadingVisual>\n    Pull requests\n  </NavList.Item>\n  <NavList.Item href=\"/issues\">\n    <NavList.LeadingVisual>\n      <IssueOpenedIcon />\n    </NavList.LeadingVisual>\n    Issues\n  </NavList.Item>\n</NavList>\n```\n\n### With other leading visuals\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/general\" aria-current=\"page\">\n    <NavList.LeadingVisual>\n      <span aria-hidden>#️⃣</span>\n    </NavList.LeadingVisual>\n    General\n  </NavList.Item>\n  <NavList.Item href=\"/q-a\">\n    <NavList.LeadingVisual>\n      <span aria-hidden>🙏</span>\n    </NavList.LeadingVisual>\n    Q&A\n  </NavList.Item>\n  <NavList.Item href=\"/show-and-tell\">\n    <NavList.LeadingVisual>\n      <span aria-hidden>🙌</span>\n    </NavList.LeadingVisual>\n    Show and tell\n  </NavList.Item>\n</NavList>\n```\n\n### With trailing visuals\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/inbox\" aria-current=\"page\">\n    Inbox\n    <NavList.TrailingVisual>1,234</NavList.TrailingVisual>\n  </NavList.Item>\n  <NavList.Item href=\"/saved\">Saved</NavList.Item>\n  <NavList.Item href=\"/done\">Done</NavList.Item>\n</NavList>\n```\n\n### With a heading\n\n```jsx live drafts\n<>\n  <Heading as=\"h3\" id=\"workflows-heading\" sx={{fontSize: 2}}>\n    Workflows\n  </Heading>\n  <NavList aria-labelledby=\"workflows-heading\">\n    <NavList.Item href=\"/\" aria-current=\"page\">\n      All workflows\n    </NavList.Item>\n    <NavList.Item href=\"/ci\">CI</NavList.Item>\n    <NavList.Item href=\"/deploy\">Deploy</NavList.Item>\n    <NavList.Item href=\"/release\">Release</NavList.Item>\n  </NavList>\n</>\n```\n\n### With aria-label\n\n```jsx live drafts\n<NavList aria-label=\"Security\">\n  <NavList.Item href=\"/\" aria-current=\"page\">\n    Overview\n  </NavList.Item>\n  <NavList.Item href=\"/policy\">Security policy</NavList.Item>\n  <NavList.Item href=\"/advisories\">Security advisories</NavList.Item>\n</NavList>\n```\n\n### With groups\n\n```jsx live drafts\n<NavList>\n  <NavList.Group title=\"Overview\">\n    <NavList.Item href=\"/getting-started\" aria-current=\"page\">\n      Getting started\n    </NavList.Item>\n  </NavList.Group>\n  <NavList.Group title=\"Components\">\n    <NavList.Item href=\"/Avatar\">Avatar</NavList.Item>\n    <NavList.Item href=\"/Button\">Button</NavList.Item>\n    <NavList.Item href=\"/Label\">Label</NavList.Item>\n  </NavList.Group>\n</NavList>\n```\n\n### With sub-items\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/branches\">Branches</NavList.Item>\n  <NavList.Item href=\"/tags\">Tags</NavList.Item>\n  <NavList.Item>\n    Actions\n    <NavList.SubNav>\n      <NavList.Item href=\"/actions\" aria-current=\"page\">\n        General\n      </NavList.Item>\n      <NavList.Item href=\"/actions/runners\">Runners</NavList.Item>\n    </NavList.SubNav>\n  </NavList.Item>\n</NavList>\n```\n\n<Note variant=\"warning\">\n\nIf a `NavList.Item` contains a `NavList.SubNav`, the `NavList.Item` will render as a `<button>` and the `as` prop and `href` prop will be ignored.\n\n</Note>\n\n### With nested sub-items\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/branches\">Branches</NavList.Item>\n  <NavList.Item href=\"/tags\">Tags</NavList.Item>\n  <NavList.Item>\n    Actions\n    <NavList.SubNav>\n      <NavList.Item href=\"/actions\" aria-current=\"page\">\n        General\n      </NavList.Item>\n      <NavList.Item href=\"/actions/runners\">\n        Runners\n        <NavList.SubNav>\n          <NavList.Item href=\"/actions/runners/runner-1\">Runner 1</NavList.Item>\n          <NavList.Item href=\"/actions/runners/runner-2\">Runner 2</NavList.Item>\n        </NavList.SubNav>\n      </NavList.Item>\n    </NavList.SubNav>\n  </NavList.Item>\n</NavList>\n```\n\n<Note variant=\"warning\">\n\nWe only allow for up to 4 levels of nested subnavs. If more than 4 levels is required, it's a good sign that the navigation design needs to be rethought.\n\n</Note>\n\n### With a divider\n\n```jsx live drafts\n<NavList>\n  <NavList.Item href=\"/\" aria-current=\"page\">\n    Dashboard\n  </NavList.Item>\n  <NavList.Item href=\"/pulls\">Pull requests</NavList.Item>\n  <NavList.Item href=\"/issues\">Issues</NavList.Item>\n  <NavList.Divider />\n  <NavList.Item href=\"/marketplace\">Marketplace</NavList.Item>\n  <NavList.Item href=\"/explore\">Explore</NavList.Item>\n</NavList>\n```\n\n### With React Router\n\n```jsx\nimport {Link, useMatch, useResolvedPath} from 'react-router-dom'\nimport {NavList} from '@primer/react'\n\nfunction NavItem({to, children}) {\n  const resolved = useResolvedPath(to)\n  const isCurrent = useMatch({path: resolved.pathname, end: true})\n  return (\n    <NavList.Item as={Link} to={to} aria-current={isCurrent ? 'page' : undefined}>\n      {children}\n    </NavList.Item>\n  )\n}\n\nfunction App() {\n  return (\n    <NavList>\n      <NavItem to=\"/\">Dashboard</NavItem>\n      <NavItem to=\"/pulls\">Pull requests</NavItem>\n      <NavItem to=\"/issues\">Issues</NavItem>\n    </NavList>\n  )\n}\n```\n\n### With Next.js\n\n```jsx\nimport {useRouter} from 'next/router'\nimport Link from 'next/link'\nimport {NavList} from '@primer/react'\n\nfunction NavItem({href, children}) {\n  const router = useRouter()\n  const isCurrent = typeof href === 'string' ? router.asPath === href : router.pathname === href.pathname\n  return (\n    <Link href={href} passHref>\n      <NavList.Item aria-current={isCurrent ? 'page' : false}>{children}</NavList.Item>\n    </Link>\n  )\n}\n\nfunction App() {\n  return (\n    <NavList>\n      <NavItem href=\"/\">Dashboard</NavItem>\n      <NavItem href=\"/pulls\">Pull requests</NavItem>\n      <NavItem href=\"/issues\">Issues</NavItem>\n      <NavItem\n        href={{\n          pathname: '/[owner]/[repo]',\n          query: {owner, repo},\n        }}\n      >\n        Summary\n      </NavItem>\n    </NavList>\n  )\n}\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"NavList"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Octicon.mdx","frontmatter":{"title":"Octicon"},"rawBody":"---\ndescription: Use Octicon to render an Octicon as a component.\ntitle: Octicon\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Octicon/Octicon.tsx\ncomponentId: octicon\n---\n\nimport data from '../../src/Octicon/Octicon.docs.json'\n\n## Example\n\n```jsx live\nimport {CheckIcon, XIcon} from '@primer/octicons-react'\n;<>\n  <Octicon icon={CheckIcon} size={32} color=\"success.fg\" sx={{mr: 2}} />\n  <Octicon icon={XIcon} size={32} color=\"danger.fg\" />\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Octicon"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Overlay.mdx","frontmatter":{"title":"Overlay"},"rawBody":"---\ntitle: Overlay\ndescription: Use Overlay to provide a flexible floating surface for displaying transient content such as menus, selection options, dialogs, and more.\ncomponentId: overlay\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Overlay.tsx\nstorybook: '/react/storybook?path=/story/private-components-overlay--dropdown-overlay'\n---\n\nimport data from '../../src/Overlay/Overlay.docs.json'\n\n```js\nimport {Overlay} from '@primer/react'\n```\n\nThe `Overlay` component handles all behaviors needed by overlay UIs as well as the common styles that all overlays should have. `Overlay` is the base component for many of our overlay-type components. Overlays use shadows to express elevation.\n\n**Behaviors include:**\n\n- Rendering the overlay in a React Portal so that it always renders on top of other content on the page\n- Trapping focus\n- Calling a user provided function when the user presses `Escape`\n- Calling a user provided function when the user clicks outside of the container\n- Focusing either user provided element, or the first focusable element in the container when it is opened\n- Returning focus to an element when container is closed\n\n## Example\n\n```javascript live noinline\nconst Example = () => {\n  // you must manage your own open state\n  const [isOpen, setIsOpen] = React.useState(false)\n  const noButtonRef = React.useRef(null)\n  const anchorRef = React.useRef(null)\n  return (\n    <>\n      <Button ref={anchorRef} onClick={() => setIsOpen(!isOpen)}>\n        open overlay\n      </Button>\n      {/* be sure to conditionally render the Overlay. This helps with performance and is required. */}\n      {isOpen && (\n        <Overlay\n          initialFocusRef={noButtonRef}\n          returnFocusRef={anchorRef}\n          ignoreClickRefs={[anchorRef]}\n          onEscape={() => setIsOpen(!isOpen)}\n          onClickOutside={() => setIsOpen(false)}\n          aria-labelledby=\"title\"\n        >\n          <Box display=\"flex\" flexDirection=\"column\" p={2}>\n            <Text id=\"title\">Are you sure you would like to delete this item?</Text>\n            <Button>yes</Button>\n            <Button ref={noButtonRef}>no</Button>\n          </Box>\n        </Overlay>\n      )}\n    </>\n  )\n}\n\nrender(<Example />)\n```\n\n## Accessibility considerations\n\n- The `Overlay` must either have:\n  - A value set for the `aria-labelledby` attribute that refers to a visible title.\n  - An `aria-label` attribute\n- If the `Overlay` should also have a longer description, use `aria-describedby`\n- The `Overlay` component has a `role=\"dialog\"` set on it, if you are using `Overlay` for alerts, you can pass in `role=\"alertdialog\"` instead. Please read the [W3C guidelines](https://www.w3.org/TR/wai-aria-1.1/#alertdialog) to determine which role is best for your use case\n- The `Overlay` component has `aria-modal` set to `true` by default and should not be overridden as all `Overlay`s behave as modals.\n\nSee the [W3C accessibility recommendations for modals](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_roles_states_props).\n\n## Positioning\n\n`Overlay` renders its `children` within a div positioned absolutely within a portal within the default portal root. The overlay will not update its positioning if the portal root's positioning changes (e.g., if the portal root is statically positioned after some DOM element that dynamically resizes). You may consider using the [AnchoredOverlay](/AnchoredOverlay) component or [customizing the portal root](/Portal#customizing-the-portal-root) to achieve different positioning behavior.\n\nThe position of the Overlay can be customized by using the `position` prop in conjunction with the `top|left|right|bottom` props.\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Overlay"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/PageLayout.mdx","frontmatter":{"title":"PageLayout"},"rawBody":"---\ntitle: PageLayout\ncomponentId: page_layout\nstatus: Alpha\n# description: TODO\nsource: https://github.com/primer/react/tree/main/src/PageLayout\nstorybook: '/react/storybook?path=/story/components-pagelayout--default'\na11yReviewed: true\n---\n\nimport data from '../../src/PageLayout/PageLayout.docs.json'\n\n```js\nimport {PageLayout} from '@primer/react'\n```\n\n## Examples\n\n<Note>\n\nSee [storybook](https://primer.style/react/storybook?path=/story/components-pagelayout) for fullscreen examples.\n\n</Note>\n\n### Default\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With dividers\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header divider=\"line\">\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  {/* You can change the divider based on the viewport width */}\n  <PageLayout.Pane divider={{narrow: 'line'}}>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer divider=\"line\">\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With connected dividers\n\n```jsx live\n<PageLayout padding=\"none\" rowGap=\"none\" columnGap=\"none\">\n  <PageLayout.Header padding=\"normal\" divider=\"line\">\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content padding=\"normal\">\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane padding=\"normal\" divider=\"line\">\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer padding=\"normal\" divider=\"line\">\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With pane on left\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane position=\"start\">\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With pane hidden on narrow viewports\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane position=\"start\" hidden={{narrow: true}}>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With condensed spacing\n\n```jsx live\n<PageLayout padding=\"condensed\" rowGap=\"condensed\" columnGap=\"condensed\">\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### Without header or footer\n\n```jsx live\n<PageLayout>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n</PageLayout>\n```\n\n### With a sticky pane\n\n```jsx live\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <PageLayout>\n    <PageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </PageLayout.Header>\n    <PageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </PageLayout.Content>\n    <PageLayout.Pane sticky>\n      <Placeholder label=\"Pane\" height={120} />\n    </PageLayout.Pane>\n    <PageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </PageLayout.Footer>\n  </PageLayout>\n</Box>\n```\n\n### With a custom sticky header\n\nAdd `offsetHeader` prop to specify the height of the custom sticky header along with `sticky` prop\n\n```jsx live\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <Box\n    sx={{\n      position: 'sticky',\n      top: 0,\n      height: 64,\n      display: 'grid',\n      placeItems: 'center',\n      backgroundColor: 'canvas.subtle',\n      borderBottom: '1px solid',\n      borderColor: 'border.default',\n      zIndex: 1,\n    }}\n  >\n    Custom sticky header\n  </Box>\n  <PageLayout>\n    <PageLayout.Content>\n      <Placeholder label=\"Content\" height={320} />\n    </PageLayout.Content>\n    <PageLayout.Pane position=\"start\" sticky offsetHeader={64}>\n      <Placeholder label=\"Pane\" height={120} />\n    </PageLayout.Pane>\n    <PageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </PageLayout.Footer>\n  </PageLayout>\n</Box>\n```\n\n### With `NavList`\n\n`PageLayout.Pane` by itself does not specify or provide landmark roles. Using\ncomponents that define their own landmark roles, such as [`NavList`](/NavList), will provide\nclear structure to the page that is not present by default in `PageLayout.Pane`.\n\nIt's important to note that multiple landmark roles, such as multiple\n`<nav>` elements, should be uniquely labelled in order to clarify what the\nnavigation container is used for.\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Pane position=\"start\" aria-label=\"Secondary navigation\">\n    <NavList>\n      <NavList.Item href=\"/\" aria-current=\"page\">\n        Home\n      </NavList.Item>\n      <NavList.Item href=\"/about\">About</NavList.Item>\n      <NavList.Item href=\"/contact\">Contact</NavList.Item>\n    </NavList>\n  </PageLayout.Pane>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With `aria-label`\n\nUsing `aria-label` along with `PageLayout.Header`, `PageLayout.Content`, or `PageLayout.Footer` creates a unique label for that landmark role that can make it easier to navigate between sections of content on a page.\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header aria-label=\"Header\">\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content aria-label=\"Content\">\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer aria-label=\"Footer\">\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With `aria-labelledby`\n\nUsing `aria-labelledby` along with `PageLayout.Header`, `PageLayout.Content`, or `PageLayout.Footer` creates a unique label for each landmark role by using the given `id` to associate the landmark with the content with the corresponding `id`. This is helpful when you have a visible item that visually communicates the type of content which you would like to associate to the landmark itself.\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header aria-labelledby=\"header-label\">\n    <Placeholder id=\"header-label\" label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content aria-labelledby=\"main-label\">\n    <Placeholder id=\"main-label\" label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer aria-labelledby=\"footer-label\">\n    <Placeholder id=\"footer-label\" label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n### With resizable pane\n\n```jsx live\n<PageLayout>\n  <PageLayout.Header>\n    <Placeholder label=\"Header\" height={64} />\n  </PageLayout.Header>\n  <PageLayout.Content>\n    <Placeholder label=\"Content\" height={240} />\n  </PageLayout.Content>\n  <PageLayout.Pane resizable>\n    <Placeholder label=\"Pane\" height={120} />\n  </PageLayout.Pane>\n  <PageLayout.Footer>\n    <Placeholder label=\"Footer\" height={64} />\n  </PageLayout.Footer>\n</PageLayout>\n```\n\n## Accessibility\n\nThe `PageLayout` component uses [landmark roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role) for `PageLayout.Header`, `PageLayout.Content`, and `PageLayout.Footer` in order to make it easier for screen reader users to navigate between sections of the page.\n\n| Component            | Landmark role                                                                                           |\n| :------------------- | :------------------------------------------------------------------------------------------------------ |\n| `PageLayout.Header`  | [`banner`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/banner_role)           |\n| `PageLayout.Content` | [`main`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/main_role)               |\n| `PageLayout.Footer`  | [`contentinfo`](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/contentinfo_role) |\n\nEach component may be labeled through either `aria-label` or `aria-labelledby` in order to provide a unique label for the landmark. This can be helpful when there are multiple landmarks of the same type on the page.\n\n### Links & Resources\n\n- [W3C, Landmark roles](https://w3c.github.io/aria/#landmark_roles)\n- [WCAG, ARIA11 Technique](https://www.w3.org/WAI/WCAG22/Techniques/aria/ARIA11)\n- [MDN, Landmark roles](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/landmark_role)\n\n### `PageLayout.Pane`\n\nThe `PageLayout.Pane` component does not provide a default landmark role as the\ncontent of this component may have different roles. When using this component,\nconsider the type of content being rendered inside of `PageLayout.Pane` and if\nit requires a landmark role. Common landmark roles include:\n\n- [`aside`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)\n- [`navigation`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/aside)\n\nSome components, such as `NavList` may already include a landmark role. In these\nsituation, these components use an appropriate landmark role and no further\naction is needed when using `PageLayout.Pane`.\n\n### Screen readers\n\nMost screen readers provide a mechanism through which you can navigate between landmarks on the page. Typically, this is done through a specific keyboard shortcut or through an option in a rotor.\n\n#### JAWS\n\nJAWS supports landmark regions and the details in which it presents them depends on the Web Verbosity Level setting. You can navigate to the next landmark on the page by pressing `R` and the previous landmark by pressing `Shift-R`.\n\n#### NVDA\n\nNVDA supports landmark regions and you can navigate to the next landmark by using pressing `D` and to the previous landmark by pressing `Shift-D`. You may also list out the landmarks by pressing `Insert-F7`.\n\n#### VoiceOver\n\nVoiceOver supports [assigning landmark roles](https://support.apple.com/guide/voiceover/by-landmarks-vo35709/mac) to areas of a page. In order to navigate between landmarks, you can use the [rotor](https://support.apple.com/guide/voiceover/with-the-voiceover-rotor-mchlp2719/10/mac/12.0).\n\nOn macOS, you can open the VoiceOver rotor by pressing `VO-U`. You can navigate between lists to find the `Landmarks` list by using the Right Arrow or Left Arrow key. From that list, you can use the Down Arrow and Up Arrow keys to navigate between landmarks identified on the page.\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"PageLayout"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Pagehead.md","frontmatter":{"title":"Pagehead"},"rawBody":"---\ncomponentId: pagehead\ntitle: Pagehead\ndescription: Use Pagehead to provide a clear, separated page title.\nsource: https://github.com/primer/react/blob/main/src/Pagehead.tsx\nstatus: Alpha\n---\n\nimport data from '../../src/Pagehead/Pagehead.docs.json'\n\n```js\nimport {Pagehead} from '@primer/react'\n```\n\n## Example\n\n```jsx live\n<Pagehead>Pagehead</Pagehead>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\nitems={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Pagehead"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Pagination.md","frontmatter":{"title":"Pagination"},"rawBody":"---\ntitle: Pagination\ncomponentId: pagination\ndescription: Use Pagination to display a sequence of links that allow navigation to discrete, related pages.\nsource: https://github.com/primer/react/blob/main/src/Pagination/Pagination.tsx\nstorybook: '/react/storybook?path=/story/components-pagination-features--hide-page-numbers'\nstatus: Alpha\n---\n\nimport data from '../../src/Pagination/Pagination.docs.json'\n\nimport State from '../components/State'\n\n```js\nimport {Pagination} from '@primer/react'\n```\n\n## Examples\n\nThe pagination component only requires two properties to render: `pageCount`, which is the total number of pages, and `currentPage`, which is the currently selected page number (which should be managed by the consuming application).\n\n```jsx live\n<Pagination pageCount={15} currentPage={2} onPageChange={e => e.preventDefault()} />\n```\n\nHowever, to handle state changes when the user clicks a page, you also need to pass `onPageChange`, which is a function that takes a click event and page number as an argument:\n\n```javascript\ntype PageChangeCallback = (evt: React.MouseEvent, page: number) => void\n```\n\nBy default, clicking a link in the pagination component will cause the browser to navigate to the URL specified by the page. To cancel navigation and handle state management on your own, you should call `preventDefault` on the event, as in this example:\n\n```jsx live\n<State default={1}>\n  {([page, setPage]) => {\n    const totalPages = 15\n    const onPageChange = (evt, page) => {\n      evt.preventDefault()\n      setPage(page)\n    }\n\n    return (\n      <Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2} p={2}>\n        <Box>\n          Current page: {page} / {totalPages}\n        </Box>\n        <Pagination pageCount={totalPages} currentPage={page} onPageChange={onPageChange} />\n      </Box>\n    )\n  }}\n</State>\n```\n\n### Customizing link URLs\n\nTo customize the URL generated for each link, you can pass a function to the `hrefBuilder` property. The function should take a page number as an argument and return a URL to use for the link.\n\n```javascript\ntype HrefBuilder = (page: number) => string\n```\n\n```jsx live\n<State default={'(nothing clicked yet)'}>\n  {([lastUrl, setLastUrl]) => {\n    const onPageChange = (evt, page) => {\n      evt.preventDefault()\n      setLastUrl(evt.target.href)\n    }\n    const hrefBuilder = page => {\n      return `https://example.com/pages/${page}`\n    }\n\n    return (\n      <Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2} p={2}>\n        <Box>The last URL clicked was: {lastUrl}</Box>\n        <Pagination pageCount={15} currentPage={2} onPageChange={onPageChange} hrefBuilder={hrefBuilder} />\n      </Box>\n    )\n  }}\n</State>\n```\n\n### Customizing which pages are shown\n\nTwo props control how many links are displayed in the pagination container at any given time. `marginPageCount` controls how many pages are guaranteed to be displayed on the left and right of the component; `surroundingPageCount` controls how many pages will be displayed to the left and right of the current page.\n\n```jsx live\n<Pagination\n  pageCount={20}\n  currentPage={10}\n  marginPageCount={1}\n  surroundingPageCount={2}\n  onPageChange={e => e.preventDefault()}\n/>\n```\n\nThe algorithm tries to minimize the amount the component shrinks and grows as the user changes pages; for this reason, if any of the pages in the margin (controlled via `marginPageCount`) intersect with pages in the center (controlled by `surroundingPageCount`), the center section will be shifted away from the margin. Consider the following examples, where pages one through six are shown when any of the first four pages are selected. Only when the fifth page is selected and there is a gap between the margin pages and the center pages does a break element appear.\n\n```jsx live\n<Box>\n  {[1, 2, 3, 4, 5].map(page => (\n    <Pagination\n      pageCount={20}\n      currentPage={page}\n      marginPageCount={1}\n      surroundingPageCount={2}\n      onPageChange={e => e.preventDefault()}\n    />\n  ))}\n</Box>\n```\n\n### Previous/next pagination\n\nTo hide all the page numbers and create a simple pagination container with just the Previous and Next buttons, set `showPages` to `false`.\n\n```jsx live\n<State default={1}>\n  {([page, setPage]) => {\n    const totalPages = 10\n    const onPageChange = (evt, page) => {\n      evt.preventDefault()\n      setPage(page)\n    }\n\n    return (\n      <Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2} p={2}>\n        <Box>\n          Current page: {page} / {totalPages}\n        </Box>\n        <Pagination pageCount={totalPages} currentPage={page} onPageChange={onPageChange} showPages={false} />\n      </Box>\n    )\n  }}\n</State>\n```\n\n## Theming\n\nThe following snippet shows the properties in the theme that control the styling of the pagination component:\n\n```javascript\nexport default {\n  // ... rest of theme ...\n  pagination: {\n    borderRadius,\n    spaceBetween,\n    colors: {\n      normal: {\n        fg,\n      },\n      disabled: {\n        fg,\n        border,\n      },\n      hover: {\n        border,\n      },\n      selected: {\n        fg,\n        bg,\n        border,\n      },\n      active: {\n        border,\n      },\n      nextPrevious: {\n        fg,\n      },\n    },\n  },\n}\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\nitems={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Pagination"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/PointerBox.mdx","frontmatter":{"title":"PointerBox"},"rawBody":"---\ntitle: PointerBox\ndescription: A customisable, bordered Box with a caret pointer\ncomponentId: pointer_box\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/PointerBox.tsx\n---\n\nimport data from '../../src/PointerBox/PointerBox.docs.json'\n\n## Examples\n\n```jsx live\n<PointerBox minHeight={100} sx={{m: 4, p: 2, bg: 'success.subtle', borderColor: 'success.emphasis'}}>\n  PointerBox\n</PointerBox>\n```\n\n### Caret position\n\n```javascript live noinline\nfunction PointerBoxDemo(props) {\n  const [pos, setPos] = React.useState('top')\n\n  return (\n    <Box>\n      <Heading as=\"h3\" sx={{fontSize: 3}}>\n        Caret Position\n      </Heading>\n      <CaretSelector current={pos} onChange={setPos} />\n      <Box position=\"relative\">\n        <PointerBox\n          minHeight={100}\n          caret={pos}\n          sx={{m: 4, p: 2, bg: 'success.subtle', borderColor: 'success.emphasis'}}\n        >\n          Content\n        </PointerBox>\n      </Box>\n    </Box>\n  )\n}\n\nfunction CaretSelector(props) {\n  const choices = [\n    'top',\n    'bottom',\n    'left',\n    'right',\n    'left-bottom',\n    'left-top',\n    'right-bottom',\n    'right-top',\n    'top-left',\n    'bottom-left',\n    'top-right',\n    'bottom-right',\n  ].map(dir => (\n    <label key={dir}>\n      <input\n        type=\"radio\"\n        name=\"caret\"\n        value={dir}\n        checked={dir === props.current}\n        onChange={() => props.onChange(dir)}\n      />{' '}\n      {dir}\n    </label>\n  ))\n\n  return (\n    <Box display=\"grid\" gridTemplateColumns=\"repeat(4, auto)\" gridGap={3} my={2}>\n      {choices}\n    </Box>\n  )\n}\n\nrender(<PointerBoxDemo />)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [Popover](/Popover)\n","parent":{"relativeDirectory":"","name":"PointerBox"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Popover.md","frontmatter":{"title":"Popover"},"rawBody":"---\ntitle: Popover\ndescription: Use Popovers to bring attention to specific user interface elements and suggest an action or to guide users through a new experience\ncomponentId: popover\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Popover.tsx\n---\n\nimport data from '../../src/Popover/Popover.docs.json'\n\n```js\nimport {Popover} from '@primer/react'\n```\n\n## Examples\n\n```jxs live\n<Box position=\"relative\">\n  <Box justifyContent=\"center\" display=\"flex\">\n    <Button variant=\"primary\">Hello!</Button>\n  </Box>\n\n  <Popover relative open={true} caret=\"top\">\n    <Popover.Content sx={{mt: 2}}>\n      <Heading sx={{fontSize: 2}}>Popover heading</Heading>\n      <Text as=\"p\">Message about this particular piece of UI.</Text>\n      <Button>Got it!</Button>\n    </Popover.Content>\n  </Popover>\n</Box>\n```\n\nTwo components make up a popover; the `Popover` component controls the absolute positioning of the popover, and `Popover.Content` renders the inner content of the popover as well as the caret.\n\nBy default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the `relative` property.\n\nIt can be useful to give the `Popover.Content` element a margin to help align the popover.\n\n### Caret position\n\n`Popover` supports various caret positions, which you can specify via the `caret` property. This demo shows all the valid values for the prop. The default is `top`. Note that the `top-left`, `bottom-left`, `top-right`, and `bottom-right` values modify the horizontal alignment of the popover.\n\n```javascript live noinline\nfunction PopoverDemo(props) {\n  const [pos, setPos] = React.useState('top')\n  const [open, setOpen] = React.useState(true)\n\n  return (\n    <Box>\n      <Heading as=\"h3\" sx={{fontSize: 3}}>\n        Caret Position\n      </Heading>\n      <CaretSelector current={pos} onChange={setPos} />\n      <Heading as=\"h3\" sx={{fontSize: 3}}>\n        Popover Visibility\n      </Heading>\n      <Box my={2}>\n        <label>\n          <input type=\"checkbox\" value={open} checked={open} onChange={() => setOpen(open => !open)} /> Open\n        </label>\n      </Box>\n\n      <Box position=\"relative\" pt={4}>\n        <Popover relative open={open} caret={pos}>\n          <Popover.Content>\n            <Heading sx={{fontSize: 2}}>\n              <code>{pos}</code> caret\n            </Heading>\n            <Text as=\"p\">Message about this particular piece of UI.</Text>\n            <Button onClick={() => setOpen(false)}>Got it!</Button>\n          </Popover.Content>\n        </Popover>\n      </Box>\n    </Box>\n  )\n}\n\nfunction CaretSelector(props) {\n  const choices = [\n    'top',\n    'bottom',\n    'left',\n    'right',\n    'left-bottom',\n    'left-top',\n    'right-bottom',\n    'right-top',\n    'top-left',\n    'bottom-left',\n    'top-right',\n    'bottom-right',\n  ].map(dir => (\n    <label>\n      <input\n        key={dir}\n        type=\"radio\"\n        name=\"caret\"\n        value={dir}\n        checked={dir === props.current}\n        onChange={() => props.onChange(dir)}\n      />{' '}\n      {dir}\n    </label>\n  ))\n\n  return (\n    <Box display=\"grid\" gridTemplateColumns=\"repeat(4, auto)\" gridGap={3} my={2}>\n      {choices}\n    </Box>\n  )\n}\n\nrender(<PopoverDemo />)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\nitems={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Popover"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Portal.mdx","frontmatter":{"title":"Portal"},"rawBody":"---\ntitle: Portal\ndescription: Portals allow you to create a separation between the logical React component hierarchy and the physical DOM.\ncomponentId: portal\nsource: https://github.com/primer/react/blob/main/src/Portal/Portal.tsx\nstatus: Alpha\n---\n\nimport data from '../../src/Portal/Portal.docs.json'\n\n```js\nimport {Portal, registerPortalRoot} from '@primer/react'\n```\n\nThis `Portal` component will render all children into the portal root DOM node instead of as children of this Portal's parent DOM element. This is useful for breaking out of the current stacking context. For example, popup menus and tooltips may need to render on top of (read: covering up) other UI. The best way to guarantee this is to add these elements to top-level DOM, such as directly on `document.body`. These elements can then be moved to the correct location using absolute positioning.\n\n<Note variant=\"info\">\n\nSee the [React documentation on portals](https://reactjs.org/docs/portals.html) for an in-depth explanation.\n\n</Note>\n\n## Examples\n\n### Default example\n\n```jsx\n<Portal>\n  Regardless of where this appears in the React component tree, this text will be rendered in the DOM within the portal\n  root at document.body.\n</Portal>\n```\n\n### Customizing the portal root\n\n```html\n<!-- Wherever in your DOM tree you would like to have the default portal root -->\n<div id=\"__primerPortalRoot__\"></div>\n```\n\nor\n\n```js\nimport { registerPortalRoot } from \"@primer/react\"\nregisterPortalRoot(document.querySelector(\".my-portal-root\")!)\n```\n\nBy default, Primer will create a portal root for you as a child of the closest `<BaseStyles>` element, or `document.body` if none is found. That root will be positioned absolutely in the top-left corner of its parent element. If you would like to specify your own portal root, there are two options:\n\n1. Before rendering a `<Portal>` for the first time, ensure that an element exists with id `__primerPortalRoot__`. If that exists, it will be used as the default portal root.\n2. Call the `registerPortalRoot` function, passing in the element you would like to use as your default portal root.\n\nKeep in mind that any inherited styles applied to portaled elements are based on its physical DOM parent. Practically this means that styles added by a `<BaseStyles>` element will not apply to the portaled content unless the portal root is a descendent of a `<BaseStyles>` element.\n\nAlso, as `<ThemeProvider>` affects the _React_ context, which applies to the logical React component hierarchy, the portal root is not required to be a child of a `<ThemeProvider>` for its children to receive that context.\n\n### Multiple portal roots\n\n```jsx\nimport { Portal, registerPortalRoot } from \"@primer/react\"\n\nregisterPortalRoot(document.querySelector(\".scrolling-canvas-root\")!, \"scrolling-canvas\")\n\n// ...\n\nexport default () => (\n    <Portal containerName=\"scrolling-canvas\">\n        <div>This div will be rendered into the element registered above.</div>\n        <Portal>\n            <div>\n                This div will be rendered into the default\n                portal root created at document.body\n            </div>\n        </Portal>\n    </Portal>\n)\n```\n\nThere may be situations where you want to have multiple portal roots. Advanced scenarios may necessitate multiple stacking contexts for overlays. You can set up multiple roots using the `registerPortalRoot` function. Calling this function with an element and a string `name` will register the root, which can then be used by creating a `<Portal>` with a `name` prop matching the one you registered.\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: null,\n    adaptsToScreenSizes: null,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Portal"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ProgressBar.mdx","frontmatter":{"title":"ProgressBar"},"rawBody":"---\ntitle: ProgressBar\ncomponentId: progress_bar\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/ProgressBar.tsx\n---\n\nimport data from '../../src/ProgressBar/ProgressBar.docs.json'\n\n```js\nimport {ProgressBar} from '@primer/react'\n```\n\n## Examples\n\n```jsx live\n<ProgressBar progress={80} />\n```\n\n### Inline\n\nIf you'd like to use ProgressBar inline, pass the `inline` boolean prop & **be sure to set a width**.\n\n```jsx live\n<>\n  <Text mr={3}>5 of 10</Text>\n  <ProgressBar progress={50} inline sx={{width: '100px'}} />\n</>\n```\n\n### Multiple Segments\n\nIf you want to show multiple segments in a ProgressBar, pass separate `Item`s as children **instead** of a `progress` value.\n\n```jsx live\n<>\n  <ProgressBar>\n    <ProgressBar.Item progress={33} />\n    <ProgressBar.Item progress={33} sx={{backgroundColor: 'danger.emphasis'}} />\n  </ProgressBar>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"ProgressBar"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Radio.mdx","frontmatter":{"title":"Radio"},"rawBody":"---\ncomponentId: radio\ntitle: Radio\ndescription: Use radios when a user needs to select one option from a list\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Radio.tsx\nstorybook: '/react/storybook?path=/story/components-forms-radiogroup'\n---\n\nimport data from '../../src/Radio/Radio.docs.json'\n\n## Examples\n\n<Note variant=\"warning\">\n\n**Use [FormControl](/FormControl) to render a standard radio input field.** This component is only meant to be used in the case that you're building a custom radio that is not yet supported by Primer (For example: the color mode selection in [Appearance settings](https://github.com/settings/appearance))\n\nIf you do use this component to build a custom radio, it should always be accompanied by a corresponding `<label>` to improve support for assistive technologies.\n\n</Note>\n\n```jsx live\n<>\n  <Radio value=\"one\" name=\"radio-group-name\" />\n  <Radio value=\"two\" name=\"radio-group-name\" />\n  <Radio disabled value=\"three\" name=\"radio-group-name\" />\n</>\n```\n\n<Note>\n\nPlease use a [Checkbox](/Checkbox) if the user needs to select more than one option in a list\n\n</Note>\n\n### Grouping Radio components\n\nUse the `name` prop to group together related `Radio` components in a list.\n\nIf you're not building something custom, you should use the [RadioGroup](/RadioGroup) component to render a group of radio inputs.\n\n#### Using `RadioGroup`\n\n```jsx live\n<form>\n  <RadioGroup name=\"radioGroup-example\">\n    <RadioGroup.Label>Choices</RadioGroup.Label>\n    <FormControl>\n      <Radio value=\"1\" />\n      <FormControl.Label>Radio 1</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"2\" />\n      <FormControl.Label>Radio 2</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"3\" />\n      <FormControl.Label>Radio 3</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"4\" />\n      <FormControl.Label>Radio 4</FormControl.Label>\n    </FormControl>\n  </RadioGroup>\n</form>\n```\n\n#### Using `name` to group Radio components\n\n```jsx live\n<form>\n  <FormControl>\n    <Radio value=\"1\" name=\"radio-example\" />\n    <FormControl.Label>Radio 1</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"2\" name=\"radio-example\" />\n    <FormControl.Label>Radio 2</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"3\" name=\"radio-example\" />\n    <FormControl.Label>Radio 3</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"4\" name=\"radio-example\" />\n    <FormControl.Label>Radio 4</FormControl.Label>\n  </FormControl>\n</form>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Radio"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/RadioGroup.mdx","frontmatter":{"title":"RadioGroup"},"rawBody":"---\ntitle: RadioGroup\ncomponentId: radio_group\ndescription: Renders a set of radio inputs to let users make a single selection from a short list of options\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/RadioGroup/RadioGroup.tsx\nstorybook: '/react/storybook/?path=/story/components-forms-radiogroup-examples'\n---\n\nimport data from '../../src/RadioGroup/RadioGroup.docs.json'\n\nimport {RadioGroup, Radio, Box} from '@primer/components'\nimport {CheckIcon, XIcon, AlertIcon} from '@primer/octicons-react'\n\n## Examples\n\n### Basic\n\n```jsx live\n<Box display=\"grid\" sx={{gap: 3}}>\n  <RadioGroup name=\"choiceGroup\">\n    <RadioGroup.Label>Choices</RadioGroup.Label>\n    <FormControl>\n      <Radio value=\"one\" />\n      <FormControl.Label>Choice one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"two\" />\n      <FormControl.Label>Choice two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"three\" />\n      <FormControl.Label>Choice three</FormControl.Label>\n    </FormControl>\n  </RadioGroup>\n</Box>\n```\n\n### Using onChange handlers\n\n```javascript live noinline\nconst WithOnChangeHandlers = () => {\n  const [selectedRadioValue, setSelectedCheckboxValues] = React.useState('two')\n  const [selectedRadioId, setSelectedRadioId] = React.useState()\n\n  const handleRadioGroupChange = (selectedValue, e) => {\n    setSelectedCheckboxValues(selectedValue)\n    setSelectedRadioId(e.currentTarget.id)\n  }\n\n  const handleChoiceOneChange = e => {\n    alert('Choice one has its own handler')\n  }\n\n  return (\n    <Box display=\"grid\" sx={{gap: 1}}>\n      <RadioGroup name=\"choiceGroup\" onChange={handleRadioGroupChange}>\n        <RadioGroup.Label>Choices</RadioGroup.Label>\n        <FormControl>\n          <Radio value=\"one\" onChange={handleChoiceOneChange} />\n          <FormControl.Label>Choice one</FormControl.Label>\n        </FormControl>\n        <FormControl>\n          <Radio value=\"two\" defaultChecked />\n          <FormControl.Label>Choice two</FormControl.Label>\n        </FormControl>\n        <FormControl>\n          <Radio value=\"three\" />\n          <FormControl.Label>Choice three</FormControl.Label>\n        </FormControl>\n      </RadioGroup>\n\n      {selectedRadioValue && <div>The selected radio value is {selectedRadioValue}</div>}\n      {selectedRadioId && <div>The last selected radio ID is {selectedRadioId}</div>}\n    </Box>\n  )\n}\n\nrender(<WithOnChangeHandlers />)\n```\n\n### Disabled\n\n```jsx live\n<RadioGroup disabled name=\"choiceGroup\">\n  <RadioGroup.Label>Choices</RadioGroup.Label>\n  <FormControl>\n    <Radio value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</RadioGroup>\n```\n\n### Required\n\n```jsx live\n<RadioGroup required name=\"choiceGroup\">\n  <RadioGroup.Label>Choices</RadioGroup.Label>\n  <FormControl>\n    <Radio value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</RadioGroup>\n```\n\n### With validation\n\n```jsx live\n<RadioGroup name=\"choiceGroup\">\n  <RadioGroup.Label>Choices</RadioGroup.Label>\n  <FormControl>\n    <Radio value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n  <RadioGroup.Validation variant=\"error\">Your choices are wrong</RadioGroup.Validation>\n</RadioGroup>\n```\n\n### With caption\n\n```jsx live\n<RadioGroup name=\"choiceGroup\">\n  <RadioGroup.Label>Choices</RadioGroup.Label>\n  <RadioGroup.Caption>You can pick any of these choices</RadioGroup.Caption>\n  <FormControl>\n    <Radio value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</RadioGroup>\n```\n\n### A visually hidden label\n\n```jsx live\n<RadioGroup name=\"choiceGroup\">\n  <RadioGroup.Label visuallyHidden>Choices</RadioGroup.Label>\n  <FormControl>\n    <Radio value=\"one\" />\n    <FormControl.Label>Choice one</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"two\" />\n    <FormControl.Label>Choice two</FormControl.Label>\n  </FormControl>\n  <FormControl>\n    <Radio value=\"three\" />\n    <FormControl.Label>Choice three</FormControl.Label>\n  </FormControl>\n</RadioGroup>\n```\n\n### With an external label\n\n```jsx live\n<>\n  <Box\n    id=\"choiceHeading\"\n    borderBottomWidth=\"1px\"\n    borderBottomStyle=\"solid\"\n    borderBottomColor=\"border.default\"\n    pb={2}\n    mb={3}\n    fontSize={3}\n  >\n    Choices\n  </Box>\n  <RadioGroup aria-labelledby=\"choiceHeading\" name=\"choiceGroup\">\n    <FormControl>\n      <Radio value=\"one\" />\n      <FormControl.Label>Choice one</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"two\" />\n      <FormControl.Label>Choice two</FormControl.Label>\n    </FormControl>\n    <FormControl>\n      <Radio value=\"three\" />\n      <FormControl.Label>Choice three</FormControl.Label>\n    </FormControl>\n  </RadioGroup>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"RadioGroup"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/RelativeTime.mdx","frontmatter":{"title":"RelativeTime"},"rawBody":"---\ncomponentId: relative-time\ntitle: RelativeTime\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/RelativeTime.tsx\n---\n\nimport data from '../../src/RelativeTime/RelativeTime.docs.json'\n\n```js\nimport {RelativeTime} from '@primer/react'\n```\n\nFormats a timestamp as a localized string or as relative text that auto-updates in the user's browser.\n\n## Examples\n\n### Default\n\n```jsx live\n<>\n  <RelativeTime datetime=\"2014-04-01T16:30:00-08:00\" />\n  <br />\n  <RelativeTime date={new Date('2014-04-01T16:30:00-08:00')} format=\"micro\" tense=\"past\" />\n  <br />\n  <RelativeTime datetime=\"2014-04-01T16:30:00-08:00\" format=\"elapsed\" />\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: true,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"RelativeTime"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/SegmentedControl.mdx","frontmatter":{"title":"SegmentedControl"},"rawBody":"---\ncomponentId: segmented_control\ntitle: SegmentedControl\ndescription: Use a segmented control to let users select an option from a short list and immediately apply the selection\nstatus: Alpha\nsource: https://github.com/primer/react/tree/main/src/SegmentedControl\nstorybook: '/react/storybook/?path=/story/components-segmentedcontrol'\n---\n\nimport data from '../../src/SegmentedControl/SegmentedControl.docs.json'\n\n<Note variant=\"warning\">\n\nA `SegmentedControl` should not be used in a form as a replacement for something like a [RadioGroup](/RadioGroup) or [Select](/Select). See the [Accessibility section](https://primer.style/design/components/segmented-control#accessibility) of the SegmentedControl interface guidelines for more details.\n\n</Note>\n\n## Examples\n\n### With a label above and caption below\n\n```jsx live\n<FormControl>\n  <FormControl.Label id=\"scLabel-horiz\" as=\"span\">\n    File view\n  </FormControl.Label>\n  <SegmentedControl aria-labelledby=\"scLabel-horiz\" aria-describedby=\"scCaption-horiz\">\n    <SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>\n    <SegmentedControl.Button>Raw</SegmentedControl.Button>\n    <SegmentedControl.Button>Blame</SegmentedControl.Button>\n  </SegmentedControl>\n  <FormControl.Caption id=\"scCaption-horiz\">Change the way the file is viewed</FormControl.Caption>\n</FormControl>\n```\n\n### With a label and caption on the left\n\n```jsx live\n<Box display=\"flex\">\n  <Box flexGrow={1}>\n    <Text fontSize={2} fontWeight=\"bold\" id=\"scLabel-vert\" display=\"block\">\n      File view\n    </Text>\n    <Text color=\"fg.subtle\" fontSize={1} id=\"scCaption-vert\" display=\"block\">\n      Change the way the file is viewed\n    </Text>\n  </Box>\n  <SegmentedControl aria-labelledby=\"scLabel-vert\" aria-describedby=\"scCaption-vert\">\n    <SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>\n    <SegmentedControl.Button>Raw</SegmentedControl.Button>\n    <SegmentedControl.Button>Blame</SegmentedControl.Button>\n  </SegmentedControl>\n</Box>\n```\n\n### Controlled\n\n```javascript noinline live\nconst Controlled = () => {\n  const [selectedIndex, setSelectedIndex] = React.useState(0)\n\n  const handleSegmentChange = selectedIndex => {\n    setSelectedIndex(selectedIndex)\n  }\n\n  return (\n    <SegmentedControl aria-label=\"File view\" onChange={handleSegmentChange}>\n      <SegmentedControl.Button selected={selectedIndex === 0}>Preview</SegmentedControl.Button>\n      <SegmentedControl.Button selected={selectedIndex === 1}>Raw</SegmentedControl.Button>\n      <SegmentedControl.Button selected={selectedIndex === 2}>Blame</SegmentedControl.Button>\n    </SegmentedControl>\n  )\n}\n\nrender(Controlled)\n```\n\n### Small\n\n```jsx live\n<SegmentedControl aria-label=\"File view\" size=\"small\">\n  <SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>\n  <SegmentedControl.Button>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n### With icons and labels\n\n```jsx live\n<SegmentedControl aria-label=\"File view\">\n  <SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>\n    Preview\n  </SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={FileCodeIcon}>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={PeopleIcon}>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n### With icons only\n\n```jsx live\n<SegmentedControl aria-label=\"File view\">\n  <SegmentedControl.IconButton defaultSelected icon={EyeIcon} aria-label=\"Preview\" />\n  <SegmentedControl.IconButton icon={FileCodeIcon} aria-label=\"Raw\" />\n  <SegmentedControl.IconButton icon={PeopleIcon} aria-label=\"Blame\" />\n</SegmentedControl>\n```\n\n### With labels hidden on smaller viewports\n\n```jsx live\n<SegmentedControl aria-label=\"File view\" variant={{narrow: 'hideLabels', regular: 'default'}}>\n  <SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>\n    Preview\n  </SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={FileCodeIcon}>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={PeopleIcon}>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n### Convert to a dropdown on smaller viewports\n\n```jsx live\n<SegmentedControl aria-label=\"File view\" variant={{narrow: 'dropdown', regular: 'default'}}>\n  <SegmentedControl.Button defaultSelected leadingIcon={EyeIcon}>\n    Preview\n  </SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={FileCodeIcon}>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button leadingIcon={PeopleIcon}>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n### Fill width of parent\n\n```jsx live\n<SegmentedControl fullWidth aria-label=\"File view\">\n  <SegmentedControl.Button defaultSelected>Preview</SegmentedControl.Button>\n  <SegmentedControl.Button>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n### With something besides the first option selected\n\n```jsx live\n<SegmentedControl aria-label=\"File view\">\n  <SegmentedControl.Button>Preview</SegmentedControl.Button>\n  <SegmentedControl.Button defaultSelected>Raw</SegmentedControl.Button>\n  <SegmentedControl.Button>Blame</SegmentedControl.Button>\n</SegmentedControl>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: true,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"SegmentedControl"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Select.mdx","frontmatter":{"title":"Select"},"rawBody":"---\ncomponentId: select\ntitle: Select\ndescription: Use a select input when a user needs to select one option from a long list\nstatus: Alpha\na11yReviewed: true\nsource: https://github.com/primer/react/blob/main/src/Select.tsx\nstorybook: '/react/storybook?path=/story/components-forms-select--default'\n---\n\nimport data from '../../src/Select/Select.docs.json'\n\nimport {Select, Text} from '@primer/react'\n\n## Examples\n\n### Basic\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Preferred Primer component interface</FormControl.Label>\n  <Select>\n    <Select.Option value=\"figma\">Figma</Select.Option>\n    <Select.Option value=\"css\">Primer CSS</Select.Option>\n    <Select.Option value=\"prc\">Primer React components</Select.Option>\n    <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n  </Select>\n</FormControl>\n```\n\n### With grouped options\n\n<Note>\n\n`OptGroup` labels are not accessible to all screen readers, so they cannot convey critical information just information that improves usability.\n\n</Note>\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Preferred Primer component interface</FormControl.Label>\n  <Select>\n    <Select.OptGroup label=\"GUI\">\n      <Select.Option value=\"figma\">Figma</Select.Option>\n    </Select.OptGroup>\n    <Select.OptGroup label=\"Code\">\n      <Select.Option value=\"css\">Primer CSS</Select.Option>\n      <Select.Option value=\"prc\">Primer React components</Select.Option>\n      <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n    </Select.OptGroup>\n  </Select>\n</FormControl>\n```\n\n### With a placeholder\n\n<Note>\n  Select placeholders cannot be used in place of labels and should be used sparingly. They also should not convey\n  critical information.\n</Note>\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Preferred Primer component interface</FormControl.Label>\n  <Select placeholder=\"Pick an interface\">\n    <Select.Option value=\"figma\">Figma</Select.Option>\n    <Select.Option value=\"css\">Primer CSS</Select.Option>\n    <Select.Option value=\"prc\">Primer React components</Select.Option>\n    <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n  </Select>\n</FormControl>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Select"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/SelectPanel.mdx","frontmatter":{"title":"SelectPanel"},"rawBody":"---\ncomponentId: select_panel\ntitle: SelectPanel\nstatus: Alpha\n---\n\nimport data from '../../src/SelectPanel/SelectPanel.docs.json'\n\nA `SelectPanel` provides an anchor that will open an overlay with a list of selectable items, and a text input to filter the selectable items\n\n## Example\n\n```javascript live noinline\nfunction getColorCircle(color) {\n  return function () {\n    return (\n      <Box\n        borderWidth=\"1px\"\n        borderStyle=\"solid\"\n        bg={color}\n        borderColor={color}\n        width={14}\n        height={14}\n        borderRadius={10}\n        margin=\"auto\"\n      />\n    )\n  }\n}\n\nconst items = [\n  {leadingVisual: getColorCircle('#a2eeef'), text: 'enhancement', id: 1},\n  {leadingVisual: getColorCircle('#d73a4a'), text: 'bug', id: 2},\n  {leadingVisual: getColorCircle('#0cf478'), text: 'good first issue', id: 3},\n  {leadingVisual: getColorCircle('#ffd78e'), text: 'design', id: 4},\n  {leadingVisual: getColorCircle('#ff0000'), text: 'blocker', id: 5},\n  {leadingVisual: getColorCircle('#a4f287'), text: 'backend', id: 6},\n  {leadingVisual: getColorCircle('#8dc6fc'), text: 'frontend', id: 7},\n]\n\nfunction DemoComponent() {\n  const [selected, setSelected] = React.useState([items[0], items[1]])\n  const [filter, setFilter] = React.useState('')\n  const filteredItems = items.filter(item => item.text.toLowerCase().startsWith(filter.toLowerCase()))\n  const [open, setOpen] = React.useState(false)\n\n  return (\n    <SelectPanel\n      renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => (\n        <Button trailingAction={TriangleDownIcon} aria-labelledby={` ${ariaLabelledBy}`} {...anchorProps}>\n          {children || 'Select Labels'}\n        </Button>\n      )}\n      placeholderText=\"Filter Labels\"\n      open={open}\n      onOpenChange={setOpen}\n      items={filteredItems}\n      selected={selected}\n      onSelectedChange={setSelected}\n      onFilterChange={setFilter}\n      showItemDividers={true}\n      overlayProps={{width: 'small', height: 'xsmall'}}\n    />\n  )\n}\n\nrender(<DemoComponent />)\n```\n\n## Accessibility\n\n### Keyboard\n\nPressing `Enter` or `Space` on the `SelectPanel` anchor will\nopen the `SelectPanel` and place focus on the filter input. Pressing `Escape` or interacting with the cancel or close buttons will close the `SelectPanel` and restore focus to the anchor.\n\nA user may use `Tab` and `Shift+Tab` to navigate between the filter input, list of\nitems, action buttons, and the close button.\n\nWhen focus is on the list of items, pressing `ArrowDown` and `ArrowUp` will allow navigation between items. Support for `Home` and `End` is also provided to quickly navigate to the first and last items in the list, respectively. Pressing `Space` will select an item.\n\nThe `Enter` key may be used when focus is within the `SelectPanel` as an\nalternative to activating the save button.\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: false,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"SelectPanel"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Spinner.mdx","frontmatter":{"title":"Spinner"},"rawBody":"---\ntitle: Spinner\nstatus: Alpha\ndescription: Use spinners to let users know that content is being loaded.\ncomponentId: spinner\nsource: https://github.com/primer/react/blob/main/src/Spinner/Spinner.tsx\n---\n\nimport data from '../../src/Spinner/Spinner.docs.json'\n\n```jsx live\n<Spinner />\n```\n\n## Examples\n\n### Small\n\n```jsx live\n<Spinner size=\"small\" />\n```\n\n### Large\n\n```jsx live\n<Spinner size=\"large\" />\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Spinner"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/SplitPageLayout.mdx","frontmatter":{"title":"SplitPageLayout"},"rawBody":"---\ntitle: SplitPageLayout\ncomponentId: split_page_layout\nstatus: Alpha\ndescription: Provides structure for a split page layout, including independent scrolling for the pane and content regions. Useful for responsive list/detail patterns, when an item in the pane updates the page content on selection.\nsource: https://github.com/primer/react/tree/main/src/SplitPageLayout\nstorybook: '/react/storybook?path=/story/components-splitpagelayout--default'\na11yReviewed: true\n---\n\nimport data from '../../src/SplitPageLayout/SplitPageLayout.docs.json'\n\n```js\nimport {SplitPageLayout} from '@primer/react'\n```\n\n<Note>\n\nIf you need a more flexible layout component, consider using the [PageLayout](/PageLayout) component.\n\n</Note>\n\n## Examples\n\n### Minimal\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With overflowing pane content\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane>\n      <Box sx={{display: 'grid', gap: 3}}>\n        {Array.from({length: 5}).map((_, i) => (\n          <Box key={i} as=\"p\" sx={{margin: 0}}>\n            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam at enim id lorem tempus egestas a non ipsum.\n            Maecenas imperdiet ante quam, at varius lorem molestie vel. Sed at eros consequat, varius tellus et, auctor\n            felis. Donec pulvinar lacinia urna nec commodo. Phasellus at imperdiet risus. Donec sit amet massa purus.\n          </Box>\n        ))}\n      </Box>\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With pane hidden on narrow viewports\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane hidden={{narrow: true}}>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With content hidden on narrow viewports\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane divider={{regular: 'line', narrow: 'none'}}>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content hidden={{narrow: true}}>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With resizable pane\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane resizable>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### Without dividers\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header divider=\"none\">\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane divider=\"none\">\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer divider=\"none\">\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With pane on right\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Pane position=\"end\">\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With condensed padding\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header padding=\"condensed\">\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane padding=\"condensed\">\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content padding=\"condensed\">\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer padding=\"condensed\">\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### Without padding\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header padding=\"none\">\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane padding=\"none\">\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content padding=\"none\">\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer padding=\"none\">\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### Without header or footer\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Pane>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={480} />\n    </SplitPageLayout.Content>\n  </SplitPageLayout>\n</Box>\n```\n\n### With non-sticky pane\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <SplitPageLayout>\n    <SplitPageLayout.Header>\n      <Placeholder label=\"Header\" height={64} />\n    </SplitPageLayout.Header>\n    <SplitPageLayout.Pane sticky={false}>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n### With a custom sticky header\n\n```jsx live drafts\n<Box sx={{height: 320, overflowY: 'auto', border: '1px solid', borderColor: 'border.default'}}>\n  <Box\n    sx={{\n      position: 'sticky',\n      top: 0,\n      height: 64,\n      display: 'grid',\n      placeItems: 'center',\n      backgroundColor: 'canvas.subtle',\n      borderBottom: '1px solid',\n      borderColor: 'border.default',\n      zIndex: 1,\n    }}\n  >\n    Custom sticky header\n  </Box>\n  <SplitPageLayout>\n    <SplitPageLayout.Content>\n      <Placeholder label=\"Content\" height={420} />\n    </SplitPageLayout.Content>\n    <SplitPageLayout.Pane sticky offsetHeader={64}>\n      <Placeholder label=\"Pane\" height={120} />\n    </SplitPageLayout.Pane>\n    <SplitPageLayout.Footer>\n      <Placeholder label=\"Footer\" height={64} />\n    </SplitPageLayout.Footer>\n  </SplitPageLayout>\n</Box>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"SplitPageLayout"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/StateLabel.mdx","frontmatter":{"title":"StateLabel"},"rawBody":"---\ncomponentId: state_label\ntitle: StateLabel\nstatus: Alpha\nstorybook: '/react/storybook/?path=/story/components-statelabel--default'\nsource: https://github.com/primer/react/tree/main/src/StateLabel\n---\n\nimport data from '../../src/StateLabel/StateLabel.docs.json'\n\n## Examples\n\n```jsx live\n<>\n  <StateLabel status=\"issueOpened\">Open</StateLabel>\n  <StateLabel status=\"issueClosed\">Closed</StateLabel>\n  <StateLabel status=\"issueClosedNotPlanned\">Closed</StateLabel>\n  <StateLabel status=\"pullOpened\">Open</StateLabel>\n  <StateLabel status=\"pullClosed\">Closed</StateLabel>\n  <StateLabel status=\"pullMerged\">Merged</StateLabel>\n  <StateLabel status=\"pullQueued\">Queued</StateLabel>\n  <StateLabel status=\"draft\">Draft</StateLabel>\n  <StateLabel status=\"issueDraft\">Draft</StateLabel>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"StateLabel"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/SubNav.mdx","frontmatter":{"title":"SubNav"},"rawBody":"---\ncomponentId: sub_nav\ntitle: SubNav\nstatus: Alpha\n---\n\nimport data from '../../src/SubNav/SubNav.docs.json'\n\nUse the SubNav component for navigation on a dashboard-type interface with another set of navigation components above it. This helps distinguish navigation hierarchy.\n\nTo use SubNav with [react-router](https://github.com/ReactTraining/react-router) or\n[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass\n`as={NavLink}` and omit the `selected` prop.\nThis ensures that the NavLink gets `activeClassName='selected'`\n\n**Attention:** Make sure to properly label your `SubNav` with an `aria-label` to provide context about the type of navigation contained in `SubNav`.\n\n## Examples\n\n### Default\n\n```jsx live\n<SubNav aria-label=\"Main\">\n  <SubNav.Links>\n    <SubNav.Link href=\"#home\" selected>\n      Home\n    </SubNav.Link>\n    <SubNav.Link href=\"#documentation\">Documentation</SubNav.Link>\n    <SubNav.Link href=\"#support\">Support</SubNav.Link>\n  </SubNav.Links>\n</SubNav>\n```\n\n### SubNav with search\n\n```jsx live\n<SubNav aria-label=\"Main\">\n  <SubNav.Links>\n    <SubNav.Link href=\"#home\" selected>\n      Home\n    </SubNav.Link>\n    <SubNav.Link href=\"#documentation\">Documentation</SubNav.Link>\n    <SubNav.Link href=\"#support\">Support</SubNav.Link>\n  </SubNav.Links>\n\n  <TextInput type=\"search\" leadingVisual={SearchIcon} sx={{width: 320}} />\n</SubNav>\n```\n\n### SubNav with filtered search\n\n```jsx live\n<SubNav aria-label=\"Main\">\n  <FilteredSearch>\n    <ActionMenu>\n      <ActionMenu.Button>Filter</ActionMenu.Button>\n      <ActionMenu.Overlay>\n        <ActionList direction=\"sw\">\n          <ActionList.Item>\n            <a href=\"#\">Item 1</a>\n          </ActionList.Item>\n          <ActionList.Item>\n            <a href=\"#\">Item 2</a>\n          </ActionList.Item>\n          <ActionList.Item>\n            <a href=\"#\">Item 3</a>\n          </ActionList.Item>\n        </ActionList>\n      </ActionMenu.Overlay>\n    </ActionMenu>\n    <TextInput type=\"search\" leadingVisual={SearchIcon} width={320} />\n  </FilteredSearch>\n  <SubNav.Links>\n    <SubNav.Link href=\"#home\" selected>\n      Home\n    </SubNav.Link>\n    <SubNav.Link href=\"#documentation\">Documentation</SubNav.Link>\n    <SubNav.Link href=\"#support\">Support</SubNav.Link>\n  </SubNav.Links>\n</SubNav>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"SubNav"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/TabNav.mdx","frontmatter":{"title":"TabNav"},"rawBody":"---\ncomponentId: tab_nav\ntitle: TabNav\nstatus: Alpha\n---\n\nimport data from '../../src/TabNav/TabNav.docs.json'\n\nTo use TabNav with [react-router](https://github.com/ReactTraining/react-router) or\n[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass\n`as={NavLink}` and omit the `selected` prop.\nThis ensures that the NavLink gets `activeClassName='selected'`\n\n**Attention:** Make sure to properly label your `TabNav` with an `aria-label` to provide context about the type of navigation contained in `TabNav`.\n\n## Examples\n\n```jsx live\n<TabNav aria-label=\"Main\">\n  <TabNav.Link href=\"#home\" selected>\n    Home\n  </TabNav.Link>\n  <TabNav.Link href=\"#documentation\">Documentation</TabNav.Link>\n  <TabNav.Link href=\"#support\">Support</TabNav.Link>\n</TabNav>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"TabNav"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Text.mdx","frontmatter":{"title":"Text"},"rawBody":"---\ncomponentId: text\ntitle: Text\na11yReviewed: true\nstatus: Alpha\n---\n\nimport data from '../../src/Text/Text.docs.json'\n\nThe Text component is a wrapper component that will apply typography styles to the text inside.\n\n## Examples\n\n```jsx live\n<>\n  <Text as=\"p\" sx={{fontWeight: 'bold'}}>\n    bold\n  </Text>\n  <Text as=\"p\" sx={{color: 'danger.fg'}}>\n    danger color\n  </Text>\n  <Text as=\"p\" sx={{color: 'fg.onEmphasis', bg: 'neutral.emphasis', p: 2}}>\n    inverse colors\n  </Text>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Text"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/TextInput.mdx","frontmatter":{"title":"TextInput"},"rawBody":"---\ncomponentId: text_input\ntitle: TextInput\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/TextInput.tsx\nstorybook: '/react/storybook?path=/story/components-forms-textinput--default'\n---\n\nimport data from '../../src/TextInput/TextInput.docs.json'\n\nTextInput is a form component to add default styling to the native text input.\n\n**Note:** Don't forget to set `aria-label` to make the TextInput accessible to screen reader users.\n\n## Examples\n\n### Basic\n\n```jsx live\n<TextInput aria-label=\"Zipcode\" name=\"zipcode\" placeholder=\"Zipcode\" autoComplete=\"postal-code\" />\n```\n\n### With icons\n\n```jsx live\n<>\n  <TextInput\n    leadingVisual={SearchIcon}\n    aria-label=\"Zipcode\"\n    name=\"zipcode\"\n    placeholder=\"Zip\"\n    autoComplete=\"postal-code\"\n  />\n\n  <TextInput\n    trailingVisual={SearchIcon}\n    aria-label=\"Zipcode\"\n    name=\"zipcode\"\n    placeholder=\"Zip\"\n    autoComplete=\"postal-code\"\n  />\n</>\n```\n\n### With text visuals\n\n```jsx live\n<>\n  <TextInput leadingVisual=\"$\" aria-label=\"Cost of the thing\" name=\"cost\" placeholder=\"23.45\" />\n\n  <TextInput sx={{width: '150px'}} trailingVisual=\"minutes\" aria-label=\"Time in minutes\" name=\"time\" placeholder=\"25\" />\n</>\n```\n\n### With visuals and loading indicators\n\n```javascript live noinline\nconst WithIconAndLoadingIndicator = () => {\n  const [loading, setLoading] = React.useState(true)\n\n  const toggleLoadingState = () => {\n    setLoading(!loading)\n  }\n\n  return (\n    <>\n      <Box mb={6}>\n        <button type=\"button\" onClick={toggleLoadingState}>\n          Toggle loading state {loading ? 'off' : 'on'}\n        </button>\n      </Box>\n\n      <Text fontSize={3} mb={1} display=\"block\">\n        No visual\n      </Text>\n      <Box mb={3}>\n        <TextInput loading={loading} />\n      </Box>\n\n      <Text fontSize={3} mb={1} display=\"block\">\n        Leading visual\n      </Text>\n      <Box mb={3}>\n        <TextInput leadingVisual={SearchIcon} loading={loading} />\n      </Box>\n\n      <Text fontSize={3} mb={1} display=\"block\">\n        Trailing visual\n      </Text>\n      <Box mb={3}>\n        <TextInput trailingVisual={SearchIcon} loading={loading} />\n      </Box>\n\n      <Text fontSize={3} mb={1} display=\"block\">\n        Both visuals\n      </Text>\n      <Box mb={3}>\n        <TextInput leadingVisual={SearchIcon} trailingVisual={SearchIcon} loading={loading} />\n      </Box>\n\n      <Text fontSize={3} mb={2} display=\"block\">\n        Both visuals, position overriden\n      </Text>\n      <Box mb={3}>\n        <TextInput loaderPosition=\"trailing\" leadingVisual={SearchIcon} trailingVisual={SearchIcon} loading={loading} />\n      </Box>\n    </>\n  )\n}\n\nrender(<WithIconAndLoadingIndicator />)\n```\n\n### With trailing action\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Icon action</FormControl.Label>\n  <TextInput\n    trailingAction={\n      <TextInput.Action\n        onClick={() => {\n          alert('clear input')\n        }}\n        icon={XIcon}\n        aria-label=\"Clear input\"\n        sx={{color: 'fg.subtle'}}\n      />\n    }\n  />\n</FormControl>\n```\n\n### With tooltip direction\n\n```jsx live\n<FormControl>\n  <FormControl.Label>Icon action</FormControl.Label>\n  <TextInput\n    trailingAction={\n      <TextInput.Action\n        onClick={() => {\n          alert('clear input')\n        }}\n        icon={XIcon}\n        aria-label=\"Clear input\"\n        tooltipDirection=\"nw\"\n        sx={{color: 'fg.subtle'}}\n      />\n    }\n  />\n</FormControl>\n```\n\n### With error and warning states\n\n```jsx live\n<>\n  <TextInput\n    validationStatus=\"error\"\n    aria-label=\"Zipcode\"\n    name=\"zipcode\"\n    placeholder=\"Error\"\n    autoComplete=\"postal-code\"\n  />\n\n  <TextInput\n    validationStatus=\"warning\"\n    aria-label=\"Zipcode\"\n    name=\"zipcode\"\n    placeholder=\"Warning\"\n    autoComplete=\"postal-code\"\n  />\n</>\n```\n\n### Block text input\n\n```jsx live\n<TextInput block aria-label=\"Zipcode\" name=\"zipcode\" placeholder=\"560076\" autoComplete=\"postal-code\" />\n```\n\n### Contrast text input\n\n```jsx live\n<TextInput contrast aria-label=\"Zipcode\" name=\"zipcode\" placeholder=\"Find user\" autoComplete=\"postal-code\" />\n```\n\n### Monospace text input\n\n```jsx live\n<TextInput\n  monospace\n  aria-label=\"Personal access token\"\n  name=\"pat\"\n  leadingVisual={CheckIcon}\n  placeholder=\"github_pat_abcdefg123456789\"\n/>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"TextInput"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/TextInputWithTokens.mdx","frontmatter":{"title":"TextInputWithTokens"},"rawBody":"---\ncomponentId: text_input_with_tokens\ntitle: TextInputWithTokens\nstatus: Alpha\ndescription: Used to show multiple values in one field\nsource: https://github.com/primer/react/tree/main/src/TextInputWithTokens.tsx\nstorybook: '/react/storybook?path=/story/components-forms-textinputwithtokens--default'\n---\n\nimport data from '../../src/TextInputWithTokens/TextInputWithTokens.docs.json'\n\nimport {TextInputWithTokens} from '@primer/react'\n\nA `TextInputWithTokens` component supports all of the features of a [TextInput](/TextInput) component, but it can render a list of [Tokens](/Token) next to the area a user types in.\n\n## Examples\n\n### Basic\n\n```javascript live noinline\nconst BasicExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <FormControl>\n      <FormControl.Label>Basic example tokens</FormControl.Label>\n      <TextInputWithTokens tokens={tokens} onTokenRemove={onTokenRemove} />\n    </FormControl>\n  )\n}\n\nrender(BasicExample)\n```\n\n### Using a different token component\n\nBy default, the `Token` component is used to render the tokens in the input. If this component does not make sense for the kinds of tokens you're rendering, you can pass a component to the `tokenComponent` prop\n\n```javascript live noinline\nconst UsingIssueLabelTokens = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'enhancement', id: 1, fillColor: '#a2eeef'},\n    {text: 'bug', id: 2, fillColor: '#d73a4a'},\n    {text: 'good first issue', id: 3, fillColor: '#0cf478'},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <FormControl>\n      <FormControl.Label>Issue labels</FormControl.Label>\n      <TextInputWithTokens tokenComponent={IssueLabelToken} tokens={tokens} onTokenRemove={onTokenRemove} />\n    </FormControl>\n  )\n}\n\nrender(<UsingIssueLabelTokens />)\n```\n\n### Dealing with long lists of tokens\n\nBy default, all tokens will be visible when the component is rendered.\n\nIf the component is being used in an area where it's height needs to be constrained, there are options to limit the height of the input.\n\n```javascript live noinline\nconst VisibleTokenCountExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n    {text: 'three', id: 3},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <Box maxWidth=\"500px\">\n      <FormControl>\n        <FormControl.Label>Tokens truncated after 2</FormControl.Label>\n        <TextInputWithTokens visibleTokenCount={2} block tokens={tokens} onTokenRemove={onTokenRemove} />\n      </FormControl>\n    </Box>\n  )\n}\n\nrender(VisibleTokenCountExample)\n```\n\n### Render tokens on a single line\n\n```javascript live noinline\nconst PreventTokenWrappingExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n    {text: 'three', id: 3},\n    {text: 'four', id: 4},\n    {text: 'five', id: 5},\n    {text: 'six', id: 6},\n    {text: 'seven', id: 7},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <Box maxWidth=\"500px\">\n      <FormControl>\n        <FormControl.Label>Tokens on one line</FormControl.Label>\n        <TextInputWithTokens\n          preventTokenWrapping\n          block\n          tokens={tokens}\n          onTokenRemove={onTokenRemove}\n          id=\"inputWithTokens-basic\"\n        />\n      </FormControl>\n    </Box>\n  )\n}\n\nrender(PreventTokenWrappingExample)\n```\n\n### Set a maximum height for the input\n\n```javascript live noinline\nconst MaxHeightExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n    {text: 'three', id: 3},\n    {text: 'four', id: 4},\n    {text: 'five', id: 5},\n    {text: 'six', id: 6},\n    {text: 'seven', id: 7},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <Box maxWidth=\"500px\">\n      <FormControl>\n        <FormControl.Label>Tokens restricted to a max height</FormControl.Label>\n        <TextInputWithTokens\n          maxHeight=\"50px\"\n          block\n          tokens={tokens}\n          onTokenRemove={onTokenRemove}\n          id=\"inputWithTokens-basic\"\n        />\n      </FormControl>\n    </Box>\n  )\n}\n\nrender(MaxHeightExample)\n```\n\n### With an error validation status\n\n```javascript live noinline\nconst ErrorExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <>\n      <Box as=\"label\" display=\"block\" htmlFor=\"inputWithTokens-basic\">\n        Basic example tokens\n      </Box>\n      <TextInputWithTokens\n        tokens={tokens}\n        onTokenRemove={onTokenRemove}\n        id=\"inputWithTokens-basic\"\n        validationStatus=\"error\"\n      />\n    </>\n  )\n}\n\nrender(ErrorExample)\n```\n\n### With leading and trailing visuals\n\n```javascript live noinline\nconst LeadingVisualExample = () => {\n  const [dates, setDates] = React.useState([\n    {text: '01 Jan', id: 0},\n    {text: '01 Feb', id: 1},\n    {text: '01 Mar', id: 2},\n  ])\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n  ])\n  const onDateRemove = tokenId => {\n    setDates(dates.filter(token => token.id !== tokenId))\n  }\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <>\n      <FormControl>\n        <FormControl.Label>Dates</FormControl.Label>\n        <TextInputWithTokens leadingVisual={CalendarIcon} tokens={dates} onTokenRemove={onDateRemove} />\n      </FormControl>\n      <FormControl>\n        <FormControl.Label>Tokens</FormControl.Label>\n        <TextInputWithTokens trailingVisual={CheckIcon} tokens={tokens} onTokenRemove={onTokenRemove} />\n      </FormControl>\n    </>\n  )\n}\n\nrender(LeadingVisualExample)\n```\n\n## With visuals and loading indicators\n\n```javascript live noinline\nconst WithIconAndLoadingIndicator = () => {\n  const [dates, setDates] = React.useState([\n    {text: '01 Jan', id: 0},\n    {text: '01 Feb', id: 1},\n    {text: '01 Mar', id: 2},\n  ])\n  const onDateRemove = tokenId => {\n    setDates(dates.filter(token => token.id !== tokenId))\n  }\n\n  const [loading, setLoading] = React.useState(true)\n  const toggleLoadingState = () => {\n    setLoading(!loading)\n  }\n\n  return (\n    <>\n      <Box mb={5} display=\"flex\" justifyContent=\"flex-end\">\n        <button type=\"button\" onClick={toggleLoadingState}>\n          Toggle loading state {loading ? 'off' : 'on'}\n        </button>\n      </Box>\n\n      <h3>No visual</h3>\n      <Box mb={2}>\n        <TextInputWithTokens tokens={dates} onTokenRemove={onDateRemove} value=\"auto\" loading={loading} />\n      </Box>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          value=\"leading\"\n          loading={loading}\n          loaderPosition=\"leading\"\n        />\n      </Box>\n      <Box mb={5}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          value=\"trailing\"\n          loading={loading}\n          loaderPosition=\"trailing\"\n        />\n      </Box>\n\n      <h3>Leading visual</h3>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          leadingVisual={CalendarIcon}\n          loading={loading}\n          value=\"auto\"\n        />\n      </Box>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          leadingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"leading\"\n          value=\"leading\"\n        />\n      </Box>\n      <Box mb={5}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          leadingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"trailing\"\n          value=\"trailing\"\n        />\n      </Box>\n\n      <h3>Trailing visual</h3>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          value=\"auto\"\n        />\n      </Box>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"leading\"\n          value=\"leading\"\n        />\n      </Box>\n      <Box mb={5}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"trailing\"\n          value=\"trailing\"\n        />\n      </Box>\n\n      <h3>Both visuals</h3>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          size=\"small\"\n          leadingVisual={CalendarIcon}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          value=\"auto\"\n        />\n      </Box>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          leadingVisual={CalendarIcon}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"leading\"\n          value=\"leading\"\n        />\n      </Box>\n      <Box mb={2}>\n        <TextInputWithTokens\n          tokens={dates}\n          onTokenRemove={onDateRemove}\n          size=\"large\"\n          leadingVisual={CalendarIcon}\n          trailingVisual={CalendarIcon}\n          loading={loading}\n          loaderPosition=\"trailing\"\n          value=\"trailing\"\n        />\n      </Box>\n    </>\n  )\n}\n\nrender(<WithIconAndLoadingIndicator />)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"TextInputWithTokens"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Textarea.mdx","frontmatter":{"title":"Textarea"},"rawBody":"---\ncomponentId: textarea\ntitle: Textarea\ndescription: Use Textarea for multi-line text input form fields\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/Textarea.tsx\nstorybook: '/react/storybook?path=/story/components-forms-textarea--textarea-story'\n---\n\nimport data from '../../src/Textarea/Textarea.docs.json'\n\nimport {Textarea} from '@primer/react'\n\n<Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6, marginBottom: 3}}>\n  <Textarea />\n</Box>\n\n```js\nimport {Textarea} from '@primer/react'\n```\n\n## Examples\n\n<Note variant=\"warning\">\n\nTextarea components **must always** be accompanied by a corresponding label to improve support for assistive\ntechnologies. Examples below are provided for conciseness and may not reflect accessibility best practices.\n\nUse the [FormControl](/FormControl) component to render a Textarea with a corresponding label.\n\n</Note>\n\n### Controlled mode\n\n```javascript live noinline\nconst TextareaExample = () => {\n  // Running in controlled mode (recommended)\n  const [value, setValue] = React.useState('')\n\n  const handleChange = event => {\n    setValue(event.target.value)\n  }\n\n  return <Textarea placeholder=\"Enter a description\" onChange={handleChange} value={value} />\n}\n\nrender(<TextareaExample />)\n```\n\n### Uncontrolled mode\n\n```javascript live noinline\nconst TextareaExample = () => {\n  const ref = React.useRef()\n\n  const handleSubmit = event => {\n    event.preventDefault()\n    if (!ref.current.value) {\n      alert(`Enter a value into the Textarea and press submit`)\n      return\n    }\n\n    alert(`Current Textarea value: ${ref.current.value}`)\n  }\n\n  return (\n    <form onSubmit={handleSubmit}>\n      <Textarea\n        cols={40}\n        rows={8}\n        ref={ref}\n        defaultValue=\"Set the initial state in uncontrolled mode using the defaultValue prop\"\n      />\n      <br />\n      <Button type=\"submit\">Submit</Button>\n    </form>\n  )\n}\n\nrender(<TextareaExample />)\n```\n\n### Displaying form validation state\n\n```jsx live\n<>\n  <Box as=\"label\" htmlFor=\"success-state\" sx={{display: 'block'}}>\n    Success state:\n  </Box>\n  <Textarea id=\"success-state\" validationStatus=\"success\" />\n  <Box as=\"label\" htmlFor=\"error-state\" sx={{display: 'block', mt: 5}}>\n    Error state:\n  </Box>\n  <Textarea id=\"error-state\" validationStatus=\"error\" />\n</>\n```\n\n### Inactive\n\n```jsx live\n<>\n  <Textarea disabled>This text is inactive</Textarea>\n</>\n```\n\n### Resize\n\nBy default, `Textarea` can be resized by the user vertically and horizontally. Resizing can be prevented by setting `resize` to `none`\n\n```jsx live\n<Textarea cols={40} resize=\"none\" />\n```\n\n### Custom styling\n\n```jsx live\n<>\n  <Textarea sx={{marginBottom: 2}} />\n  <p>Custom styles like `margin` and `padding` can be applied using the `sx` prop</p>\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Textarea"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Timeline.mdx","frontmatter":{"title":"Timeline"},"rawBody":"---\ncomponentId: timeline\ntitle: Timeline\nstatus: Alpha\n---\n\nimport data from '../../src/Timeline/Timeline.docs.json'\n\nThe Timeline.Item component is used to display items on a vertical timeline, connected by Timeline.Badge elements.\n\n## Examples\n\n### Example with in-line links\n\n```jsx live\n<Timeline>\n  <Timeline.Item>\n    <Timeline.Badge>\n      <Octicon icon={FlameIcon} />\n    </Timeline.Badge>\n    <Timeline.Body>\n      <Link href=\"#\" sx={{fontWeight: 'bold', color: 'fg.default', mr: 1}} muted>\n        Monalisa\n      </Link>\n      created one <Link href=\"#\" sx={{fontWeight: 'bold', color: 'fg.default', mr: 1}} muted>\n        hot potato\n      </Link>\n      <Link href=\"#\" color=\"fg.muted\" muted>\n        Just now\n      </Link>\n    </Timeline.Body>\n  </Timeline.Item>\n</Timeline>\n```\n\n### Default Color example\n\nThe default Timeline.Badge color is dark text on a light grey background.\n\n```jsx live\n<Timeline>\n  <Timeline.Item>\n    <Timeline.Badge>\n      <Octicon icon={FlameIcon} />\n    </Timeline.Badge>\n    <Timeline.Body>Default badge color</Timeline.Body>\n  </Timeline.Item>\n</Timeline>\n```\n\n### Adding color to a Badge\n\nTo have color variants, use the `bg` prop on the `Timeline.Badge`. If an icon is being used, set the `color` prop\nof the child `Octicon` if necessary.\n\n```jsx live\n<Timeline>\n  <Timeline.Item>\n    <Timeline.Badge sx={{bg: 'danger.emphasis'}}>\n      <Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />\n    </Timeline.Badge>\n    <Timeline.Body>Background used when closed events occur</Timeline.Body>\n  </Timeline.Item>\n  <Timeline.Item>\n    <Timeline.Badge sx={{bg: 'danger.emphasis'}}>\n      <Octicon icon={FlameIcon} color=\"fg.onEmphasis\" />\n    </Timeline.Badge>\n    <Timeline.Body>Background when opened or passed events occur</Timeline.Body>\n  </Timeline.Item>\n  <Timeline.Item>\n    <Timeline.Badge sx={{bg: 'danger.emphasis'}}>\n      <Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />\n    </Timeline.Badge>\n    <Timeline.Body>Background used when pull requests are merged</Timeline.Body>\n  </Timeline.Item>\n</Timeline>\n```\n\n### Condensed items\n\nTimeline has a condensed prop that will reduce the vertical padding and remove the background from the badge item. These are most commonly used in commits. To condense a single item, remove the top or bottom padding with the `pt={0}` or `pb={0}` prop.\n\n```jsx live\n<Timeline>\n  <Timeline.Item condensed>\n    <Timeline.Badge>\n      <Octicon icon={GitCommitIcon} />\n    </Timeline.Badge>\n    <Timeline.Body>This is the message of a condensed TimelineItem</Timeline.Body>\n  </Timeline.Item>\n  <Timeline.Item condensed>\n    <Timeline.Badge>\n      <Octicon icon={GitCommitIcon} />\n    </Timeline.Badge>\n    <Timeline.Body>This is the message of a condensed TimelineItem</Timeline.Body>\n  </Timeline.Item>\n</Timeline>\n```\n\n### Timeline Break\n\nTo create a visual break in the timeline, use Timeline.Break. This adds a horizontal bar across the timeline to show that something has disrupted it. Usually this happens when a close or merged event occurs.\n\n```jsx live\n<Timeline>\n  <Timeline.Item>\n    <Timeline.Badge sx={{bg: 'danger.emphasis'}}>\n      <Octicon icon={FlameIcon} color=\"fg.onEmphasis\" />\n    </Timeline.Badge>\n    <Timeline.Body>Background used when closed events occur</Timeline.Body>\n  </Timeline.Item>\n  <Timeline.Break />\n  <Timeline.Item>\n    <Timeline.Badge sx={{bg: 'success.emphasis'}}>\n      <Octicon icon={FlameIcon} sx={{color: 'fg.onEmphasis'}} />\n    </Timeline.Badge>\n    <Timeline.Body>Background when opened or passed events occur</Timeline.Body>\n  </Timeline.Item>\n</Timeline>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Timeline"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ToggleSwitch.mdx","frontmatter":{"title":"ToggleSwitch"},"rawBody":"---\ncomponentId: toggle_switch\ntitle: ToggleSwitch\ndescription: Toggles a setting on or off, and immediately saves the change\nstatus: Alpha\nsource: https://github.com/primer/react/blob/main/src/ToggleSwitch.tsx\nstorybook: '/react/storybook?path=/story/components-toggleswitch-examples--default'\n---\n\nimport data from '../../src/ToggleSwitch/ToggleSwitch.docs.json'\n\n## Examples\n\n### Basic\n\n```jsx live\n<Box display=\"flex\" maxWidth=\"300px\">\n  <Box flexGrow={1} fontSize={2} fontWeight=\"bold\" id=\"switchLabel\">\n    Notifications\n  </Box>\n  <ToggleSwitch aria-labelledby=\"switchLabel\" />\n</Box>\n```\n\n### Uncontrolled with default value\n\n```jsx live\n<Box display=\"flex\" maxWidth=\"300px\">\n  <Box flexGrow={1} fontSize={2} fontWeight=\"bold\" id=\"switchLabel\">\n    Notifications\n  </Box>\n  <ToggleSwitch defaultChecked aria-labelledby=\"switchLabel\" />\n</Box>\n```\n\n### Controlled\n\n```javascript noinline live\nconst Controlled = () => {\n  const [isOn, setIsOn] = React.useState(false)\n\n  const onClick = () => {\n    setIsOn(!isOn)\n  }\n\n  const handleSwitchChange = on => {\n    console.log(`new switch \"on\" state: ${on}`)\n  }\n\n  return (\n    <>\n      <Box display=\"flex\" maxWidth=\"300px\">\n        <Box flexGrow={1} fontSize={2} fontWeight=\"bold\" id=\"switchLabel\">\n          Notifications\n        </Box>\n        <ToggleSwitch onClick={onClick} onChange={handleSwitchChange} checked={isOn} aria-labelledby=\"switchLabel\" />\n      </Box>\n      <p>The switch is {isOn ? 'on' : 'off'}</p>\n    </>\n  )\n}\n\nrender(Controlled)\n```\n\n### Small\n\n```jsx live\n<Box display=\"flex\" maxWidth=\"300px\">\n  <Box flexGrow={1} fontSize={1} fontWeight=\"bold\" id=\"switchLabel\">\n    Notifications\n  </Box>\n  <ToggleSwitch aria-labelledby=\"switchLabel\" size=\"small\" />\n</Box>\n```\n\n### Delayed toggle with loading state\n\n```javascript noinline live\nconst LoadingToggle = () => {\n  const [loading, setLoading] = React.useState(false)\n  const [isOn, setIsOn] = React.useState(false)\n\n  async function switchSlowly(currentOn) {\n    await new Promise(resolve => setTimeout(resolve, 1500))\n    return await !currentOn\n  }\n\n  async function onClick() {\n    setLoading(!loading)\n    const newSwitchState = await switchSlowly(isOn)\n    setIsOn(newSwitchState)\n  }\n\n  const handleSwitchChange = React.useCallback(\n    on => {\n      setLoading(false)\n    },\n    [setLoading],\n  )\n\n  return (\n    <>\n      <Box display=\"flex\" maxWidth=\"300px\">\n        <Box flexGrow={1} fontSize={2} fontWeight=\"bold\" id=\"switchLabel\">\n          Notifications\n        </Box>\n        <ToggleSwitch\n          aria-labelledby=\"switchLabel\"\n          loading={loading}\n          checked={isOn}\n          onClick={onClick}\n          onChange={handleSwitchChange}\n        />\n      </Box>\n      <p>The switch is {isOn ? 'on' : 'off'}</p>\n    </>\n  )\n}\n\nrender(LoadingToggle)\n```\n\n### Disabled\n\n```jsx live\n<Box display=\"flex\" maxWidth=\"300px\">\n  <Box flexGrow={1} fontSize={2} fontWeight=\"bold\" id=\"switchLabel\">\n    Notifications\n  </Box>\n  <ToggleSwitch aria-labelledby=\"switchLabel\" disabled />\n</Box>\n```\n\n### With associated caption text\n\n```jsx live\n<Box display=\"flex\">\n  <Box flexGrow={1}>\n    <Text fontSize={2} fontWeight=\"bold\" id=\"switchLabel\" display=\"block\">\n      Notifications\n    </Text>\n    <Text color=\"fg.subtle\" fontSize={1} id=\"switchCaption\" display=\"block\">\n      Notifications will be delivered via email and the GitHub notification center\n    </Text>\n  </Box>\n  <ToggleSwitch aria-labelledby=\"switchLabel\" aria-describedby=\"switchCaption\" />\n</Box>\n```\n\n### Left-aligned with label\n\n```jsx live\n<>\n  <Text fontSize={2} fontWeight=\"bold\" id=\"switchLabel\" display=\"block\" mb={1}>\n    Notifications\n  </Text>\n  <ToggleSwitch statusLabelPosition=\"end\" aria-labelledby=\"switchLabel\" />\n</>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"ToggleSwitch"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Token.mdx","frontmatter":{"title":"Token"},"rawBody":"---\ncomponentId: token\ntitle: Token\nstatus: Alpha\ndescription: A Token represents a piece of data. They are typically used to show a collection of related attributes.\nsource: https://github.com/primer/react/tree/main/src/Token\nstorybook: '/react/storybook?path=/story/components-token--default-token'\n---\n\nimport data from '../../src/Token/Token.docs.json'\nimport {AvatarToken, IssueLabelToken, Token} from '@primer/react'\n\nThe default `Token` can be used for most cases, but specialized token components are provided for specific use cases (see below for more info).\n\nAll types of tokens may have the same interactive qualities as links or buttons. They also have a sense of being \"selected\" and ready for user interaction such as being removed from a collection.\n\n## Examples\n\n### Basic\n\n```jsx live\n<>\n  <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n    Token\n  </Text>\n  <Token text=\"Default Token\" />\n</>\n```\n\n### Kitchen sink\n\n```jsx live\n<Box\n  display=\"flex\"\n  sx={{\n    alignItems: 'start',\n    flexDirection: 'column',\n    gap: 6,\n  }}\n>\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Resting\n    </Text>\n    <Token text=\"Default Token\" />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      isSelected\n    </Text>\n    <Token text=\"Default Token\" isSelected />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      With `leadingVisual` passed\n    </Text>\n    <Token text=\"Default Token\" leadingVisual={GitBranchIcon} />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      With `onRemove` passed\n    </Text>\n    <Token\n      text=\"Default Token\"\n      onRemove={() => {\n        console.log('remove me')\n      }}\n    />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Size options\n    </Text>\n    <Box\n      display=\"flex\"\n      sx={{\n        alignItems: 'start',\n        gap: 2,\n      }}\n    >\n      <Token size=\"small\" text=\"'small' Token\" />\n      <Token size=\"medium\" text=\"'medium' Token\" />\n      <Token size=\"large\" text=\"'large' Token (default)\" />\n      <Token size=\"xlarge\" text=\"'xlarge' Token\" />\n    </Box>\n  </div>\n</Box>\n```\n\n### With leadingVisual\n\n<Note variant=\"warning\">\n  A <InlineCode>leadingVisual</InlineCode> should not be used with the <InlineCode>small</InlineCode> size option if\n  you're rendering an icon from Octicons\n</Note>\n\n```jsx live\n<Box\n  display=\"flex\"\n  sx={{\n    alignItems: 'start',\n    flexDirection: 'column',\n    gap: 6,\n  }}\n>\n  <Token size=\"medium\" text=\"'medium' Token\" leadingVisual={GitBranchIcon} />\n  <Token size=\"large\" text=\"'large' Token (default)\" leadingVisual={GitBranchIcon} />\n  <Token size=\"xlarge\" text=\"'xlarge' Token\" leadingVisual={GitBranchIcon} />\n</Box>\n```\n\n### Interactive tokens\n\nIf any token is interactive (it is a link or a button), it will become focusable, and react to being hovered or focused on.\n\nIf a token is interactive _and_ has a remove button (appears when passing `onRemove`), the remove button should not get focus. To invoke the `onRemove` callback without using the cursor, press 'Backspace' when the token is focused.\n\nThese rules apply to all token components mentioned in this document.\n\n#### Interactive tokens with and without an `onRemove` prop\n\n```jsx live\n<Box\n  display=\"flex\"\n  sx={{\n    alignItems: 'start',\n    flexDirection: 'column',\n    gap: 6,\n  }}\n>\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Interactive\n    </Text>\n    <Box\n      display=\"flex\"\n      sx={{\n        alignItems: 'start',\n        gap: 2,\n      }}\n    >\n      <Token as=\"a\" href=\"http://google.com/\" text=\"Link\" />\n      <Token as=\"button\" onClick={() => console.log('clicked')} text=\"Button\" />\n      <Token as=\"span\" tabIndex={0} onFocus={() => console.log('focused')} text=\"Focusable Span\" />\n    </Box>\n  </div>\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Interactive with `onRemove` passed\n    </Text>\n    <Box\n      display=\"flex\"\n      sx={{\n        alignItems: 'start',\n        gap: 2,\n      }}\n    >\n      <Token\n        as=\"a\"\n        href=\"http://google.com/\"\n        text=\"Link\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <Token\n        as=\"button\"\n        onClick={() => console.log('clicked')}\n        text=\"Button\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <Token\n        as=\"span\"\n        tabIndex={0}\n        onFocus={() => console.log('focused')}\n        text=\"Focusable Span\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n    </Box>\n  </div>\n</Box>\n```\n\n### IssueLabelToken\n\nTokens that represent Issue labels should use the `IssueLabelToken` component.\n\n```jsx live\n<Box\n  display=\"flex\"\n  sx={{\n    alignItems: 'start',\n    flexDirection: 'column',\n    gap: 6,\n  }}\n>\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Resting\n    </Text>\n    <IssueLabelToken text=\"good first issue\" fillColor=\"#0366d6\" />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      isSelected\n    </Text>\n    <IssueLabelToken text=\"good first issue\" fillColor=\"#0366d6\" isSelected />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      With `onRemove` passed\n    </Text>\n    <IssueLabelToken\n      text=\"good first issue\"\n      fillColor=\"#0366d6\"\n      onRemove={() => {\n        console.log('remove me')\n      }}\n    />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Size options\n    </Text>\n    <Box\n      display=\"flex\"\n      sx={{\n        alignItems: 'start',\n        gap: 2,\n      }}\n    >\n      <IssueLabelToken\n        fillColor=\"#0366d6\"\n        size=\"small\"\n        text=\"'small' Token\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <IssueLabelToken\n        fillColor=\"#0366d6\"\n        size=\"medium\"\n        text=\"'medium' Token\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <IssueLabelToken\n        fillColor=\"#0366d6\"\n        size=\"large\"\n        text=\"'large' Token (default)\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <IssueLabelToken\n        fillColor=\"#0366d6\"\n        size=\"xlarge\"\n        text=\"'xlarge' Token\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n    </Box>\n  </div>\n</Box>\n```\n\n### AvatarToken\n\nTokens that represent GitHub users should use the `AvatarToken` component.\n\n<Note variant=\"warning\">\n  This component should not be used with the <InlineCode>small</InlineCode> or <InlineCode>medium</InlineCode> size\n  option\n</Note>\n\n```jsx live\n<Box\n  display=\"flex\"\n  sx={{\n    alignItems: 'start',\n    flexDirection: 'column',\n    gap: 6,\n  }}\n>\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Resting\n    </Text>\n    <AvatarToken avatarSrc=\"https://avatars.githubusercontent.com/mperrotti\" text=\"Default Token\" />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      isSelected\n    </Text>\n    <AvatarToken avatarSrc=\"https://avatars.githubusercontent.com/mperrotti\" text=\"Default Token\" isSelected />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      With `onRemove` passed\n    </Text>\n    <AvatarToken\n      avatarSrc=\"https://avatars.githubusercontent.com/mperrotti\"\n      text=\"Default Token\"\n      onRemove={() => {\n        console.log('remove me')\n      }}\n    />\n  </div>\n\n  <div>\n    <Text fontSize={0} display=\"block\" color=\"fg.subtle\">\n      Size options\n    </Text>\n    <Box\n      display=\"flex\"\n      sx={{\n        alignItems: 'start',\n        gap: 2,\n      }}\n    >\n      <AvatarToken\n        avatarSrc=\"https://avatars.githubusercontent.com/mperrotti\"\n        size=\"large\"\n        text=\"'large' Token (default)\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n      <AvatarToken\n        avatarSrc=\"https://avatars.githubusercontent.com/mperrotti\"\n        size=\"xlarge\"\n        text=\"'xlarge' Token\"\n        onRemove={() => {\n          console.log('remove me')\n        }}\n      />\n    </Box>\n  </div>\n</Box>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"Token"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Tooltip.mdx","frontmatter":{"title":"Tooltip"},"rawBody":"---\ncomponentId: tooltip\ntitle: Tooltip\nstatus: Alpha\n---\n\nimport data from '../../src/Tooltip.docs.json'\n\nThe Tooltip component adds a tooltip to add context to interactive elements on the page.\n\n**_⚠️ Usage warning! ⚠️_**\n\nTooltips as a UI pattern should be our last resort for conveying information because it is hidden by default and often with zero or little visual indicator of its existence.\n\nBefore adding a tooltip, please consider: Is this information essential and necessary? Can the UI be made clearer? Can the information be shown on the page by default? See [Tooltip alternatives](https://primer.style/design/accessibility/tooltip-alternatives) for more accessible alternatives.\n\n**Attention:** we use `aria-label` for tooltip contents. However, `aria-label` replaces the text content of an element in screen readers, so only use Tooltip on elements with no existing text content.\n\nA tooltip may only be used on an element that is interactive such as a button or a link. Even if an element is focusable, a tooltip may only be used if the element does something when it's clicked.\n\n## Examples\n\n```jsx live\n<Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2} p={3}>\n  <Tooltip aria-label=\"Hello, Tooltip!\">\n    <Button>Hover me</Button>\n  </Tooltip>\n</Box>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Tooltip"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/TreeView.mdx","frontmatter":{"title":"TreeView"},"rawBody":"---\ntitle: TreeView\ncomponentId: tree_view\nstatus: Beta\ndescription: A hierarchical list of items where nested items can be expanded and collapsed.\na11yReviewed: true\nsource: https://github.com/primer/react/tree/main/src/TreeView\nstorybook: '/react/storybook?path=/story/components-treeview'\n---\n\nimport data from '../../src/TreeView/TreeView.docs.json'\n\n```js\nimport {TreeView} from '@primer/react'\n```\n\n## Examples\n\n### File tree navigation without directory links\n\n```jsx live drafts\n<Box sx={{maxWidth: 400}}>\n  <nav aria-label=\"Files\">\n    <TreeView aria-label=\"Files\">\n      <TreeView.Item id=\"src\">\n        <TreeView.LeadingVisual>\n          <TreeView.DirectoryIcon />\n        </TreeView.LeadingVisual>\n        src\n        <TreeView.SubTree>\n          <TreeView.Item id=\"src/Avatar.tsx\" onSelect={() => console.log('src/Avatar.tsx')}>\n            <TreeView.LeadingVisual>\n              <FileIcon />\n            </TreeView.LeadingVisual>\n            Avatar.tsx\n            <TreeView.TrailingVisual>\n              <Octicon icon={DiffAddedIcon} color=\"success.fg\" aria-label=\"Added\" />\n            </TreeView.TrailingVisual>\n          </TreeView.Item>\n          <TreeView.Item id=\"src/Button.tsx\" current>\n            <TreeView.LeadingVisual>\n              <FileIcon />\n            </TreeView.LeadingVisual>\n            Button.tsx\n            <TreeView.TrailingVisual>\n              <Octicon icon={DiffModifiedIcon} color=\"attention.fg\" aria-label=\"Modified\" />\n            </TreeView.TrailingVisual>\n          </TreeView.Item>\n        </TreeView.SubTree>\n      </TreeView.Item>\n      <TreeView.Item id=\"package.json\">\n        <TreeView.LeadingVisual>\n          <FileIcon />\n        </TreeView.LeadingVisual>\n        package.json\n        <TreeView.TrailingVisual>\n          <Octicon icon={DiffModifiedIcon} color=\"attention.fg\" aria-label=\"Modified\" />\n        </TreeView.TrailingVisual>\n      </TreeView.Item>\n    </TreeView>\n  </nav>\n</Box>\n```\n\n### File tree navigation with directory links\n\n```jsx live drafts\n<Box sx={{maxWidth: 400}}>\n  <nav aria-label=\"Files\">\n    <TreeView aria-label=\"Files\">\n      <TreeView.Item id=\"src\">\n        <TreeView.LeadingVisual>\n          <TreeView.DirectoryIcon />\n        </TreeView.LeadingVisual>\n        src\n        <TreeView.SubTree>\n          <TreeView.Item id=\"src/Avatar.tsx\">\n            <TreeView.LeadingVisual>\n              <FileIcon />\n            </TreeView.LeadingVisual>\n            Avatar.tsx\n          </TreeView.Item>\n          <TreeView.Item id=\"src/Button\" current>\n            <TreeView.LeadingVisual>\n              <TreeView.DirectoryIcon />\n            </TreeView.LeadingVisual>\n            Button\n            <TreeView.SubTree>\n              <TreeView.Item id=\"src/Button/Button.tsx\">\n                <TreeView.LeadingVisual>\n                  <FileIcon />\n                </TreeView.LeadingVisual>\n                Button.tsx\n              </TreeView.Item>\n              <TreeView.Item id=\"src/Button/Button.test.tsx\">\n                <TreeView.LeadingVisual>\n                  <FileIcon />\n                </TreeView.LeadingVisual>\n                Button.test.tsx\n              </TreeView.Item>\n            </TreeView.SubTree>\n          </TreeView.Item>\n        </TreeView.SubTree>\n      </TreeView.Item>\n      <TreeView.Item id=\"package.json\">\n        <TreeView.LeadingVisual>\n          <FileIcon />\n        </TreeView.LeadingVisual>\n        package.json\n      </TreeView.Item>\n    </TreeView>\n  </nav>\n</Box>\n```\n\n### With React Router\n\n```jsx\nimport {Link, useMatch, useResolvedPath, navigate} from 'react-router-dom'\nimport {TreeView} from '@primer/react/drafts'\n\nfunction TreeLinkItem({id, to, children}) {\n  const resolved = useResolvedPath(to)\n  const isCurrent = useMatch({path: resolved.pathname, end: true})\n  return (\n    <TreeList.Item\n      id={id}\n      aria-current={isCurrent ? 'page' : undefined}\n      current={isCurrent}\n      onSelect={() => navigate(to)}\n    >\n      {children}\n    </TreeList.Item>\n  )\n}\n\nfunction App() {\n  return (\n    <nav aria-label=\"Files\">\n      <TreeView aria-label=\"Files\">\n        <TreeLinkItem id=\"src/Avatar.tsx\" to=\"/src/Avatar.tsx\">\n          Avatar.tsx\n        </TreeLinkItem>\n        <TreeLinkItem id=\"src/Button.tsx\" to=\"/src/Button.tsx\">\n          Button.tsx\n        </TreeLinkItem>\n      </TreeView>\n    </nav>\n  )\n}\n```\n\n### With Next.js\n\nPlease note that we advise against using this pattern for website navigation because it's not the expected semantic structure for a navigation component.\n\n```jsx\nimport {useRouter} from 'next/router'\nimport Link from 'next/link'\nimport {TreeView} from '@primer/react/drafts'\n\nfunction TreeLinkItem({id, href, children}) {\n  const router = useRouter()\n  const isCurrent = typeof href === 'string' ? router.asPath === href : router.pathname === href.pathname\n  return (\n    <Link href={href} passHref>\n      <TreeView.Item id={id} aria-current={isCurrent ? 'page' : false} current={isCurrent}>\n        {children}\n      </TreeView.Item>\n    </Link>\n  )\n}\n\nfunction App() {\n  return (\n    <nav aria-label=\"Files\">\n      <TreeView aria-label=\"Files\">\n        <TreeLinkItem id=\"src/Avatar.tsx\" href=\"/src/Avatar.tsx\">\n          Avatar.tsx\n        </TreeLinkItem>\n        <TreeLinkItem\n          id=\"src/Button.tsx\"\n          // You can also pass a URL object\n          // https://nextjs.org/docs/api-reference/next/link#with-url-object\n          href={{\n            pathname: '/src/[component].[filetype]',\n            query: {component: 'Button', filetype: 'tsx'},\n          }}\n        >\n          Button.tsx\n        </TreeLinkItem>\n      </TreeView>\n    </nav>\n  )\n}\n```\n\n### With controlled expanded state\n\n```javascript live noinline drafts\nfunction ControlledTreeView() {\n  const [expanded, setExpanded] = React.useState(false)\n\n  return (\n    <Box sx={{display: 'grid', gap: 2, maxWidth: 400}}>\n      <Button onClick={() => setExpanded(!expanded)}>{expanded ? 'Collapse' : 'Expand'}</Button>\n      <nav aria-label=\"Files\">\n        <TreeView aria-label=\"Files\">\n          <TreeView.Item id=\"src\" expanded={expanded} onExpandedChange={setExpanded}>\n            src\n            <TreeView.SubTree>\n              <TreeView.Item id=\"src/Avatar.tsx\">Avatar.tsx</TreeView.Item>\n              <TreeView.Item id=\"src/Button.tsx\" current>\n                Button.tsx\n              </TreeView.Item>\n            </TreeView.SubTree>\n          </TreeView.Item>\n        </TreeView>\n      </nav>\n    </Box>\n  )\n}\n\nrender(<ControlledTreeView />)\n```\n\n### With stateful visuals\n\nTo render stateful visuals, pass a render function to `TreeView.LeadingVisual` or `TreeView.TrailingVisual`. The function will be called with the `expanded` state of the item.\n\n```jsx live drafts\n<Box sx={{maxWidth: 400}}>\n  <nav aria-label=\"Files\">\n    <TreeView aria-label=\"Files\">\n      <TreeView.Item id=\"src\">\n        <TreeView.LeadingVisual>\n          {({isExpanded}) => (isExpanded ? <FileDirectoryOpenFillIcon /> : <FileDirectoryFillIcon />)}\n        </TreeView.LeadingVisual>\n        src\n        <TreeView.SubTree>\n          <TreeView.Item id=\"src/Avatar.tsx\">Avatar.tsx</TreeView.Item>\n          <TreeView.Item id=\"src/Button.tsx\" current>\n            Button.tsx\n          </TreeView.Item>\n        </TreeView.SubTree>\n      </TreeView.Item>\n    </TreeView>\n  </nav>\n</Box>\n```\n\nSince stateful directory icons are a common use case for TreeView, we provide a `TreeView.DirectoryIcon` component for convenience. The previous example can be rewritten as:\n\n```jsx live drafts\n<Box sx={{maxWidth: 400}}>\n  <nav aria-label=\"Files\">\n    <TreeView aria-label=\"Files\">\n      <TreeView.Item id=\"src\">\n        <TreeView.LeadingVisual>\n          <TreeView.DirectoryIcon />\n        </TreeView.LeadingVisual>\n        src\n        <TreeView.SubTree>\n          <TreeView.Item id=\"src/Avatar.tsx\">Avatar.tsx</TreeView.Item>\n          <TreeView.Item id=\"src/Button.tsx\" current>\n            Button.tsx\n          </TreeView.Item>\n        </TreeView.SubTree>\n      </TreeView.Item>\n    </TreeView>\n  </nav>\n</Box>\n```\n\n### With asynchronously loaded items\n\nSee [Storybook](https://primer.style/react/storybook?path=/story/components-treeview--async-success) for examples with asynchronously loaded items.\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    visualRegressionCoverage: true,\n    noAxeViolations: true,\n    usedInProduction: true,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: true,\n    a11yReviewed: true,\n    noPerfRegression: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"","name":"TreeView"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/Truncate.mdx","frontmatter":{"title":"Truncate"},"rawBody":"---\ncomponentId: truncate\ntitle: Truncate\nstatus: Alpha\n---\n\nimport data from '../../src/Truncate/Truncate.docs.json'\n\nThe Truncate component will shorten text with an ellipsis. Always add a `title` attribute to the truncated element so the full text remains accessible.\n\n## Examples\n\n### Default\n\nTruncate will prevent text that overflows from wrapping. The default max-width is 125px.\n\n```jsx live\n<Truncate title=\"Some text with a branch-name-that-is-really-long\">\n  Some text with a branch-name-that-is-really-long\n</Truncate>\n```\n\n### Custom max-width\n\nYou can override the maximum width of the truncated text with the `maxWidth` prop.\n\n```jsx live\n<Truncate maxWidth={250} title=\"Some text with a branch-name-that-is-really-long\">\n  Some text with a branch-name-that-is-really-long\n</Truncate>\n```\n\n### Inline\n\nYou can use the `inline` boolean prop for inline (or inline-block) elements with a fixed maximum width (default: 125px).\n\n```jsx live\n<Truncate as=\"strong\" inline title=\"branch-name-that-is-really-long\">\n  Some text with a branch-name-that-is-really-long\n</Truncate>\n```\n\n### Expandable\n\nYou can use the `expandable` boolean prop to display the truncated text on hover.\n\n```jsx live\n<Truncate expandable title=\"Some text with a branch-name-that-is-really-long\">\n  Some text with a branch-name-that-is-really-long\n</Truncate>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"Truncate"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/UnderlineNav.mdx","frontmatter":{"title":"UnderlineNav"},"rawBody":"---\ncomponentId: underline_nav\ntitle: UnderlineNav\nstatus: Alpha\n---\n\nimport data from '../../src/UnderlineNav/UnderlineNav.docs.json'\n\nUse the UnderlineNav component to style navigation with a minimal underlined selected state, typically used for navigation placed at the top of the page.\n\n## Deprecation\n\nUnderlineNav is deprecated and will be replaced by the draft `UnderlineNav` in the next major release. See [the draft UnderlineNav's docs](/drafts/UnderlineNav2) for more details.\n\nTo use UnderlineNav with [react-router](https://github.com/ReactTraining/react-router) or\n[react-router-dom](https://www.npmjs.com/package/react-router-dom), pass\n`as={NavLink}` and omit the `selected` prop.\nThis ensures that the NavLink gets `activeClassName='selected'`\n\n**Attention:** Make sure to properly label your `UnderlineNav` with an `aria-label` to provide context about the type of navigation contained in `UnderlineNav`.\n\n## Examples\n\n```jsx live\n<UnderlineNav aria-label=\"Main\">\n  <UnderlineNav.Link href=\"#home\" selected>\n    Home\n  </UnderlineNav.Link>\n  <UnderlineNav.Link href=\"#documentation\">Documentation</UnderlineNav.Link>\n  <UnderlineNav.Link href=\"#support\">Support</UnderlineNav.Link>\n</UnderlineNav>\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"","name":"UnderlineNav"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/anchoredPosition.mdx","frontmatter":{"title":"Anchored Position Behavior"},"rawBody":"---\ntitle: Anchored Position Behavior\n---\n\nThe `getAnchoredPosition` behavior and `useAnchoredPosition` hook are used to calculate the position of a \"floating\" element that is anchored to another DOM element. This is useful for implementing overlay UI, such as dialogs, popovers, tooltips, toasts, and dropdown-style menus.\n\nAt a high level, the `getAnchoredPosition` algorithm will attempt to find the most suitable position for the floating element based on the passed-in settings, its containing element, and the size and position of the anchor element. Specifically, the calculated position should try to ensure that the floating element, when positioned at the calculated coordinates, does not overflow or underflow the container's bounding box.\n\nSettings for this behavior allow the user to customize several aspects of this calculation. See **PositionSettings** below for a detailed description of these settings.\n\n### Positioning algorithm\n\nWhen calculating the position of the floating element, the algorithm relies on different measurements from three separate elements:\n\n1. The floating element's width and height\n2. The anchor element's x/y position and its width and height\n3. The floating element's clipping container (for x/y position, width and height, and border sizes)\n\nThe public API only asks for the first two elements; the floating element's container is discovered via DOM traversal.\n\n#### Finding the floating element's clipping container\n\nThe returned anchored position calculation is relative to the floating element's closest [_positioned_](https://developer.mozilla.org/en-US/docs/Web/CSS/position#types_of_positioning) ancestor. To find this ancestor, we try to check parents of the floating element until we find one that has a position set to anything other than `static` and use that element's bounding box as the container. If we can't find such an element, we will try to use `document.body`.\n\nOnce we have found the appropriate relative ancestor, we attempt to find the floating element's _clipping container_. The clipping container is an element that: 1) has `overflow` set to something other than `visible`, and 2) is either an ancestor of the relative ancestor, or is itself the relative ancestor. Again, if we cannot locate such an element, we will use `document.body` as the clipping container.\n\nOnce we have the clipping container, its bounding box is used as the viewport for the position calculation (see the next section). If the clipping container ends up being `document.body`, we take one additional step, allowing the clipping rectangle to be at least as tall as the window. This is done because the `body` element doesn't take up the full window size by default, but we still want to allow the entire space to be used as the viewport for the position calculation. It may be a good idea to ensure that this clipping container element _also_ contains the anchor element and is scrollable. This will ensure that if scrolled, the anchor and floating element will move together.\n\n#### Positioning and overflow\n\nWith the positions and sizes of the above DOM elements, the algorithm calculates the (x, y) coordinate for the floating element. Then, it checks to see if, based on the floating element's size, if it would overflow the bounds of the container. If it would, it does one of two things:\n\nA) If the overflow happens in the same direction as the anchor side (e.g. side is `'outside-bottom'` and the overflowing portion of the floating element is the bottom), try to find a different side, recalculate the position, and check for overflow again. If we check all four sides and don't find one that fits, revert to the bottom side, in hopes that a scrollbar might appear.\nB) Otherwise, adjust the alignment offset so that the floating element can stay inside the container's bounds.\n\nFor a more in-depth explanation of the positioning settings, see `PositionSettings` below.\n\n### Demo\n\nDeploy Storybook to see a live demo of `anchoredPosition`.\n\n### Usage\n\n```ts\nconst settings = {\n  side: 'outside-right',\n  align: 'center',\n  alignmentOffset: 10,\n  anchorOffset: -10,\n} as Partial<PositionSettings>\nconst float = document.getElementById('floatingElement')\nconst anchor = document.getElementById('anchorElement')\nconst {top, left} = getAnchoredPosition(float, anchor, settings)\nfloat.style.top = `${top}px`\nfloat.style.left = `${left}px`\n```\n\n### API\n\nThe `getAnchoredPosition` function takes the following arguments.\n\n| Name            | Type               | Default | Description                                                                                                                                                                            |\n| :-------------- | :----------------- | :-----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| floatingElement | `Element`          |         | This is an Element that is currently rendered on the page. `getAnchoredPosition` needs to be able to measure this element's `width` and `height`.                                      |\n| anchorElement   | `Element`          |         | This is an Element that the floating element will be \"anchored\" to. In other words, the calculated position of the floating element will be based on this element's position and size. |\n| settings        | `PositionSettings` |  `{}`   | Settings to customize the positioning algorithm. See below for a description of each setting.                                                                                          |\n\n#### PositionSettings interface\n\n`PositionSettings` is an object with the following interface\n\n| Name             | Type              |      Default       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |\n| :--------------- | :---------------- | :----------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| side             | `AnchorSide`      | `\"outside-bottom\"` | Sets the side of the anchor element that the floating element should be pinned to. This side is given by a string starting with either `inside` or `outside`, followed by a hyphen, followed by either `top`, `right`, `bottom`, or `left`. Additionally, `\"inside-center\"` is an allowed value.<br /><br />The first part of this string, `inside` or `outside`, determines whether the floating element should be attempted to be placed \"inside\" the anchor element or \"outside\" of it. Using `inside` is useful for making it appear that the anchor _contains_ the floating element, and it can be used for implementing a dialog that is centered on the screen. The `outside` value is more common and can be used for tooltips, popovers, menus, etc.<br /><br />The second part of this string determines the _edge_ on the anchor element that the floating element will be anchored to. If side is `\"inside-center\"`, then the floating element will be centered in the X-direction (while `align` is used to position it in the Y-direction). |\n| align            | `AnchorAlignment` |     `\"start\"`      | Determines how the floating element should align with the anchor element. If set to `\"start\"`, the floating element's first edge (top or left) will align with the anchor element's first edge. If set to `\"center\"`, the floating element will be centered along the axis of the anchor edge. If set to `\"end\"`, the floating element's last edge will align with the anchor element's last edge.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n| anchorOffset     | `number`          |       `4`\\*        | The number of pixels between the anchor edge and the floating element. Positive values move the floating element farther from the anchor element (for outside positioning) or further inside the anchor element (for inside positioning). Negative values have the opposite effect.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |\n| alignmentOffset  | `number`          |      `4`\\*\\*       | An additional offset, in pixels, to move the floating element from the aligning edge. Positive values move the floating element in the direction of center-alignment. Negative values move the floating element away from center-alignment. When align is `\"center\"`, positive offsets move the floating element right (top or bottom anchor side) or down (left or right anchor side).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |\n| allowOutOfBounds | `boolean`         |      `false`       | If false, when the above settings result in rendering the floating element wholly or partially off-screen, attempt to adjust the settings to prevent this. Only applies to `outside` positioning.<br /><br />First, attempt to flip to the opposite edge of the anchor if the floating element is getting clipped in that direction. If flipping results in a similar clipping, try moving to the adjacent sides.<br /><br />Once we find a side that does not clip the overlay in its own dimension, check the rest of the sides to see if we need to adjust the alignment offset to fit in other dimensions.<br /><br />If we try all four sides and get clipped each time, settle for overflowing and use the `bottom` side, since the ability to scroll is most likely in this direction.                                                                                                                                                                                                                                                             |\n\n\\* If `side` is set to `\"inside-center\"`, this defaults to `0` instead of `4`.\n\n\\*\\* If using outside positioning, or if `align` is set to `\"center\"`, this defaults to `0` instead of `4`.\n\n#### AnchorSide\n\n`AnchorSide` can be any of the following strings:\n\n`'inside-top'`, `'inside-bottom'`, `'inside-left'`, `'inside-right'`, `'inside-center'`, `'outside-top'`, `'outside-bottom'`, `'outside-left'`, `'outside-right'`\n\n#### AnchorAlignment\n\n`AnchorAlignment` can be any of the following strings:\n\n`'start'`, `'center'`, `'end'`\n\n### Best practices\n\nAs discussed above, the positioning algorithm needs to first measure the size of three different elements. Therefore, all three of these elements (anchor element, floating element, and the floating element's closest positioned container) must be rendered at the time `getAnchoredPosition` is called. To avoid a frame where the floating element is rendered at the `(0, 0)` position, give it a style of `visibility: hidden` until its position is returned at set. This allows the element to be measured without showing up on the page.\n\n### A note on performance\n\nEvery time `getAnchoredPosition` is called, it causes a [reflow](https://developers.google.com/speed/docs/insights/browser-reflow) because it needs to query the rendering engine for the positions of 3 elements: the anchor element, the floating element, and the closest ancestor of the floating element that is [_positioned_](https://developer.mozilla.org/en-US/docs/Web/CSS/position#types_of_positioning). Therefore, this function should not be called until it is needed (e.g. an overlay-style menu is invoked and displayed).\n\n## useAnchoredPosition hook\n\nThe `useAnchoredPosition` hook is used to provide anchored positioning data for React components. The hook returns refs that must be added to the anchor and floating elements, and a `position` object containing `top` and `left`. This position is tracked as state, so the component will re-render whenever it changes. It is the responsibility of the consumer to apply the top and left styles to the floating element in question.\n\n### Using your own refs\n\nThe `useAnchoredPosition` hook will return two refs for the anchor element and the floating element, which must be added to their respective JSX. If you would like to use your own refs, you can pass them into the hook as part of the settings object (see the interface below).\n\n### Recalculating position\n\nLike other hooks such as `useCallback` and `useEffect`, this hook takes a dependencies array. If defined, the position will only be recalculated when one of the dependencies in this array changes. Otherwise, the position will be calculated when the component is first mounted, but never again.\n\n### Usage\n\n```jsx\nexport const AnchoredPositionExample = () => {\n  const {floatingElementRef, anchorElementRef, position} = useAnchoredPosition({side: 'outside-bottom', align: 'center'})\n  return (\n    <div>\n      <Box\n        position=\"absolute\"\n        top={position?.top ?? 0}\n        left={position?.left ?? 0}\n        width={150}\n        height={150}\n        ref={floatingElementRef as React.RefObject<HTMLDivElement>}\n      >\n        Floating element\n      </Box>\n      <Box borderWidth='1px' borderStyle='solid' borderColor='border.default' borderRadius={2} width={400} height={75} ref={anchorElementRef as React.RefObject<HTMLDivElement>}>\n        Anchor Element\n      </Box>\n    </div>\n  )\n}\n```\n\n### useAnchoredPosition hook\n\n| Name         | Type                           |  Default  | Description                                                                                                          |\n| :----------- | :----------------------------- | :-------: | :------------------------------------------------------------------------------------------------------------------- |\n| settings     | `AnchoredPositionHookSettings` | undefined | Optional settings to control how the anchored position is calculated. See below.                                     |\n| dependencies | `React.DependencyList`         | undefined | Dependencies to determine when to re-calculate the position. If undefined or `[]`, only calculate the position once. |\n\n#### Return value\n\n| Name               | Type                          | Description                                        |\n| :----------------- | :---------------------------- | :------------------------------------------------- |\n| floatingElementRef | `React.RefObject<Element>`    | This ref must be added to the floating element JSX |\n| anchorElementRef   | `React.RefObject<Element>`    | This ref must be added to the anchor element JSX   |\n| position           | `{top: number, left: number}` | The calculated position                            |\n\n### AnchoredPositionHookSettings interface\n\n`AnchoredPositionHookSettings` is an object with an interface that extends `PositionSettings` (see above). Additionally, it adds the following properties:\n\n| Name               | Type                           |   Default   | Description                                                                                                                                                                                                                                                                                                                                 |\n| :----------------- | :----------------------------- | :---------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| floatingElementRef | `React.RefObject<HTMLElement>` | `undefined` | If provided, this will be the ref used to access the element that will be used for the floating element. Its size measurements are needed by the underlying `useAnchoredPosition` behavior. Otherwise, this hook will create the ref for you and return it. In both cases, the ref must be provided to the floating element's JSX.          |\n| anchorElementRef   | `React.RefObject<HTMLElement>` | `undefined` | If provided, this will be the ref used to access the element that will be used for the anchor element. Its position and size measurements are needed by the underlying `useAnchoredPosition` behavior. Otherwise, this hook will create the ref for you and return it. In both cases, the ref must be provided to the anchor element's JSX. |\n","parent":{"relativeDirectory":"","name":"anchoredPosition"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/core-concepts.md","frontmatter":{"title":"Core Concepts"},"rawBody":"---\ntitle: Core Concepts\n---\n\nThis document aims to discuss some of the core concepts of building with Primer React.\n\n## Responsive props\n\nIt's really easy to set different values for most of our component props based on screen size! We take advantage of [styled-system](https://github.com/styled-system/styled-system)'s responsive props API in our components.\n\n```\n<Button display={['flex', 'flex', 'none']}/>\n\nor\n\n<Text fontSize={[1,1,1,4]}/>\n```\n\n## Providing your own theme\n\nYou can provide your own theme to Primer React! There are a few ways of doing this to varying degrees, checkout the [theme docs](https://primer.style/components/primer-theme) for more information.\n\n## The `css` prop\n\nWhen push comes to shove and you just _really_ need to add a custom CSS rule, you can do that with the `css` prop. Please don't abuse this :)\n\n```\n<Box css='border-bottom-right-radius: 0px' />\n\n```\n\nPlease note that you will need to have the **[styled-components babel plugin](https://www.styled-components.com/docs/tooling#babel-plugin)** set up in your project in order to use the `css` prop.\n\n## Types of components\n\nWe categorize our components into 3 general types. Building block components, pattern components, and helper components. Understanding how these types of components interact with each other can help you better understand how to get the most out of Primer React.\n\n- Building Blocks\n\nBuilding block components are components that are basic in their functions and can be used together with other components to build just about any UI. Some examples of building block components are `Box`, `Avatar`, `Details`, and `Link`.\n\n- Pattern Components\n\nPattern components are components that are made up of several building block components to represent a commonly used pattern in our UI. Some examples of pattern components are `UnderlineNav` and `FilterList`. We plan on expanding our offering of pattern components in the near future.\n\n- Helper Components\n\nHelper components are components that help the user achieve common CSS patterns while maintaining some control over values used. An example of a helper component is `Box`.\n\n## The `as` prop\n\nThe `as` prop is a feature that all of our components get from [styled-components](https://www.styled-components.com). It allows you to pass a HTML tag or another component to a Primer Component to be rendered as the base tag of that component along with all of it's styles and props.\n\nFor example, say you are using a `Button` component, and you really need to apply `Box` styles to it. You can compose `Box` and `Button` like so:\n\n```.jsx\n<Box display=\"flex\" as={Button} href='https://github.com'>Hello</Box>\n```\n\nThis will allow you to use all of the `Button` props _and_ all of the `Box` props without having to wrap your `Button` component in another `Box` component.\n\n**This pattern does have some limitations.** Usage of the `as` prop can lead to unexpected output. In the example above, if the user had done `<Button as={Box}/>` instead, because the `Box`'s render method is ultimately applied, and `Box` components render `div`'s, you'll see that the rendered component is a `div` when ideally you'd like it to be a `button`. It is also not always clear how the styles in both components will interact and/or override each other.\n\nFor these reasons, **we recommend only using the `as` prop when you cannot achieve the same result by nesting components.** The `Box` / `Button` example could be done like so:\n\n```.jsx\n<Box display=\"flex\">\n  <Button href='https://github.com'>Hi</Button>\n</Box>\n```\n","parent":{"relativeDirectory":"","name":"core-concepts"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/focusTrap.mdx","frontmatter":{"title":"Focus Trap Behavior"},"rawBody":"---\ntitle: Focus Trap Behavior\n---\n\nThe `focusTrap` behavior and `useFocusTrap` hook are used prevent focus from leaving a particular element. This is useful for implementing modal dialogs: only the content within the dialog should be interactive, even though the UI underneath may still be visible.\n\n### Behavior\n\n- Activation: As soon as the focus trap is activated, it will ensure that an element within the container has focus. If it doesn't, it will focus the first focusable element within the container, or, if provided, the element indicated by the `initialFocus` parameter (see API below).\n- External focus changes: If an external cause (e.g. mouse click, scripts, or accessibility software) results in an element outside the container to be focused, focus will immediately be redirected to the last-focused element that is inside the container.\n- Circular tab focus: Using the `TAB` key on the last focusable element within the container will result in the first focusable element within the container receiving focus. Similarly, `Shift+TAB` can be used to focus the last element from the first.\n- Global: Only one focus trap can be _active_ at a time. When a focus trap is enabled, if there is already an active focus trap, it becomes suspended and pushed onto a stack. Once the newly-active focus trap is disabled, the most recently-suspended trap will reactivate. Suspended focus traps can be disabled, causing them to be removed from the stack of suspended traps.\n\n### Demo\n\nTo see a demo, deploy Storybook and find the `useFocusTrap` stories.\n\n### Usage\n\n```ts\nfunction showDialog() {\n  const dialog = document.getElementById('myDialog')\n  if (dialog instanceof HTMLElement) {\n    dialog.style.display = ''\n    return focusTrap(dialog)\n  }\n}\nfunction hideDialog(controller: AbortController) {\n  document.getElementById('myDialog')?.style.display = 'none'\n  controller.abort()\n}\nconst dialogController = showDialog()\n\n// later\nif (dialogController) {\n  hideDialog(controller)\n}\n```\n\n### API\n\nThe `focusTrap` function takes the following arguments.\n\n| Name         | Type           |   Default   | Description                                                                                                                                                  |\n| :----------- | :------------- | :---------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| container    | `HTMLElement`  |             | When active, only elements within this container (along with the container itself) can be focused.                                                           |\n| initialFocus | `HTMLElement`  |             | Specifies the element which will receive focus when the focus trap is activated. Defaults to the first tabbable element inside the container.                |\n| signal       | `AbortSignal?` | `undefined` | Optional abort signal to control the focus trap. If one is not provided, an `AbortController` will be returned, which can be used to disable the focus trap. |\n\n#### Return value\n\nIf the `signal` argument is omitted, `focusTrap()` will return an `AbortController`. This object has an `abort()` method, which can be called to disable the focus trap.\n\n### Best practices\n\n- Focus management is an important consideration for accessible applications. Sometimes poor focus management can make certain tasks impossible to complete for users not using a mouse. To learn more, read the [ARIA guidelines for keyboard focus](https://www.w3.org/TR/wai-aria-practices/#kbd_focus_discernable_predictable).\n- Only activate a focus trap if all UI outside of the trap container should be inert (non-interactive).\n- Avoid situations where multiple focus traps may be active (e.g. dialogs that open more dialogs). This behavior handles those situations, but the pattern may indicate poor UX.\n\n### A note on performance\n\nWhen focus trap is activated, it must perform [reflow](https://developers.google.com/speed/docs/insights/browser-reflow) to discover focusable elements. Use caution not to rapidly enable and disable focus traps.\n\n## useFocusTrap hook\n\nThe `useFocusTrap` hook is used to achieve focus trapping for React components. The hook returns a `ref` that must be applied to the focus trap container. The hook also returns a ref that can be used to indicate the initially-focused element when a focus trap is activated.\n\nThe focus trap can be disabled in two ways:\n\n1. Simply do not render the component. When a component that uses focus trapping is unmounted, its focus trap will be aborted automatically.\n2. Pass `disabled: true` to the settings argument of `useFocusTrap`.\n\nThe `useFocusTrap` hook also has an additional setting, `restoreFocusOnCleanUp`. If this is set to true, when the hook is either disabled (called with `disabled: true` or unmounted), we will attempt to re-focus the element that was focused immediately before the focus trap was enabled.\n\n### Using your own refs\n\nIf you would like to use your own refs, you can pass them into the hook as part of the settings object (see the interface below).\n\n### Usage\n\n```jsx\nexport const FocusTrapExample = () => {\n  const {containerRef} = useFocusTrap()\n  return (\n    <div ref={containerRef as React.RefObject<HTMLDivElement>}>\n      <Button>Apple</Button>\n      <Button>Banana</Button>\n      <Button>Cantaloupe</Button>\n    </div>\n  )\n}\n```\n\n### FocusTrapHookSettings interface\n\n`FocusTrapHookSettings` has the following properties:\n\n| Name                  | Type              |   Default   | Description                                                                                                                                                                                                                                                                  |\n| :-------------------- | :---------------- | :---------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| containerRef          | `React.RefObject` | `undefined` | If provided, this will be the ref used to access the focus trap container. Otherwise, this hook will create the ref for you and return it. In both cases, the ref must be provided to the container element's JSX.                                                           |\n| initialFocusRef       | `React.RefObject` | `undefined` | If provided, this will be the ref used to access the element that should receive initial focus when the focus trap is activated. Otherwise, this hook will create the ref for you and return it. If unused, the first tabbable element inside the container will be focused. |\n| disabled              | `boolean`         |   `false`   | If true, the previously-established focus trap for this container will be aborted.                                                                                                                                                                                           |\n| restoreFocusOnCleanUp | `boolean`         |   `false`   | If true, attempt to restore focus to the previously-focused element when the trap is disabled or unmounted.                                                                                                                                                                  |\n","parent":{"relativeDirectory":"","name":"focusTrap"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/focusZone.mdx","frontmatter":{"title":"Focus Zone Behavior"},"rawBody":"---\ntitle: Focus Zone Behavior\n---\n\nThe `focusZone` behavior and `useFocusZone` hook are used to designate a container where focus can be moved using keys other than `Tab`. This is useful for implementing many of the patterns described in [Section 6](https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard) of the WAI-ARIA Authoring Practices document. The most common use case of this behavior is to allow arrow keys (up and down or left and right) to move focus between related elements, such as items in a menu.\n\nAt a high level, the `focusZone` behavior works by adjusting the `tabindex` attribute on focusable elements and setting up event listeners on the container that respond to the relevant key presses.\n\nSettings for this behavior allow the user to customize several aspects of the focus zone. See **FocusZoneSettings** below for a detailed description of these settings.\n\n### Focusability: which elements participate in the Focus Zone?\n\nWhen the `focusZone` behavior is established, it will discover all _focusable_ elements within the given container and allow them to be focused with the bound keys. _Focusable_ elements are those that either are normally focusable via the Tab key OR have a valid `tabindex` attribute (including `\"-1\"`). The easiest way to ensure an element participates in the focus zone is by applying the attribute `tabindex=\"-1\"`. If you need to prevent a focusable element from participating in the focus zone, you can provide a `focusableElementFilter`.\n\n### Focus order\n\nThe `focusZone` behavior uses the natural DOM ordering of elements to determine focus order. This means that a key that moves focus will either move to a \"next\" element or to a \"previous\" element. For example, the left arrow key and the up arrow key would both move focus to the previous element in the DOM order, while the right arrow key and the down arrow key would both move focus to the next element in the DOM order.\n\nFocus cannot be moved beyond the last element of the container (other than using the Tab key). The `focusOutBehavior` option can be used to allow focus to wrap around from last to first element (or vice-versa).\n\nFor a more customized focus movement behavior, the consumer has the ability to supply a custom callback that identifies the next element to focus.\n\n#### Entering the focus zone\n\nBy default, when focus enters a focus zone, the element that receives focus will be the most recently-focused element within that focus zone. If no element had previously been focused, or if that previously-focused element was removed, focus will revert to the first focusable element within the focus zone, regardless of the direction of focus movement.\n\nUsing the `focusInStrategy` option, you can change this behavior. Setting this option to `\"first\"` will simply cause the first focusable element in the container to be focused whenever focus enters the focus zone. Setting it to `\"closest\"` will cause either the first or last focusable element in the container to be focused depending on the direction of focus movement (for example, a shift+tab that brings focus to the container will cause the last focusable element to be focused, whereas a regular tab would cause the first focusable element to be focused). Otherwise, you may provide a callback to choose a custom element to receive initial focus. One scenario where this would be useful is if you wanted to focus an item that is \"selected\" in a list.\n\nFor more information on choosing the right focus in behavior, see [6.6 Keyboard Navigation Inside Components](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_general_within) from the ARIA Authoring Practices document.\n\n### Supported keys\n\nThe `focusZone` behavior supports different sets of keys for moving focus around. The `bindKeys` option is used to set which of the following keys can be used to move focus.\n\n| Key(s)          | Notes                                                                                                                                                                                                                   | Use case                                                                                                                                 |\n| :-------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- |\n| ArrowVertical   | Prevents default behavior of scrolling where applicable                                                                                                                                                                 | Most focus zones with vertically-positioned elements                                                                                     |\n| ArrowHorizontal | Prevents default behavior of scrolling where applicable                                                                                                                                                                 | Most focus zones with horizontally-positioned elements                                                                                   |\n| HomeAndEnd      | Causes focus to jump to the first or last focusable item in the container. Does not move focus if the currently-focused element is a text box.                                                                          | Generally used with arrow keys                                                                                                           |\n| PageUpDown      | Works the same as the Home and End keys. Advisable only when supplying a custom callback that supports paging.                                                                                                          | In a long, scrollable list                                                                                                               |\n| Tab/Shift+Tab   | Unlike other keys, the Tab key will always allow movement outside of the focus zone (use the Focus Trap behavior to prevent this). Tab moves to the next item, Shift+Tab moves to the previous.                         | Bind Tab if you want to continue allowing tab to move focus between elements in your container rather than jumping out of the container. |\n| JK              | J moves focus to the next item, K moves to the previous. Does not move focus if the currently-focused element is a text box. [Originally from](https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys) the vi keybindings | Used in certain lists                                                                                                                    |\n| HL              | H moves focus to the previous item, L moves to the next. Does not move focus if the currently-focused element is a text box. [Originally from](https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys) the vi keybindings | Used in certain lists                                                                                                                    |\n| WS              | W moves focus to the previous item, S moves to the next. Does not move focus if the currently-focused element is a text box.                                                                                            | Any situation where it is more ergonomic for the left hand to perform this action, such as in a gaming context (rare)                    |\n| AD              | A moves focus to the previous item, D moves to the next. Does not move focus if the currently-focused element is a text box.                                                                                            | Any situation where it is more ergonomic for the left hand to perform this action, such as in a gaming context (rare)                    |\n\n### DOM Focus vs. Active Descendant\n\nThe `focusZone` behavior supports two modes of operation: DOM Focus and Active Descendant.\n\n- DOM Focus is the default mode and by far the most commonly needed. When a key is used to move focus, we call `.focus()` directly on the element to receive focus. This results in `document.activeElement` getting set to this new element, and it will receive any necessary styles via `:focus` and `:focus-within`.\n- Active Descendant mode does _not_ move DOM focus. Instead, focus remains on the _control_ element, and its `aria-activedescendant` attribute is set to the ID of the relevant element. Because there are no `:focus` styles applied and no `focus` events fired, you can supply an `onActiveDescendantChanged` callback to handle any necessary styles or other logic as the active descendant changes. For more information on the Active Descendant focus pattern, see [6.6.2 Managing Focus in Composites Using `aria-activedescendant`](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_focus_activedescendant) from the ARIA Authoring Practices document.\n\n### Demo\n\nDeploy Storybook to see live demos of `focusZone`.\n\n### Usage\n\n```ts\nconst settings = {\n  bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd,\n} as FocusZoneSettings\nconst focusZone = document.getElementById('focusZoneContainer')\nfocusZone(focusZone, settings)\n```\n\n### API\n\nThe `focusZone` function takes the following arguments.\n\n| Name      | Type                | Default | Description                                                                        |\n| :-------- | :------------------ | :-----: | :--------------------------------------------------------------------------------- |\n| container | `Element`           |         | The focus zone will apply to this container and all of its focusable descendants.  |\n| settings  | `FocusZoneSettings` |  `{}`   | Settings to customize the focus zone. See below for a description of each setting. |\n\n#### FocusZoneSettings interface\n\n`FocusZoneSettings` is an object with the following interface. All properties are optional and have default behaviors.\n\n| Name                      | Type                                          |                     Default                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| :------------------------ | :-------------------------------------------- | :----------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| bindKeys                  | `FocusKeys` (numeric enum)                    | `FocusKeys.ArrowVertical │ FocusKeys.HomeAndEnd` | Bit flags that identify keys that will move focus around the focus zone. Each available key either moves focus to the \"next\", \"previous\", \"start\", or \"end\" element, so it is best to only bind the keys that make sense to move focus in your UI. Use the `FocusKeys` object to discover supported keys (listed in the \"Supported keys\" section above). <br /><br />Use the bitwise \"OR\" operator (&#124;) to combine key types. For example, `FocusKeys.WASD │ FocusKeys.HJKL` represents all of W, A, S, D, H, J, K, and L.<br /><br />The default for this setting is `FocusKeys.ArrowVertical │ FocusKeys.HomeAndEnd`, unless `getNextFocusable` is provided, in which case `FocusKeys.ArrowAll │ FocusKeys.HomeAndEnd` is used as the default.                                                        |\n| focusOutBehavior          | `\"stop\" │ \"wrap\"`                             |                     `\"stop\"`                     | Choose the behavior applied in cases where focus is currently at either the first or last element of the container. `\"stop\"` - do nothing and keep focus where it was; `\"wrap\"` - wrap focus around to the first element from the last, or the last element from the first                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| focusInStrategy           | `\"first\" │ \"closest\" │ \"previous\" │ Function` |                   `\"previous\"`                   | This option allows customization of the behavior that determines which of the focusable elements should be focused when focus enters the container via the Tab key.<br /><br />When set to `\"first\"`, whenever focus enters the container via Tab, we will focus the first focusable element. When set to `\"previous\"`, the most recently focused element will be focused (fallback to first if there was no previous).<br /><br />The \"closest\" strategy works like \"first\", except either the first or the last element of the container will be focused, depending on the direction from which focus comes.<br /><br />If a function is provided, this function should return the `HTMLElement` intended to receive focus. This is useful if you want to focus the currently \"selected\" item or element. |\n| getNextFocusable          | `Function`                                    |                                                  | This is a callback used to customize the next element to focus when a bound key is pressed. The function takes 3 arguments: `direction` (`\"previous\"`, `\"next\"`, `\"start\"`, or `\"end\"`), `from` (Element or `undefined`), and `event` (KeyboardEvent). The function should return the next element to focus, or `undefined`. If `undefined` is returned, the regular algorithm to select the next element to focus will be used.                                                                                                                                                                                                                                                                                                                                                                            |\n| focusableElementFilter    | `Function`                                    |                                                  | This is a callback used to cull focusable elements from participating in the focus zone.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| abortSignal               | `AbortSignal`                                 |                                                  | If passed, the focus zone will be deactivated and all event listeners removed when this signal is aborted. If not passed, an `AbortSignal` will be returned by the `focusZone` function.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |\n| activeDescendantControl   | `HTMLElement`                                 |                                                  | If `activeDescendantControl` is supplied, do not move focus or alter `tabindex` on any element. Instead, manage `aria-activedescendant` according to the [ARIA best practices guidelines](https://www.w3.org/TR/wai-aria-practices-1.1/#kbd_focus_activedescendant).<br /><br />The given `activeDescendantControl` will be given an `aria-controls` attribute that references the ID of the `container`. Additionally, it will be given an `aria-activedescendant` attribute that references the ID of the currently-active descendant.<br /><br />This element will retain DOM focus as arrow keys are pressed.                                                                                                                                                                                           |\n| onActiveDescendantChanged | `Function`                                    |                                                  | This function is called each time the active descendant changes (only applicable if `activeDescendantControl` is given). The function takes two arguments: `newActiveDescendant` and `previousActiveDescendant`, both `HTMLElement`, either of which can be undefined (e.g. when an element in the container first becomes active, or when the controlling element becomes unfocused).                                                                                                                                                                                                                                                                                                                                                                                                                      |\n\n### Best practices\n\nWe highly recommend reading [Section 6: Developing a Keyboard Interface](https://www.w3.org/TR/wai-aria-practices-1.1/#keyboard) from the WAI-ARIA Authoring Practices document.\n\n## useFocusZone hook\n\nThe `useFocusZone` hook is used to provide focus zone behavior to React components. The hook returns a ref that must be added to the container element.\n\n### Using your own refs\n\nIf you would like to use your own refs, you can pass them into the hook as part of the settings object (see the interface below).\n\n### Hook dependencies\n\nLike other hooks such as `useCallback` and `useEffect`, this hook takes a dependencies array. If defined, the focus zone will be re-applied when a dependency changes (and the old one will be cleaned up).\n\n### Usage\n\n```jsx\nexport const FocusZoneExample = () => {\n  const {containerRef} = useFocusZone({bindKeys: FocusKeys.ArrowVertical | FocusKeys.HomeAndEnd})\n  return (\n    <div ref={containerRef}>\n      <button>First</button>\n      <button>Second</button>\n      <button>Third</button>\n    </div>\n  )\n}\n```\n\n### useFocusZone hook\n\n| Name         | Type                    |  Default  | Description                                                         |\n| :----------- | :---------------------- | :-------: | :------------------------------------------------------------------ |\n| settings     | `FocusZoneHookSettings` | undefined | Optional settings to control how the focus zone behaves. See below. |\n| dependencies | `React.DependencyList`  | undefined | Dependencies to determine when to initialize the focus zone.        |\n\n#### Return value\n\n| Name                       | Type                           | Description                                                                               |\n| :------------------------- | :----------------------------- | :---------------------------------------------------------------------------------------- |\n| containerRef               | `React.RefObject<HTMLElement>` | This ref must be added to the container's JSX.                                            |\n| activeDescendantControlRef | `React.RefObject<HTMLElement>` | If using active descendant focusing, this ref must be added to the control element's JSX. |\n\n### FocusZoneHookSettings interface\n\n`FocusZoneHookSettings` is an object with an interface that extends `FocusZoneSettings` (see above), however, the `activeDescendantControl` prop is omitted (instead see the `activeDescendantFocus` prop below). Additionally, it adds the following properties:\n\n| Name                  | Type                                     |   Default   | Description                                                                                                                                                                                                                                                                                                                                                   |\n| :-------------------- | :--------------------------------------- | :---------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| containerRef          | `React.RefObject`                        | `undefined` | If provided, this will be the ref used to access the element that will become the container of the focus zone. Otherwise, this hook will create the ref for you and return it. In both cases, the ref must be provided to the container's JSX.                                                                                                                |\n| activeDescendantFocus | `boolean │ React.RefObject<HTMLElement>` |   `false`   | If false, the focus zone will apply normal DOM focusing (see **DOM Focus vs. Active Descendant** above). If true, or if a ref is provided, the focus zone will use \"active descendant\" focusing. If a ref is applied, it will be used as the control element for active descendant focus. If `true` is given, a ref will be created and returned by the hook. |\n| disabled              | `boolean`                                |   `false`   | Set to true to disable the focus zone and clean up listeners. Can be re-enabled at any time.                                                                                                                                                                                                                                                                  |\n","parent":{"relativeDirectory":"","name":"focusZone"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/getting-started.md","frontmatter":{"title":"Getting started"},"rawBody":"---\ntitle: Getting started\n---\n\n## Installation\n\nTo get started using Primer React, install the package and its peer dependencies with your package manager of choice:\n\n```bash\n# with npm\nnpm install @primer/react react react-dom styled-components\n\n# with yarn\nyarn add @primer/react react react-dom styled-components\n```\n\nYou can now import Primer React from the main package module:\n\n```javascript\n// using import syntax\nimport {Box} from '@primer/react'\n```\n\n```javascript\n// using require syntax\nconst {Box} = require('@primer/react')\n```\n\n### Polyfills & Browser Support\n\nPrimer React supports the current versions of [Chrome](https://www.google.com/chrome/), [Firefox](http://www.mozilla.org/firefox/), [Safari](http://www.apple.com/safari/), and [Microsoft Edge](https://www.microsoft.com/en-us/windows/microsoft-edge), as well as the [Firefox Extended Support Release](https://www.mozilla.org/en-US/firefox/organizations/). This is in-line with [GitHub's Browser Support](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/supported-browsers).\n\nPrimer React does not transform code to support older ECMAScript versions, such as ES5, and it uses ECMAScript features such as `Object.assign`, as well as syntax features such as native classes and Object destructuring and spreading.\n\nEnvironments that Primer React is used in should have all the necessary polyfills to comply with the latest code standards, as Primer React will not ship with these. Additionally, as Primer React does not transform code to support older versions, it may be necessary for projects to transform this code if support for older browsers (such as Edge 18) is needed.\n\n### Minimizing bundle size\n\nModule bundlers that use ECMAScript modules (ESM) will automatically tree-shake Primer React, ensuring that no unused code is included in your final bundle. However, if you're not using ESM, you may be able to drastically reduce the size of your final bundle by importing components individually from the `lib` subfolder:\n\n```javascript\n// using import syntax\nimport Box from '@primer/react/lib/Box'\n```\n\n```javascript\n// using require syntax\nconst Box = require('@primer/react/lib/Box')\n```\n\nNote that the modules in the `lib` folder are CommonJS-style modules; if you're using ESM and a compatible module bundler, importing files individually from `lib` provides no benefit.\n\n### Peer dependencies\n\nPrimer React ships with a few libraries labeled as peer dependencies. These libraries are separated because they are commonly already installed in the host project and having multiple versions can introduce errors.\n\nPrimer React requires the following libraries to be installed along with it:\n\n- `styled-components` at version 4.0.0 or higher\n- `react` at versions 17.x or higher\n- `react-dom` at versions 17.x or higher\n\n## ThemeProvider\n\nFor Primer React to work correctly and accurately apply color schemes, you must add `ThemeProvider` to the root of your application:\n\n```jsx\nimport {ThemeProvider} from '@primer/react'\n\nfunction App() {\n  return (\n    <ThemeProvider>\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\nSee [Theming](/theming) for more details on advanced configuration, color modes, and overriding theme values.\n\n## BaseStyles\n\nIn order to set baseline color, font-family, and line-heights across your project, you will need to establish base Primer styles for your app by wrapping all of your Primer components in `<BaseStyles>` at the root of your app:\n\n```jsx\nimport {BaseStyles, Box, Heading} from '@primer/react'\n\nexport default () => (\n  <BaseStyles>\n    <Box m={4}>\n      <Heading sx={{mb: 2}}>Hello, world!</Heading>\n      <p>This will get Primer text styles.</p>\n    </Box>\n  </BaseStyles>\n)\n```\n\nThis will apply the same `color`, `font-family`, and `line-height` styles to the `<body>` as [Primer CSS's base styles](https://github.com/primer/css/blob/master/src/base/base.scss#L15-L20).\n\n## Static CSS rendering\n\nIf you're rendering React components both server- and client-side, we suggest following [styled-component's server-side rendering instructions](https://www.styled-components.com/docs/advanced#server-side-rendering) to avoid the flash of unstyled content for server-rendered components.\n\n## TypeScript\n\nPrimer React includes TypeScript support and ships with its own typings. You will still need to install type definitions for the peer dependencies if you import those in your own application code.\n\nOnce installed, you can import components and their prop type interfaces from the `@primer/react` package:\n\n```typescript\nimport {BorderBox, BorderBoxProps} from '@primer/react'\n```\n\n### Fixing \"Duplicate identifier 'FormData'\"\n\nEver since `@types/styled-components` version `4.1.19`, it has had a dependency on both `@types/react` and `@types/react-native`. Unfortunately, those declarations clash; for more information, see [issue 33311](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33311) and [issue 33015](https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33015) in the DefinitelyTyped repo.\n\nYou may run into this conflict even if you're not importing anything from `react-native` or don't have it installed. This is because some package managers hoist packages to the top-level `node_modules` folder, and the TypeScript compiler automatically includes types from all folders in `node_modules/@types` by default.\n\nThe TypeScript compiler allows you to opt-out of this behavior [using the `typeRoots` and `types` configuration options](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types), and the best solution for this error — for now — seems to be to opt out the automatic inclusion of `node_modules/@types` and instead list the types you want to be included individually.\n\nIn your `tsconfig.json`, set the `types` array under the `compilerOptions` like so:\n\n```json\n{\n  \"compilerOptions\": {\n    \"types\": [\"node\", \"react\", \"styled-components\", \"jest\"]\n  }\n}\n```\n\nOf course, customize the array based on the `@types/` packages you have installed for your project.\n\n## Silencing warnings\n\nLike React, Primer React emits warnings to the JavaScript console under certain conditions, like using deprecated components or props. Similar to React, you can silence these warnings by setting the `NODE_ENV` environment variable to `production` during bundling.\n\n## Testing\n\nTesting your application with Primer React is no different than testing your application with any other React library. Depending on your test environment and the testing libraries you use, you may need polyfills. For example if you are using `jest`, it runs via Node runtime and uses [JSDOM](https://github.com/jsdom/jsdom) as a DOM implementation, so you will need to mock some browser APIs. We have [helpers](https://github.com/primer/react/blob/main/src/utils/test-helpers.tsx) that you can utilize to mock some of these APIs. You can import the helpers in your test setup file like so:\n\n```js\nimport '@primer/react/lib-esm/utils/test-helpers' // For ESM\nimport '@primer/react/lib/utils/test-helpers' // For CommonJS\n```\n","parent":{"relativeDirectory":"","name":"getting-started"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/index.md","frontmatter":{"title":"Getting started"},"rawBody":"---\ntitle: Getting started\n---\n\nimport {HeroLayout} from '@primer/gatsby-theme-doctocat'\nexport default HeroLayout\n\n## Primer React\n\nPrimer React is a React implementation of GitHub's [Primer Design System](https://primer.style/) 🎉\n\n## Principles\n\n- Everything is a component.\n- Aim for total style encapsulation; don't rely on inheritance to provide default styles.\n- Build small building blocks with minimal props to keep complexity low.\n- Keep system constrained by only including props needed per component.\n- Favor wrapping or extending components for more complex operations.\n- Maintain design system consistency with utilities as props (for spacing, color, font-size, line-height, widths, and radii).\n\n## Getting started\n\nCheck out [our getting started guide](/getting-started) for everything you need to know about installing and using Primer React.\n\n## Local development\n\nTo run `@primer/react` locally when adding or updating components:\n\n1. Clone this repo: `git clone https://github.com/primer/react`\n2. Install dependencies: `npm install`\n3. Run the dev app: `npm start`\n\n> 👉 See [the contributing docs](https://github.com/primer/react/blob/main/contributor-docs/CONTRIBUTING.md) for more info on code style, testing, and coverage.\n","parent":{"relativeDirectory":"","name":"index"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/linting.md","frontmatter":{"title":"Linting"},"rawBody":"---\ntitle: Linting\ndescription: Primer React offers an ESLint plugin to enforce best practices and fix common problems.\n---\n\n<Note variant=\"warning\">\n\n`eslint-plugin-primer-react` is experimental. Please report issues in the [primer/react](https://github.com/primer/react) repository.\n\n</Note>\n\n## Installation\n\n1. Assuming you already have [ESLint](https://www.npmjs.com/package/eslint) and [Primer React](https://github.com/primer/react) installed, run:\n\n   ```shell\n   npm install --save-dev eslint-plugin-primer-react\n\n   # or\n\n   yarn add --dev eslint-plugin-primer-react\n   ```\n\n2. In your [ESLint configuration file](https://eslint.org/docs/user-guide/configuring/configuration-files), extend the recommended Primer React ESLint config:\n\n   ```json\n   {\n     \"extends\": [\n       // ...\n       \"plugin:primer-react/recommended\"\n     ]\n   }\n   ```\n\nSee the [eslint-plugin-primer-react](https://github.com/primer/eslint-plugin-primer-react) repository for a list of included lint rules.\n","parent":{"relativeDirectory":"","name":"linting"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/overriding-styles.mdx","frontmatter":{"title":"Overriding styles with the sx prop"},"rawBody":"---\ntitle: Overriding styles with the sx prop\n---\n\nOur goal with Primer React is to hit the sweet spot between providing too little and too much styling flexibility; too little and the design system is too rigid, and too much and it becomes too difficult to maintain a consistent style. Our components are designed to cover common usage patterns, but sometimes a component just isn't _quite_ flexible enough to look the way you need it to look. For those cases, we provide the `sx` prop.\n\nThe `sx` prop allows ad-hoc styling that is still theme-aware. Declare the styles you want to apply in CamelCase object notation, and try to use theme values in appropriate CSS properties when possible. If you've passed a custom theme using `ThemeProvider` or a `theme` prop, the `sx` prop will honor the custom theme. For more information on theming in Primer React, check out [the Primer Theme documentation](/primer-theme).\n\n## When to use the `sx` prop\n\nThe `sx` prop provides a lot of power, which means it is an easy tool to abuse. To best make use of it, we recommend following these guidelines:\n\n- Use the `sx` prop for small stylistic changes to components. For more substantial changes, consider abstracting your style changes into your own wrapper component.\n- Avoid nesting and pseudo-selectors in `sx` prop values when possible.\n\n## Basic example\n\nThis example demonstrates applying a bottom border to `Heading`, a component that does not receive `BORDER` system props. The `borderBottomWidth` value comes from `theme.borderWidths` and `borderBottomColor` comes from `theme.colors`.\n\n```jsx live\n<>\n  <Heading sx={{paddingBottom: 2}}>Heading</Heading>\n\n  <Heading\n    sx={{\n      paddingBottom: 2,\n      borderBottomWidth: 1,\n      borderBottomColor: 'border.default',\n      borderBottomStyle: 'solid',\n    }}\n  >\n    Heading with bottom border\n  </Heading>\n</>\n```\n\n## Responsive values\n\nJust like [values passed to system props](https://styled-system.com/responsive-styles), values in the `sx` prop can be provided as arrays to provide responsive styling.\n\n```jsx live\n<Box\n  sx={{\n    display: ['flex', 'flex', 'block', 'block'],\n    borderRadius: 2,\n    padding: 2,\n  }}\n>\n  Responsive background color\n</Box>\n```\n\n## Nesting, pseudo-classes, and pseudo-elements\n\nThe `sx` prop also allows for declaring styles based on media queries, pseudo-classes, and pseudo-elements. This example, though contrived, demonstrates the ability:\n\n```jsx live\n<Box\n  sx={{\n    '> *': {\n      borderWidth: 1,\n      borderColor: 'border.default',\n      borderStyle: 'solid',\n      borderBottomWidth: 0,\n      padding: 2,\n      ':last-child': {\n        borderBottomWidth: 1,\n      },\n      ':hover': {\n        bg: 'neutral.muted',\n      },\n    },\n  }}\n>\n  <Box>First</Box>\n  <Box>Second</Box>\n  <Box>Third</Box>\n</Box>\n```\n\n## Value reference\n\n- For a reference of possible values for this prop, see the [Styled System reference table](https://github.com/styled-system/styled-system/blob/master/docs/table.md).\n","parent":{"relativeDirectory":"","name":"overriding-styles"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/philosophy.md","frontmatter":{"title":"Primer React Philosophy"},"rawBody":"---\ntitle: Primer React Philosophy\n---\n\n## Presentational Components\n\nWe are focusing primarily on presentational components that help standardize common design patterns. Primer React components don't handle fetching and submitting data to/from APIs. If you would like to handle data in a Primer Component, feel free to create a wrapper around the Primer Component to do so.\n\n## Assume that people will break the rules, provide safe ways for them to do so\n\nWhile we aim to standardize design in Primer React, we also provide additional styling flexibility through the [`sx` prop](/overriding-styles). This enables small customizations to color and spacing, using values from the theme. Users also have the option to override the theme with a theme of their own.\n\n## Pattern Components vs Helper Components\n\nOur components can roughly be categorized into two different component types:\n\n- Pattern Components\n\nPattern components help us repeat commonly used UI patterns and interactions in order to maintain our brand and provide a great user experience. Some examples of pattern components are `Button`, `Avatar`, or `Label`.\n\n- Helper Components\n\nHelper components are components that help the user achieve common CSS patterns while maintaining some control over values used. An example of a helper component is `Box`.\n","parent":{"relativeDirectory":"","name":"philosophy"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/primer-theme.md","frontmatter":{"title":"Primer Theme"},"rawBody":"---\ntitle: Primer Theme\n---\n\nimport {theme} from '@primer/react'\n\nPrimer React components come with built-in access to our Primer theme. The [theme file](https://github.com/primer/react/blob/main/src/theme-preval.ts) contains an object which holds values for common variables such as color, fonts, box shadows, and more. Our theme file pulls many of its color and typography values from [primer-primitives](https://github.com/primer/primer-primitives).\n\nMany of our theme keys correspond to system props on our components. For example, if you'd like to set the max width on a `<Box>` set the `maxWidth` prop to `medium`: `<Box maxWidth='medium'>`\n\nIn the background, [styled-system](https://github.com/styled-system/styled-system) does the work of finding the `medium` value from `maxWidth` key in the theme file and applying the corresponding CSS.\n\nLearn more about [our full theme](https://github.com/primer/react/blob/main/src/theme-preval.js).\n\n### Custom Theming\n\nCustom theming is an optional way to override the Primer values that control color, spacing, typography, and other aspects of our components.\n\nThere are two ways to change the theme of Primer components:\n\n1. You can override the entire theme for an entire tree of components using the `<ThemeProvider>` from [styled-components]:\n\n   ```javascript\n   import {Box, Button, Text, theme as primer} from '@primer/react'\n   import {ThemeProvider} from 'styled-components'\n\n   // a theme with custom spacing and font sizes\n   const theme = {\n     ...primer,\n     space: [0, 8, 16, 32, 64],\n     fontSizes: [10, 12, 16, 24, 48],\n   }\n\n   // override\n   theme.colors.bodytext = '#111'\n\n   export default () => (\n     <ThemeProvider theme={theme}>\n       <Box color=\"bodytext\" p={4}>\n         <Text fontSize={4}>Hello, world!</Text>\n       </Box>\n     </ThemeProvider>\n   )\n   ```\n\n   **⚠️ Note: [styled-components]'s `<ThemeProvider>` only allows exactly one child.**\n\n2. You can merge the Primer theme with your custom theme using Object.assign:\n\n   ```javascript\n   import {ThemeProvider} from 'styled-components'\n   import {theme} from '@primer/react'\n\n   const customTheme = {} // Theme overrides\n\n   const App = props => {\n     return (\n       <div>\n         {/* matching keys in customTheme will override keys in the Primer theme */}\n         <ThemeProvider theme={Object.assign({}, theme, customTheme)}>\n           <div>your app here</div>\n         </ThemeProvider>\n       </div>\n     )\n   }\n   ```\n\n3. You can theme individual components by passing the `theme` prop directly:\n\n   ```javascript\n   import {Text} from '@primer/react'\n\n   const theme = {\n     colors: {\n       magenta: '#f0f',\n     },\n   }\n\n   export default () => (\n     <Text theme={theme} color=\"magenta\">\n       Hi, I'm magenta!\n     </Text>\n   )\n   ```\n\n   **☝️ This is an intentionally convoluted example, since you can use `<Text color='#f0f'>` out of the box.**\n\nRead the [styled-system docs](https://styled-system.com/#theming) for more information on theming in styled-system.\n\n[styled-components]: https://styled-components.com/\n","parent":{"relativeDirectory":"","name":"primer-theme"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/ssr.mdx","frontmatter":{"title":"Server-side rendering with Primer React"},"rawBody":"---\ntitle: Server-side rendering with Primer React\n---\n\n## SSR-safe ID generation\n\nSome Primer components generate their own DOM IDs. Those IDs must be isomorphic (so that server-side rendering and client-side rendering yield the same ID, avoiding hydration issues) and unique across the DOM. We use [@react-aria/ssr](https://react-spectrum.adobe.com/react-aria/ssr.html) to generate those IDs. In client-only rendering, this doesn't require any additional work. In SSR contexts, you must wrap your application with at least one `SSRProvider`:\n\n```\nimport {SSRProvider} from '@primer/react';\n\nfunction App() {\n  return (\n    <SSRProvider>\n      <MyApplication />\n    </SSRProvider>\n  )\n}\n```\n\n`SSRProvider` maintains the context necessary to ensure IDs are consistent. In cases where some parts of the react tree are rendered asynchronously, you should wrap an additional `SSRProvider` around the conditionally rendered elements:\n\n```\nfunction MyApplication() {\n  const [dataA] = useAsyncData('a');\n  const [dataB] = useAsyncData('b');\n\n  return (\n    <>\n      <SSRProvider>\n        {dataA && <MyComponentA data={dataA} />}\n      </SSRProvider>\n      <SSRProvider>\n        {dataB && <MyComponentB data={dataB} />}\n      </SSRProvider>\n    </>\n  )\n}\n```\n\nThis will ensure that the IDs are consistent for any sequencing of `dataA` and `dataB` being resolved.\n\nSee also [React Aria's server side rendering documentation](https://react-spectrum.adobe.com/react-aria/ssr.html).\n","parent":{"relativeDirectory":"","name":"ssr"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/status.mdx","frontmatter":{"title":"Component status"},"rawBody":"---\ntitle: Component status\ndescription: Check the current status of Primer React components.\n---\n\nimport {ComponentStatuses} from '../src/component-statuses'\n\n<Note>\n\nSee the [component lifecycle](https://primer.style/contribute/component-lifecycle) for more information about each status.\n\n</Note>\n\n<ComponentStatuses />\n","parent":{"relativeDirectory":"","name":"status"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/system-props.mdx","frontmatter":{"title":"System Props"},"rawBody":"---\ntitle: System Props\n---\n\nimport {PropsList, COMMON, LAYOUT, BORDER, TYPOGRAPHY} from '../components'\n\n<Note variant=\"warning\">\n\nSystem props are deprecated in all components except [Box](/Box) and [Text](/Text). Please use the [`sx` prop](/overriding-styles) instead.\n\n</Note>\n\nPrimer React components utilize what we call \"system props\" to apply a standard set of props to each component. Using [styled-system](https://github.com/jxnblk/styled-system), groups of props are automatically applied to each component. Most components get the `COMMON` set of props which give the component access to color and space props (margin, padding, color and background color). These groups correspond to the `color` and `space` functions from `styled-system` which can be referenced in the styled system [table of style functions](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#core).\n\nTo check which system props each component includes, check the documentation for that component.\n\n### The `as` prop\n\nAll Primer React components have access to the `as` prop, provided by [styled-components](https://www.styled-components.com/docs/api#as-polymorphic-prop). We use the `as` prop to render a component with the styles of the passed component in `as`, but with the system props of the base component.\n\nFor example, if you wanted to add some flex utilities to the `Text` component, you could do:\n\n```jsx live deprecated\n<Text as={Flex}>Hello!</Text>\n```\n\n### System Prop Categories\n\n| Category     | Included Props                        | styled-system docs                                                                                                                                                                                            |\n| ------------ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `COMMON`     | <PropsList systemProps={COMMON}/>     | [styled-system core docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#core)                                                                                                             |\n| `TYPOGRAPHY` | <PropsList systemProps={TYPOGRAPHY}/> | [styled-system typography docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#typography)                                                                                                 |\n| `BORDER`     | <PropsList systemProps={BORDER}/>     | [styled-system border docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#border)                                                                                                         |\n| `LAYOUT`     | <PropsList systemProps={LAYOUT}/>     | [styled-system layout docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#layout) <br/> [styled-system misc docs](https://github.com/jxnblk/styled-system/blob/master/docs/table.md#misc) |\n","parent":{"relativeDirectory":"","name":"system-props"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/theme-reference.mdx","frontmatter":{"title":"Theme Reference"},"rawBody":"---\ntitle: Theme Reference\ndescription: The default theme object for Primer React components\n---\n\nimport {theme} from '@primer/react'\nimport {TreeView} from '@primer/react/drafts'\nimport ThemeReferenceTree from '../components/ThemeReferenceTree'\n\nColors in this theme object are imported from [Primer Primitives](https://primer.style/primitives/colors).\n\n<ThemeReferenceTree themeData={theme} />\n\n<Note>\n\nSee [Theming](/theming) to learn how theming works in Primer React.\n\n</Note>\n","parent":{"relativeDirectory":"","name":"theme-reference"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/theming.md","frontmatter":{"title":"Theming"},"rawBody":"---\ntitle: Theming\ndescription: Theming in Primer React is made possible by a theme object that defines your application's colors, spacing, fonts, and more.\n---\n\nimport Code from '@primer/gatsby-theme-doctocat/src/components/code'\n\n## ThemeProvider\n\nTo give components access to the theme object, you must add `ThemeProvider` to the root of your application:\n\n```jsx\nimport {ThemeProvider} from '@primer/react'\n\nfunction App() {\n  return (\n    <ThemeProvider>\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\n`ThemeProvider` comes with a [default theme object](/theme-reference) that includes colors, spacing, fonts, etc. for building applications at GitHub.\n\n## Customizing the theme\n\nTo customize the [default theme](/theme-reference), you can pass your custom theme to `ThemeProvider` using the `theme` prop:\n\n```jsx\nimport {ThemeProvider, theme} from '@primer/react'\nimport deepmerge from 'deepmerge'\n\nconst customTheme = deepmerge(theme, {\n  fonts: {\n    mono: 'MonoLisa, monospace',\n  },\n})\n\nfunction App() {\n  return (\n    <ThemeProvider theme={customTheme}>\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\nSome components may break if your custom theme does not include all the same keys as the [default theme](/theme-reference). For that reason, we recommend extending the default theme using [deepmerge](https://www.npmjs.com/package/deepmerge).\n\n## Referencing theme values\n\nYou can reference theme values in your application using the [`sx` prop](/overriding-styles), the `themeGet` function, or the `useTheme` hook.\n\n<Note variant=\"warning\">\n\nOnly use `theme` objects accessed via Primer's theme context to ensure your application’s styling draws from the same theme as Primer components’ internal styling. The `sx` prop, styled system props, `themeGet`, and `useTheme` all use the theme from context.\n\n<DoDontContainer>\n  <Do>\n    <Code className=\"language-jsx\">\n      {`<Box textShadow=\"shadow.medium\">`}\n    </Code>\n    <Caption>Use the theme from the same context as Primer.</Caption>\n  </Do>\n  <Dont>\n    <Code className=\"language-jsx\">\n      {`import {theme} from '@primer/react'\\n\\n<Box textShadow={theme.shadows.shadow.medium}>`}\n    </Code>\n    <Caption>Don't style components with any other instance of theme</Caption>\n  </Dont>\n</DoDontContainer>\n\n</Note>\n\n### System props and the `sx` prop\n\nSome [system props](/system-props) and [`sx` prop](/overriding-styles) keys are theme-aware. For example, the `bg` prop maps to the `colors` theme key which means you can use the `bg` prop to reference values in the `colors` object:\n\n```jsx\nconst theme = {\n  colors: {\n    canvas: {\n      default: '#fff',\n    },\n  },\n}\n\nfunction App() {\n  return (\n    <ThemeProvider theme={theme}>\n      <Box bg=\"canvas.default\"></Box>\n      <Box sx={{bg: 'canvas.default'}}></Box>\n    </ThemeProvider>\n  )\n}\n```\n\nSee the [Styled System Reference Table](https://styled-system.com/table) for a complete list of mappings.\n\n### themeGet\n\nThe `themeGet` function is a convenient way to reference theme values in styled-components template literals:\n\n```js\nimport {themeGet} from '@primer/react'\nimport styled from 'styled-components'\n\nconst Example = styled.div`\n  background-color: ${themeGet('colors.canvas.default')};\n`\n```\n\n### useTheme\n\nYou can use the `useTheme` hook to reference theme values from inside any function component nested under the `ThemeProvider`:\n\n```js\nimport {ThemeProvider, useTheme} from '@primer/react'\n\nfunction Example() {\n  const {theme} = useTheme()\n  // theme.colors.canvas.default\n}\n\nfunction App() {\n  return (\n    <ThemeProvider>\n      <Example />\n    </ThemeProvider>\n  )\n}\n```\n\n<Note variant=\"warning\">\n\nOnly use `useTheme` to reference theme values in places where it's not possible to use system props, the `sx` prop, or `themeGet`.\n\n</Note>\n\n## Color modes and color schemes\n\nThe terms \"color mode\" and \"color scheme\" are often used interchangeably. However, in Primer React, they are two separate (but related) concepts.\n\nThe \"color mode\" of an application can be either `day`, `night`, or `auto` (i.e. synced with the operating system).\n\nA \"color scheme\", on the other hand, is a collection of colors that can be associated with a color mode. The [default theme](/theme-reference) includes several color schemes, including `light`, `dark`, and `dark_dimmed`. By default, the `light` scheme is displayed when the application is in `day` mode and the `dark` scheme is displayed in `night` mode.\n\n### Setting the color mode\n\nBy default, Primer React is in `day` mode. To change the color mode, use the `colorMode` prop on `ThemeProvider` or the `setColorMode` function from the `useTheme` hook:\n\n#### `colorMode` prop\n\n```jsx\nimport {ThemeProvider} from '@primer/react'\n\nfunction App() {\n  return (\n    // colorMode can be \"day\" (default), \"night\", or \"auto\"\n    <ThemeProvider colorMode=\"auto\">\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\n#### `setColorMode` function\n\n```jsx\nimport {useTheme} from '@primer/react'\n\nfunction Example() {\n  const {setColorMode} = useTheme()\n  return <button onClick={() => setColorMode('auto')}>Activate auto mode</button>\n}\n```\n\n#### `preventSSRMismatch` prop\n\nIf you are doing server-side rendering, pass the `preventSSRMismatch` prop to ensure the rendered output from the server and browser match even when they resolve \"auto\" color mode differently.\n\n```jsx\n<ThemeProvider colorMode=\"auto\" preventSSRMismatch>\n  ...\n</ThemeProvider>\n```\n\n### Setting color schemes\n\nTo choose which color schemes will be displayed in `day` and `night` mode, use the `dayScheme` and `nightScheme` props on `ThemeProvider` or the `setDayScheme` and `setNightScheme` functions from the `useTheme` hook:\n\n#### `dayScheme` and `nightScheme` props\n\n```jsx\nimport {ThemeProvider} from '@primer/react'\n\nfunction App() {\n  return (\n    // The default theme includes `light`, `dark`, and `dark_dimmed` schemes\n    <ThemeProvider dayScheme=\"light\" nightScheme=\"dark_dimmed\">\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\n#### `setDayScheme` and `setNightScheme` functions\n\n```jsx\nimport {useTheme} from '@primer/react'\n\nfunction Example() {\n  const {setDayScheme, setNightScheme} = useTheme()\n  return <button onClick={() => setNightScheme('auto')}>Activate auto mode</button>\n}\n```\n\n### Customizing or adding color schemes\n\nTo customize or add color schemes, update the `colorSchemes` object in the theme:\n\n```jsx\nimport {ThemeProvider, theme} from '@primer/react'\nimport deepmerge from 'deepmerge'\n\nconst customTheme = deepmerge(theme, {\n  colorSchemes: {\n    // Customize an existing scheme\n    light: {\n      colors: {\n        text: {\n          primary: '#f00',\n        },\n      },\n    },\n    // Add a new scheme\n    my_scheme_name: {\n      colors: {},\n      shadows: {},\n    },\n  },\n})\n\nfunction App() {\n  return (\n    <ThemeProvider theme={customTheme}>\n      <div>...</div>\n    </ThemeProvider>\n  )\n}\n```\n\n### Creating local color scheme variables\n\nIf you need to use a color that is not defined in the theme, avoid hard coding the color value like this:\n\n```jsx\nfunction Example() {\n  return (\n    // BAD: #aaa may not look good in all color schemes\n    <Box bg=\"#aaa\">Hello world</Box>\n  )\n}\n```\n\nInstead, use the `useColorSchemeVar` hook to create a local variable that will update based on the active color scheme:\n\n```jsx\nimport {useColorSchemeVar} from '@primer/react'\nimport {colors} from '@primer/primitives'\n\nfunction Example() {\n  // GOOD: The value of `customBg` changes based on the active color scheme\n  const customBg = useColorSchemeVar({\n    light: colors.light.scale.gray[1],\n    dark: colors.dark.scale.gray[9],\n    dark_dimmed: colors.dark_dimmed.scale.gray[2],\n  })\n  return <Box bg={customBg}>Hello world</Box>\n}\n```\n","parent":{"relativeDirectory":"","name":"theming"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/useOnEscapePress.mdx","frontmatter":{"title":"useOnEscapePress"},"rawBody":"---\ntitle: useOnEscapePress\n---\n\n`useOnEscapePress` is a simple utility Hook that calls a user-provided function when the `Escape` key is pressed. The hook sets up `keydown` event listener on `window.document` and executes the user-provided function if these conditions are met:\n\n1. The Escape key was pressed\n2. The `preventDefault` method has not yet been called on the event object.\n\nFurthermore, unlike the normal behavior for multiple event listeners existing on the same DOM Node, if multiple `useOnEscapePress` hooks are active simultaneously, the callbacks will occur in reverse order. In other words, if a parent component and a child component both call `useOnEscapePress`, when the user presses Escape, the child component's callback will execute, followed by the parent's callback. Each callback has the chance to call `.preventDefault()` on the event to prevent further callbacks.\n\n### Dependencies\n\nSimilar to `useCallback`, `useOnEscapePress` takes a `React.DependencyList` as its second argument. These are the dependencies used to memoize the callback. Failing to provide the correct dependency list can result in degraded performance. If this argument is omitted, we will assume that the callback is already memoized. In the example below, that memoization occurs in `DemoComponent` with a call to `React.useCallback`, so `OverlayDemo` does not need to pass a dependency list.\n\n### Usage\n\n```javascript live noinline\nconst OverlayDemo = ({onEscape, children}) => {\n  useOnEscapePress(onEscape)\n  return <Box height=\"200px\">{children}</Box>\n}\n\nfunction DemoComponent() {\n  const [isOpen, setIsOpen] = React.useState(false)\n  const toggleOverlay = React.useCallback(() => {\n    setIsOpen(isOpen => !isOpen)\n  }, [])\n  const closeOverlay = React.useCallback(() => {\n    setIsOpen(false)\n  }, [])\n  return (\n    <>\n      <Button onClick={toggleOverlay}>toggle</Button>\n      {isOpen && (\n        <OverlayDemo onEscape={closeOverlay}>\n          <Button>Button One</Button>\n          <Button>Button Two</Button>\n        </OverlayDemo>\n      )}\n    </>\n  )\n}\n\nrender(<DemoComponent />)\n```\n\n#### useOnEscapePress\n\n| Name                 | Type                             | Default | Description                                            |\n| :------------------- | :------------------------------- | :-----: | :----------------------------------------------------- |\n| onEscape             | `(event: KeyboardEvent) => void` |         | Function to call when user presses the Escape key      |\n| callbackDependencies | `React.DependencyList`           |         | Array of dependencies for memoizing the given callback |\n","parent":{"relativeDirectory":"","name":"useOnEscapePress"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/useOnOutsideClick.mdx","frontmatter":{"title":"useOnOutsideClick"},"rawBody":"---\ntitle: useOnOutsideClick\n---\n\n`useOnOutsideClick` is a utility Hook that calls a user provided callback function when the user clicks outside of the provided container.\n\nYou can also pass an array of `ignoredRefs` to prevent calling the callback function on additional elements on the page. This can be handy for ignoring clicks on trigger buttons that already manage the open/closed state of content.\n\n### Usage\n\n```jsx live\n<State>\n  {([isOpen, setIsOpen]) => {\n    const containerRef = React.useRef(null)\n    const triggerRef = React.useRef(null)\n\n    const closeOverlay = React.useCallback(() => {\n      setIsOpen(false)\n    }, [setIsOpen])\n\n    const toggleOverlay = React.useCallback(() => {\n      setIsOpen(!isOpen)\n    }, [setIsOpen, isOpen])\n\n    useOnOutsideClick({onClickOutside: closeOverlay, containerRef, ignoreClickRefs: [triggerRef]})\n\n    return (\n      <>\n        <Button ref={triggerRef} onClick={toggleOverlay}>\n          toggle\n        </Button>\n        {isOpen && (\n          <Box\n            borderWidth=\"1px\"\n            borderStyle=\"solid\"\n            borderColor=\"border.default\"\n            borderRadius={2}\n            height=\"200px\"\n            bg=\"green.4\"\n            ref={containerRef}\n          >\n            content\n          </Box>\n        )}\n      </>\n    )\n  }}\n</State>\n```\n\n#### useOnOutsideClick settings\n\n| Name           | Type                              | Default | Description                                                                                                                    |\n| :------------- | :-------------------------------- | :-----: | :----------------------------------------------------------------------------------------------------------------------------- |\n| onOutsideClick | `function`                        |         | Function to call when user clicks outside of the container. Usually this manages the state of the visibility of the container. |\n| ignoredRefs    | `React.RefObject<HTMLElement> []` |         | Elements outside of the container to ignore clicks on.                                                                         |\n| containerRef   | `React.RefObject<HTMLElement>`    |         | Required. A ref for the containing element.                                                                                    |\n","parent":{"relativeDirectory":"","name":"useOnOutsideClick"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/useOpenAndCloseFocus.mdx","frontmatter":{"title":"useOpenAndCloseFocus"},"rawBody":"---\ntitle: useOpenAndCloseFocus\n---\n\n`useOpenAndCloseFocus` is a utility Hook that manages focusing an element when a component is first mounted, and returns focus to an element on the page when that component unmounts.\n\nIf no ref is passed to `initialFocusRef` , the hook focuses the first focusable element inside of the container.\n\n### Usage\n\n```javascript live noinline\nconst Overlay = ({returnFocusRef, initialFocusRef, children}) => {\n  const containerRef = React.useRef(null)\n  useOpenAndCloseFocus({containerRef, returnFocusRef, initialFocusRef})\n  return (\n    <Box height=\"200px\" ref={containerRef}>\n      {children}\n    </Box>\n  )\n}\n\nfunction Component() {\n  const returnFocusRef = React.useRef(null)\n  const initialFocusRef = React.useRef(null)\n  const [isOpen, setIsOpen] = React.useState(false)\n  return (\n    <Box sx={{'*': {':focus': {backgroundColor: 'red.5'}}}}>\n      <Button ref={returnFocusRef} onClick={() => setIsOpen(!isOpen)}>\n        toggle\n      </Button>\n      {isOpen && (\n        <Overlay returnFocusRef={returnFocusRef} initialFocusRef={initialFocusRef}>\n          <Button>Button One</Button>\n          <Button ref={initialFocusRef}>Button Two</Button>\n        </Overlay>\n      )}\n    </Box>\n  )\n}\n\nrender(<Component />)\n```\n\n#### useOpenAndCloseFocus settings\n\n| Name            | Type                           | Default | Description                                                               |\n| :-------------- | :----------------------------- | :-----: | :------------------------------------------------------------------------ |\n| initialFocusRef | `React.RefObject<HTMLElement>` |         | Optional. The element to focus when the container is mounted on the page. |\n| returnFocusRef  | `React.RefObject<HTMLElement>` |         | Required. The element to focus when the container is unmounted.           |\n| containerRef    | `React.RefObject<HTMLElement>` |         | Required. A ref for the containing element.                               |\n","parent":{"relativeDirectory":"","name":"useOpenAndCloseFocus"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/useOverlay.mdx","frontmatter":{"title":"useOverlay"},"rawBody":"---\ntitle: useOverlay\n---\n\n`useOverlay` calls all of the relevant behavior Hooks that all `Overlay` components & composite components should have and returns a ref to be passed down to the overlay's container.\n\nThese behaviors include:\n\n- Correctly positioning the component based on the values provided to `positionSettings` and `positionDeps`.\n- Trapping focus\n- Calling a user provided function when the user presses `Escape`\n- Calling a user provided function when the user clicks outside of the container\n- Focusing the either a user provided element, or the first focusable element in the container when it is opened.\n- Returning focus to an element when container is closed\n\n**Note:** `useOverlay` and `Overlay` do not manage the open state of the overlay. We leave control of the open state up to the user. All behaviors are built with the assumption that the overlay will not be rendered on the page & fully unmounted when it is not visible. See the examples for details on how to conditionally render a component in JSX.\n\n### Usage\n\n```javascript live noinline\nconst DemoOverlay = ({onClickOutside, initialFocusRef, returnFocusRef, ignoreClickRefs, onEscape, ...rest}) => {\n  const overlayProps = useOverlay({returnFocusRef, onEscape, ignoreClickRefs, onClickOutside, initialFocusRef})\n  return <Box height=\"200px\" bg=\"green.4\" {...overlayProps} {...rest} />\n}\n\nconst DemoComponent = () => {\n  const returnFocusRef = React.useRef(null)\n  const initialFocusRef = React.useRef(null)\n  const [isOpen, setIsOpen] = React.useState(false)\n  const closeOverlay = () => setIsOpen(false)\n  return (\n    <>\n      <Button ref={returnFocusRef} onClick={() => setIsOpen(!isOpen)}>\n        toggle\n      </Button>\n      {isOpen && (\n        <DemoOverlay\n          returnFocusRef={returnFocusRef}\n          ignoreClickRefs={[returnFocusRef]}\n          initialFocusRef={initialFocusRef}\n          onEscape={closeOverlay}\n          onClickOutside={closeOverlay}\n        >\n          <Button>Button One</Button>\n          <Button ref={initialFocusRef}>Button Two</Button>\n        </DemoOverlay>\n      )}\n    </>\n  )\n}\n\nrender(<DemoComponent />)\n```\n\n#### UseOverlaySettings\n\n| Name            | Type                              | Required | Description                                                                                                                           |\n| :-------------- | :-------------------------------- | :------: | :------------------------------------------------------------------------------------------------------------------------------------ |\n| onEscapePress   | `function`                        | required | Function to call when user presses the Escape key                                                                                     |\n| onOutsideClick  | `function`                        | required | Function to call when user clicks outside of the overlay                                                                              |\n| ignoreClickRefs | `React.RefObject<HTMLElement> []` | optional | Refs to click clicks on in the `onOutsideClick` function, useful for ignoring clicks on elements that trigger the overlay visibility. |\n| initialFocusRef | `React.RefObject<HTMLElement>`    | optional | Ref to focus when overlay is mounted.                                                                                                 |\n| returnFocusRef  | `React.RefObject<HTMLElement>`    | required | Ref to focus when overlay is unmounted. Important for accessibility.                                                                  |\n","parent":{"relativeDirectory":"","name":"useOverlay"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/useSafeTimeout.mdx","frontmatter":{"title":"useSafeTimeout"},"rawBody":"---\ntitle: useSafeTimeout\n---\n\n`useSafeTimeout` is a utility Hook that allows you to safely call `setTimeout` and `clearTimeout` within a component, ensuring that all timeouts are cleared when the component unmounts.\n\n### Usage\n\n```jsx live\n<State>\n  {([]) => {\n    const {safeSetTimeout, safeClearTimeout} = useSafeTimeout()\n    let timeoutId = null\n\n    const handleOnClick = () => {\n      timeoutId = safeSetTimeout(() => window.alert('hello!'), 5000)\n    }\n\n    const cancelTimeout = () => {\n      safeClearTimeout(timeoutId)\n    }\n\n    return (\n      <>\n        <Button onClick={handleOnClick}>Click me</Button>\n        <Button onClick={cancelTimeout}>Cancel timeout</Button>\n      </>\n    )\n  }}\n</State>\n```\n","parent":{"relativeDirectory":"","name":"useSafeTimeout"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/ActionList.mdx","frontmatter":{"title":"ActionList (legacy)"},"rawBody":"---\ntitle: ActionList (legacy)\nstatus: Deprecated\nsource: https://github.com/primer/react/tree/main/src/deprecated/ActionList\n---\n\nAn `ActionList` is a list of items which can be activated or selected. `ActionList` is the base component for many of our menu-type components, including `DropdownMenu` and `ActionMenu`.\n\n## Deprecation\n\nUse [new version of ActionList](/ActionList) with composable API, design updates and accessibility fixes.\n\n### Before\n\n```jsx\n<ActionList\n  items={[\n    {text: 'New file'},\n    {text: 'Copy link'},\n    {text: 'Edit file'},\n    ActionList.Divider,\n    {text: 'Delete file', variant: 'danger'},\n  ]}\n/>\n```\n\n### After\n\n```jsx\n<ActionList>\n  <ActionList.Item>New file</ActionList.Item>\n  <ActionList.Item>Copy link</ActionList.Item>\n  <ActionList.Item>Edit file</ActionList.Item>\n  <ActionList.Divider />\n  <ActionList.Item variant=\"danger\">Delete file</ActionList.Item>\n</ActionList>\n```\n\nOr continue using deprecated API:\n\n```js\nimport {ActionList} from '@primer/react/deprecated'\n```\n\n## Minimal example\n\n```jsx live deprecated\n<ActionList\n  items={[\n    {text: 'New file'},\n    ActionList.Divider,\n    {text: 'Copy link'},\n    {text: 'Edit file'},\n    {text: 'Delete file', variant: 'danger'},\n  ]}\n/>\n```\n\n## Example with grouped items\n\n```jsx live deprecated\n<ActionList\n  groupMetadata={[\n    {groupId: '0'},\n    {groupId: '1', header: {title: 'Live query', variant: 'subtle'}},\n    {groupId: '2', header: {title: 'Layout', variant: 'subtle'}},\n    {groupId: '3'},\n    {groupId: '4'},\n  ]}\n  items={[\n    {key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0', trailingVisual: '⌘R'},\n    {key: '2', leadingVisual: VersionsIcon, text: 'Duplicate', groupId: '0'},\n    {key: '3', leadingVisual: SearchIcon, text: 'repo:github/github', groupId: '1'},\n    {\n      key: '4',\n      leadingVisual: NoteIcon,\n      text: 'Table',\n      description: 'Information-dense table optimized for operations across teams',\n      descriptionVariant: 'block',\n      groupId: '2',\n    },\n    {\n      key: '5',\n      leadingVisual: ProjectIcon,\n      text: 'Board',\n      description: 'Kanban-style board focused on visual states',\n      descriptionVariant: 'block',\n      groupId: '2',\n    },\n    {\n      key: '6',\n      leadingVisual: FilterIcon,\n      text: 'Save sort and filters to current view',\n      disabled: true,\n      groupId: '3',\n    },\n    {key: '7', leadingVisual: FilterIcon, text: 'Save sort and filters to new view', groupId: '3'},\n    {key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4', trailingVisual: ArrowRightIcon},\n  ]}\n/>\n```\n\n## Example with custom item renderer\n\n```jsx deprecated\n<ActionList\n  items={[\n    {\n      text: 'Vanilla link',\n      renderItem: props => <ActionList.Item as=\"a\" href=\"/about\" {...props} />,\n    },\n    {\n      text: 'React Router link',\n      renderItem: props => <ActionList.Item as={ReactRouterLikeLink} to=\"/about\" {...props} />,\n    },\n    {\n      text: 'NextJS style',\n      renderItem: props => (\n        <NextJSLikeLink href=\"/about\">\n          <ActionList.Item as=\"a\" {...props} />\n        </NextJSLikeLink>\n      ),\n    },\n  ]}\n/>\n```\n\n## Props\n\n| Name             | Type                                                                                                                                              |      Default      | Description                                                                                                                                             |\n| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------ | :---------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| items            | `(ItemProps & Omit<React.ComponentPropsWithoutRef<'div'>, keyof ItemProps>) \\| ((Partial<ItemProps> & {renderItem: RenderItemFn}) & {key?: Key})` |    `undefined`    | Required. A list of item objects conforming to the `ActionList.Item` props interface.                                                                   |\n| renderItem       | `(props: ItemProps) => JSX.Element`                                                                                                               | `ActionList.Item` | Optional. If defined, each item in `items` will be passed to this function, allowing for `ActionList`-wide custom item rendering.                       |\n| groupMetadata    | `GroupProps[]`                                                                                                                                    |    `undefined`    | Optional. If defined, `ActionList` will group `items` into `ActionList.Group`s separated by `ActionList.Divider` according to their `groupId` property. |\n| showItemDividers | `boolean`                                                                                                                                         |      `false`      | Optional. If `true` dividers will be displayed above each `ActionList.Item` which does not follow an `ActionList.Header` or `ActionList.Divider`        |\n","parent":{"relativeDirectory":"deprecated","name":"ActionList"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/ActionMenu.mdx","frontmatter":{"title":"ActionMenu (legacy)"},"rawBody":"---\ntitle: ActionMenu (legacy)\nstatus: Deprecated\nsource: https://github.com/primer/react/tree/main/src/deprecated/ActionMenu.tsx\n---\n\nAn `ActionMenu` is an ActionList-based component for creating a menu of actions that expands through a trigger button.\n\n## Deprecation\n\nUse [new version of ActionMenu](/ActionMenu) with composable API, design updates and accessibility fixes.\n\n### Before\n\n```jsx\n<ActionMenu\n  anchorContent=\"Menu\"\n  onAction={fn}\n  items={[\n    {text: 'New file'},\n    {text: 'Copy link'},\n    {text: 'Edit file'},\n    ActionMenu.Divider,\n    {text: 'Delete file', variant: 'danger'},\n  ]}\n  overlayProps={{width: 'small'}}\n/>\n```\n\n### After\n\n```jsx\n<ActionMenu>\n  <ActionMenu.Button>Menu</ActionMenu.Button>\n  <ActionMenu.Overlay width=\"small\">\n    <ActionList>\n      <ActionList.Item onSelect={fn}>New file</ActionList.Item>\n      <ActionList.Item>Copy link</ActionList.Item>\n      <ActionList.Item>Edit file</ActionList.Item>\n      <ActionList.Divider />\n      <ActionList.Item variant=\"danger\">Delete file</ActionList.Item>\n    </ActionList>\n  </ActionMenu.Overlay>\n</ActionMenu>\n```\n\nOr continue using deprecated API:\n\n```js\nimport {ActionMenu} from '@primer/react/deprecated'\n```\n\n## Default example\n\n```jsx live deprecated\n<ActionMenu\n  anchorContent=\"Menu\"\n  onAction={({text}) => console.log(text)}\n  items={[\n    {text: 'New file', key: 'new-file'},\n    ActionMenu.Divider,\n    {text: 'Copy link', key: 'copy-link'},\n    {text: 'Edit file', key: 'edit-file'},\n    {text: 'Delete file', variant: 'danger', key: 'delete-file'},\n  ]}\n/>\n```\n\n## Example with grouped items\n\n```jsx live deprecated\n<ActionMenu\n  anchorContent=\"Menu\"\n  onAction={({text}) => console.log(text)}\n  groupMetadata={[\n    {groupId: '0'},\n    {groupId: '1', header: {title: 'Live query', variant: 'subtle'}},\n    {groupId: '2', header: {title: 'Layout', variant: 'subtle'}},\n    {groupId: '3'},\n    {groupId: '4'},\n  ]}\n  items={[\n    {key: '1', leadingVisual: TypographyIcon, text: 'Rename', groupId: '0'},\n    {key: '2', leadingVisual: VersionsIcon, text: 'Duplicate', groupId: '0'},\n    {key: '3', leadingVisual: SearchIcon, text: 'repo:github/github', groupId: '1'},\n    {\n      key: '4',\n      leadingVisual: NoteIcon,\n      text: 'Table',\n      description: 'Information-dense table optimized for operations across teams',\n      descriptionVariant: 'block',\n      groupId: '2',\n    },\n    {\n      key: '5',\n      leadingVisual: ProjectIcon,\n      text: 'Board',\n      description: 'Kanban-style board focused on visual states',\n      descriptionVariant: 'block',\n      groupId: '2',\n    },\n    {\n      key: '6',\n      leadingVisual: FilterIcon,\n      text: 'Save sort and filters to current view',\n      disabled: true,\n      groupId: '3',\n    },\n    {key: '7', leadingVisual: FilterIcon, text: 'Save sort and filters to new view', groupId: '3'},\n    {key: '8', leadingVisual: GearIcon, text: 'View settings', groupId: '4'},\n  ]}\n/>\n```\n\n## Component props\n\n| Name          | Type                                  |      Default      | Description                                                                                                                                                                                        |\n| :------------ | :------------------------------------ | :---------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| items         | `ItemProps[]`                         |    `undefined`    | Required. A list of item objects conforming to the `ActionList.Item` props interface.                                                                                                              |\n| renderItem    | `(props: ItemProps) => JSX.Element`   | `ActionList.Item` | Optional. If defined, each item in `items` will be passed to this function, allowing for `ActionList`-wide custom item rendering.                                                                  |\n| groupMetadata | `GroupProps[]`                        |    `undefined`    | Optional. If defined, `ActionList` will group `items` into `ActionList.Group`s separated by `ActionList.Divider` according to their `groupId` property.                                            |\n| renderAnchor  | `(props: ButtonProps) => JSX.Element` |     `Button`      | Optional. If defined, provided component will be used to render the menu anchor. Will receive the selected `Item` text as `children` prop when an item is activated.                               |\n| anchorContent | React.ReactNode                       |    `undefined`    | Optional. If defined, it will be passed to the trigger as the elements child.                                                                                                                      |\n| onAction      | (props: ItemProps) => void            |    `undefined`    | Optional. If defined, this function will be called when a menu item is activated either by a click or a keyboard press.                                                                            |\n| open          | boolean                               |    `undefined`    | Optional. If defined, ActionMenu will use this to control the open/closed state of the Overlay instead of controlling the state internally. Should be used in conjunction with the `setOpen` prop. |\n| setOpen       | (state: boolean) => void              |    `undefined`    | Optional. If defined, ActionMenu will use this to control the open/closed state of the Overlay instead of controlling the state internally. Should be used in conjunction with the `open` prop.    |\n","parent":{"relativeDirectory":"deprecated","name":"ActionMenu"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/BorderBox.md","frontmatter":{"title":"BorderBox"},"rawBody":"---\ntitle: BorderBox\nstatus: Deprecated\n---\n\nBorderBox is a Box component with a border. When no `borderColor` is present, the component defaults to a primary border.\n\n## Deprecation\n\nUse [Box](/Box) instead.\n\n### Before\n\n```jsx deprecated\n<BorderBox>Item 1</BorderBox>\n```\n\n### After\n\n```jsx deprecated\n<Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2}>\n  Item 1\n</Box>\n```\n\n## Default example\n\n```jsx live deprecated\n<BorderBox>This is a BorderBox</BorderBox>\n```\n\nNote that `BorderBox` has default props set for `borderWidth`, `borderStyle`, and `borderColor`. This means that you cannot use `border={0} borderBottom={1}` or similar patterns; instead, use individual properties like `borderWidth={0} borderBottomWidth={1}`.\n\n## System props\n\nBorderBox components get `COMMON`, `LAYOUT`, `BORDER`, and `FLEX` system props. Read our [System Props](/system-props) doc page for a full list of available props.\n\n## Component props\n\n| Prop name    | Type             |            Default            | Description                                                   |\n| :----------- | :--------------- | :---------------------------: | :------------------------------------------------------------ |\n| borderWidth  | String           |             '1px'             | Sets the border, use theme values or provide your own.        |\n| borderStyle  | String           |            'solid'            | Sets the border style, use theme values or provide your own.  |\n| borderColor  | String           | 'border.primary' (from theme) | Sets the border color, use theme values or provide your own.  |\n| borderRadius | String or Number |        2 (from theme)         | Sets the border radius, use theme values or provide your own. |\n| boxShadow    | String           |                               | Sets box shadow, use theme values or provide your own.        |\n","parent":{"relativeDirectory":"deprecated","name":"BorderBox"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Buttons.mdx","frontmatter":{"title":"Button (legacy)"},"rawBody":"---\ntitle: Button (legacy)\nstatus: Deprecated\nsource: https://github.com/primer/react/blob/main/src/Button\nstorybook: '/react/storybook?path=/story/components-button--default-button'\n---\n\n## Deprecation\n\nUse [Button](/Button) instead.\n\n`Button` is used for actions, like in forms, while `Link` is used for destinations, or moving from one page to another.\n\nIn special cases where you'd like to use a `<a>` styled like a Button, use `<Button as='a'>` and provide an `href`.\n\nTo create a button group, wrap `Button` elements in the `ButtonGroup` element. `ButtonGroup` gets the same props as `Box`.\n\n## Examples\n\n### Kitchen sink\n\n```jsx live deprecated\n<>\n  <Button>Button</Button>\n  <ButtonDanger>Button danger</ButtonDanger>\n  <ButtonOutline>Button outline</ButtonOutline>\n  <ButtonPrimary>Button primary</ButtonPrimary>\n  <ButtonInvisible>Button invisible</ButtonInvisible>\n  <ButtonClose onClick={() => window.alert('button clicked')} />\n\n  <ButtonGroup display=\"block\" my={2}>\n    <Button>Button</Button>\n    <Button>Button</Button>\n    <Button>Button</Button>\n  </ButtonGroup>\n\n  <ButtonTableList>Button table list </ButtonTableList>\n</>\n```\n\n## Props\n\nNative `<button>` HTML attributes are forwarded to the underlying React `button` component and are not listed below.\n\n<PropsTable>\n  <PropsTableRow name=\"as\" type=\"String\" defaultValue=\"button\" description=\"Sets the HTML tag for the component\" />\n  <PropsTableRow name=\"sx\" type=\"SystemStyleObject\" defaultValue=\"{}\" description=\"Additional styles\" />\n  <PropsTableRow\n    name=\"variant\"\n    type=\"String\"\n    defaultValue=\"'medium'\"\n    description=\"A value of `small`, `medium`, or `large` results in smaller or larger Button text size; no effect if `fontSize` prop is set\"\n  />\n</PropsTable>\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: true,\n    hasFigmaComponent: true,\n  }}\n/>\n","parent":{"relativeDirectory":"deprecated","name":"Buttons"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/ChoiceFieldset.mdx","frontmatter":{"title":"ChoiceFieldset"},"rawBody":"---\ntitle: ChoiceFieldset\nstatus: Deprecated\nsource: https://github.com/primer/react/blob/main/src/ChoiceFieldset/ChoiceFieldset.tsx\nstorybook: '/react/storybook/?path=/story/forms-choicefieldset--radio-group'\n---\n\nimport {ChoiceFieldset, Box} from '@primer/components'\nimport {CheckIcon, XIcon, AlertIcon} from '@primer/octicons-react'\n\nA `ChoiceFieldset` is a controlled component that is used to render a related set of checkbox or radio inputs.\n\n## Deprecation\n\nUse [CheckboxGroup](/CheckboxGroup) or [RadioGroup](/RadioGroup) instead.\n\n## Examples\n\n### Basic\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend>Color mode</ChoiceFieldset.Legend>\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"dark\">Dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-dark\">High-contrast dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"light\">Light</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-light\">High-contrast light</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### Using an onSelect handler\n\n```javascript live noinline deprecated\nconst WithOnSelectHandler = () => {\n  const [selectedChoices, setSelectedChoices] = React.useState([])\n  const choices = [\n    {\n      value: 'figma',\n      displayName: 'Figma library',\n      description: 'The Figma file where we have Figma symbols and light documentation',\n    },\n    {\n      value: 'css',\n      displayName: 'Primer CSS',\n      description: 'The OG. A CSS library with utility styles and component styles',\n    },\n    {\n      value: 'react',\n      displayName: 'Primer React components',\n      description: 'The React component library that these docs belong to',\n    },\n    {\n      value: 'viewcomponents',\n      displayName: 'Primer ViewComponents',\n      description: 'The Rails and Web Components implementation of our components',\n    },\n  ]\n\n  return (\n    <>\n      <ChoiceFieldset\n        onSelect={selectedValues => {\n          setSelectedChoices(selectedValues)\n        }}\n        selected={selectedChoices}\n      >\n        <ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>\n        <ChoiceFieldset.Description>\n          Your choice won't be used for anything, this is just a React example\n        </ChoiceFieldset.Description>\n        <ChoiceFieldset.List>\n          {choices.map(choice => (\n            <ChoiceFieldset.Item value={choice.value} key={choice.value}>\n              <Item.Label>{choice.displayName}</Item.Label>\n              <Item.Caption>{choice.description}</Item.Caption>\n            </ChoiceFieldset.Item>\n          ))}\n        </ChoiceFieldset.List>\n      </ChoiceFieldset>\n      {selectedChoices.length ? (\n        <Box mt={2}>\n          <em>{choices.find(choice => choice.value === selectedChoices[0]).displayName}</em> is your favorite? Ours too.\n        </Box>\n      ) : null}\n    </>\n  )\n}\n\nrender(<WithOnSelectHandler />)\n```\n\n### Checkbox group\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>\n\n  <ChoiceFieldset.List selectionVariant=\"multiple\">\n    <ChoiceFieldset.Item value=\"figma\">Figma library</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"css\">Primer CSS</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"react\">Primer React components</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"viewcomponents\">Primer ViewComponents</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### Disabled\n\n```jsx live deprecated\n<ChoiceFieldset disabled>\n  <ChoiceFieldset.Legend>Color mode</ChoiceFieldset.Legend>\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"dark\">Dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-dark\">High-contrast dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"light\">Light</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-light\">High-contrast light</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### Required\n\n```jsx live deprecated\n<ChoiceFieldset required>\n  <ChoiceFieldset.Legend>Color mode</ChoiceFieldset.Legend>\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"dark\">Dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-dark\">High-contrast dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"light\">Light</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-light\">High-contrast light</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### With pre-selected choices\n\n```jsx live deprecated\n<ChoiceFieldset selected={['figma', 'react']}>\n  <ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>\n\n  <ChoiceFieldset.List selectionVariant=\"multiple\">\n    <ChoiceFieldset.Item value=\"figma\">Figma library</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"css\">Primer CSS</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"react\">Primer React components</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"viewcomponents\">Primer ViewComponents</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### With validation\n\n```javascript live noinline deprecated\nconst choices = [\n  {\n    value: 'figma',\n    displayName: 'Figma library',\n    description: 'The Figma file where we have Figma symbols and light documentation',\n  },\n  {\n    value: 'css',\n    displayName: 'Primer CSS',\n    description: 'The OG. A CSS library with utility styles and component styles',\n  },\n  {\n    value: 'react',\n    displayName: 'Primer React components',\n    description: 'The React component library that these docs belong to',\n  },\n  {\n    value: 'viewcomponents',\n    displayName: 'Primer ViewComponents',\n    description: 'The Rails and Web Components implementation of our components',\n  },\n]\n\nconst ChoiceFieldsetWithValidation = () => {\n  const [selectedChoices, setSelectedChoices] = React.useState([])\n  const [validationResult, setValidationResult] = React.useState()\n\n  React.useEffect(() => {\n    if (selectedChoices.length && selectedChoices.length > 2) {\n      setValidationResult('tooManySelections')\n    } else {\n      setValidationResult(undefined)\n    }\n  }, [selectedChoices])\n\n  return (\n    <ChoiceFieldset\n      name=\"radioGroup\"\n      onSelect={selectedValues => {\n        setSelectedChoices(selectedValues)\n      }}\n      validationMap={{tooManySelections: 'error'}}\n      validationResult={validationResult}\n      selected={selectedChoices}\n    >\n      <ChoiceFieldset.Legend>Prefered Primer component interface</ChoiceFieldset.Legend>\n      <ChoiceFieldset.Description>Pick your top two</ChoiceFieldset.Description>\n\n      <ChoiceFieldset.List selectionVariant=\"multiple\">\n        {choices.map(choice => (\n          <ChoiceFieldset.Item value={choice.value}>\n            <Item.Label>{choice.displayName}</Item.Label>\n            <Item.Caption>{choice.description}</Item.Caption>\n          </ChoiceFieldset.Item>\n        ))}\n      </ChoiceFieldset.List>\n\n      <ChoiceFieldset.Validation validationKey=\"tooManySelections\">\n        Only two selections are allowed\n      </ChoiceFieldset.Validation>\n    </ChoiceFieldset>\n  )\n}\n\nrender(<ChoiceFieldsetWithValidation />)\n```\n\n### A visually hidden legend\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend visuallyHidden>Color mode</ChoiceFieldset.Legend>\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"dark\">Dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-dark\">High-contrast dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"light\">Light</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-light\">High-contrast light</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### With a ChoiceFieldset.Description\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend>Notification preferences</ChoiceFieldset.Legend>\n  <ChoiceFieldset.Description>\n    Your selection will affect notifications sent to your email and mobile device\n  </ChoiceFieldset.Description>\n\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"all\">\n      <Item.LeadingVisual>\n        <CheckIcon />\n      </Item.LeadingVisual>\n      <Item.Label>All notifications</Item.Label>\n      <Item.Caption>Every possible notification</Item.Caption>\n    </ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"relevant\">\n      <Item.LeadingVisual>\n        <AlertIcon />\n      </Item.LeadingVisual>\n      <Item.Label>Relevant notifications</Item.Label>\n      <Item.Caption>Only the ones you'll care about</Item.Caption>\n    </ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"none\">\n      <Item.LeadingVisual>\n        <XIcon />\n      </Item.LeadingVisual>\n      <Item.Label>No notifications</Item.Label>\n      <Item.Caption>Notifications won't be sent</Item.Caption>\n    </ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### With one disabled item\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend>Color mode</ChoiceFieldset.Legend>\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item disabled value=\"dark\">\n      Dark\n    </ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-dark\">High-contrast dark</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"light\">Light</ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"hc-light\">High-contrast light</ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n### Items with a caption and a leading visual\n\n```jsx live deprecated\n<ChoiceFieldset>\n  <ChoiceFieldset.Legend>Notification preferences</ChoiceFieldset.Legend>\n\n  <ChoiceFieldset.List>\n    <ChoiceFieldset.Item value=\"all\">\n      <Item.LeadingVisual>\n        <CheckIcon />\n      </Item.LeadingVisual>\n      <Item.Label>All notifications</Item.Label>\n      <Item.Caption>Every possible notification</Item.Caption>\n    </ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"relevant\">\n      <Item.LeadingVisual>\n        <AlertIcon />\n      </Item.LeadingVisual>\n      <Item.Label>Relevant notifications</Item.Label>\n      <Item.Caption>Only the ones you'll care about</Item.Caption>\n    </ChoiceFieldset.Item>\n    <ChoiceFieldset.Item value=\"none\">\n      <Item.LeadingVisual>\n        <XIcon />\n      </Item.LeadingVisual>\n      <Item.Label>No notifications</Item.Label>\n      <Item.Caption>Notifications won't be sent</Item.Caption>\n    </ChoiceFieldset.Item>\n  </ChoiceFieldset.List>\n</ChoiceFieldset>\n```\n\n## Props\n\n### ChoiceFieldset\n\n| Name             | Type                                                                                                      | Default | Description                                                                                                                                                                                                          |\n| :--------------- | :-------------------------------------------------------------------------------------------------------- | :-----: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| children\\*       | `ChoiceFieldset.Legend`, `ChoiceFieldset.Description`, `ChoiceFieldset.List`, `ChoiceFieldset.Validation` |    –    | The list of choices and contextual information                                                                                                                                                                       |\n| disabled         | `boolean`                                                                                                 |    –    | Whether the fieldset is NOT ready for user input                                                                                                                                                                     |\n| id               | `string`                                                                                                  |    –    | The unique identifier for this fieldset. Used to associate the validation text with the fieldset <br /> If an ID is not passed, one will be automatically generated                                                  |\n| name             | `string`                                                                                                  |    –    | The unique identifier used to associate radio inputs with eachother <br /> If a name is not passed and the fieldset renders radio inputs, a name will be automatically generated                                     |\n| onSelect         | `(selectedValues?: string[]) => void`                                                                     |    –    | The callback that is called when a user toggles a choice on or off                                                                                                                                                   |\n| required         | `boolean`                                                                                                 |    –    | Whether this field must have a value for the user to complete their task                                                                                                                                             |\n| selected         | `string[]`                                                                                                |    –    | The selected values                                                                                                                                                                                                  |\n| validationMap    | `Record<string, 'error' \\| 'success'>`                                                                    |    –    | A map of validation statuses and their associated validation keys. When one of the validation keys is passed to the `validationResult` prop, the associated validation message will be rendered in the correct style |\n| validationResult | `keyof validationMap`                                                                                     |    –    | The key of the validation message to show                                                                                                                                                                            |\n\n### ChoiceFieldset.Legend\n\nA title for the set of choices. A `ChoiceFieldset.Legend` must be passed, but it may be visually hidden.\n\n| Name           | Type      | Default | Description                                  |\n| :------------- | :-------- | :-----: | :------------------------------------------- |\n| visuallyHidden | `boolean` |    –    | Whether to visually hide the fieldset legend |\n\n### ChoiceFieldset.List\n\nThe list choices are rendered in.\n\n| Name             | Type                   | Default | Description                                             |\n| :--------------- | :--------------------- | :-----: | :------------------------------------------------------ |\n| children\\*       | `ChoiceFieldset.Item`  |    –    | The choices that render as a checkbox or radio field    |\n| selectionVariant | `'single'\\|'multiple'` |    –    | Whether multiple items or a single item can be selected |\n\n### ChoiceFieldset.Item\n\nRenders a choice to the list as a checkbox or radio field.\n\n| Name       | Type                                                                                                | Default | Description                                                                                                                                                                                                  |\n| :--------- | :-------------------------------------------------------------------------------------------------- | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| children\\* | `ChoiceFieldset.Caption`, `ChoiceFieldset.Label`, `ChoiceFieldset.LeadingVisual`, `React.ReactNode` |    –    | The parts that make up the checkbox or radio field used to select the choice. <br /> If you **only** need a label, it's fine to pass in a string or JSX instead of wrapping it in the `Item.Label` component |\n| value\\*    | `string`                                                                                            |    –    | The value that is being selected                                                                                                                                                                             |\n| disabled   | `boolean`                                                                                           |    –    | Whether the field is ready for user input                                                                                                                                                                    |\n| id         | `string`                                                                                            |    –    | The unique identifier for this field. Used to associate the label, validation text, and caption text. <br /> If an ID is not provided, one will be automatically generated.                                  |\n\n### ChoiceFieldset.Description\n\nA `ChoiceFieldset.Description` may be used to render hint text if this list needs additional context to guide a user to make their selection\n\n| Name       | Type              | Default | Description             |\n| :--------- | :---------------- | :-----: | :---------------------- |\n| children\\* | `React.ReactNode` |    –    | The description content |\n\n### ChoiceFieldset.Validation\n\nIf the user's selection has been flagged during validation, `ChoiceFieldset.Validation` may be used to render contextual validation information to help the user complete their task\n\n| Name            | Type              | Default | Description                                                                                                                        |\n| :-------------- | :---------------- | :-----: | :--------------------------------------------------------------------------------------------------------------------------------- |\n| children\\*      | `React.ReactNode` |    –    | The validation message                                                                                                             |\n| validationKey\\* | `string`          |    –    | When this matches the `validationResult` prop on the parent `ChoiceFieldset` component, this validation component will be rendered |\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [ChoiceInputField](/ChoiceInputField)\n- [Checkbox](/Checkbox)\n- [Radio](/Radio)\n","parent":{"relativeDirectory":"deprecated","name":"ChoiceFieldset"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/ChoiceInputField.mdx","frontmatter":{"title":"ChoiceInputField"},"rawBody":"---\ntitle: ChoiceInputField\nstatus: Deprecated\ndescription: The ChoiceInputField component is used to render a labelled checkbox or radio inputs with optional  hint text.\nsource: https://github.com/primer/react/blob/main/src/ChoiceInputField.tsx\nstorybook: '/react/storybook?path=/story/forms-choiceinputfield--checkbox-input-field'\n---\n\nimport {Checkbox, Radio} from '@primer/react'\nimport {MarkGithubIcon} from '@primer/octicons-react'\n\n## Deprecation\n\nUse [FormControl](/FormControl) instead.\n\n## Examples\n\n### Checkbox\n\n```jsx live deprecated\n<ChoiceInputField>\n  <ChoiceInputField.Label>Option one</ChoiceInputField.Label>\n  <Checkbox />\n</ChoiceInputField>\n```\n\n### Radio\n\n```jsx live deprecated\n<fieldset style={{margin: 0, padding: 0, border: 0}}>\n  <ChoiceInputField>\n    <ChoiceInputField.Label>Option one</ChoiceInputField.Label>\n    <Radio name=\"radioExample\" value=\"one\" />\n  </ChoiceInputField>\n  <ChoiceInputField>\n    <ChoiceInputField.Label>Option two</ChoiceInputField.Label>\n    <Radio name=\"radioExample\" value=\"two\" />\n  </ChoiceInputField>\n</fieldset>\n```\n\n### Disabled field\n\n```jsx live deprecated\n<ChoiceInputField disabled>\n  <ChoiceInputField.Label>Option one</ChoiceInputField.Label>\n  <Checkbox />\n</ChoiceInputField>\n```\n\n### With a caption\n\n```jsx live deprecated\n<ChoiceInputField>\n  <ChoiceInputField.Label>Option One</ChoiceInputField.Label>\n  <Checkbox />\n  <ChoiceInputField.Caption>Hint: the first and only option</ChoiceInputField.Caption>\n</ChoiceInputField>\n```\n\n### With a LeadingVisual\n\n```jsx live deprecated\n<>\n  <ChoiceInputField>\n    <ChoiceInputField.Label>Option one</ChoiceInputField.Label>\n    <ChoiceInputField.LeadingVisual>\n      <MarkGithubIcon />\n    </ChoiceInputField.LeadingVisual>\n    <Checkbox />\n  </ChoiceInputField>\n\n  <ChoiceInputField>\n    <ChoiceInputField.Label>Option two</ChoiceInputField.Label>\n    <ChoiceInputField.LeadingVisual>\n      <MarkGithubIcon />\n    </ChoiceInputField.LeadingVisual>\n    <Checkbox />\n    <ChoiceInputField.Caption>This one has a caption</ChoiceInputField.Caption>\n  </ChoiceInputField>\n</>\n```\n\n## Props\n\n### ChoiceInputField\n\nThe container that handles the layout and passes the relevant IDs and ARIA attributes it's children.\n\n`ChoiceInputField.Label` and `ChoiceInputField.Input` are required children.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"ChoiceInputField.Label | ChoiceInputField.Caption | ChoiceInputField.LeadingVisual | Checkbox | Radio\"\n    required\n  />\n  <PropsTableRow\n    name=\"disabled\"\n    type=\"boolean\"\n    defaultValue=\"false\"\n    description=\"Whether the field is ready for user input\"\n  />\n  <PropsTableRow\n    name=\"id\"\n    type=\"string\"\n    defaultValue=\"a generated string\"\n    description=\"The unique identifier for this field. Used to associate the label, validation text, and caption text\"\n  />\n</PropsTable>\n\n### ChoiceInputField.Label\n\nA `ChoiceInputField.Label` must be passed, but it may be visually hidden.\n\n<PropsTable>\n  <PropsTableRow name=\"children\" type=\"React.ReactNode\" description=\"The title that describes the choice input\" />\n</PropsTable>\n\n### ChoiceInputField.Caption\n\nIf this field needs additional context, a `ChoiceInputField.Caption` may be used to render hint text.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"React.ReactNode\"\n    description=\"The content (usually just text) that is rendered to give contextual info about the field\"\n  />\n</PropsTable>\n\n### ChoiceInputField.LeadingVisual\n\nIf the selectable option would be easier to understand with a visual, the `ChoiceInputField.LeadingVisual` component may be used.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"React.ReactNode\"\n    description=\"The visual to render before the choice input's label\"\n  />\n</PropsTable>\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"deprecated","name":"ChoiceInputField"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Dropdown.md","frontmatter":{"title":"Dropdown"},"rawBody":"---\ntitle: Dropdown\nstatus: Deprecated\n---\n\n## Deprecation\n\nUse [ActionMenu](/ActionMenu) instead.\n\n---\n\nThe Dropdown component is a lightweight context menu for housing navigation and actions.\n\nUse `Dropdown.Button` as the trigger for the dropdown, or use a custom `summary` element if you would like. **You must use a `summary` tag in order for the dropdown to behave properly!**. You should also add `aria-haspopup=\"true\"` to custom dropdown triggers for accessibility purposes. You can use the `Dropdown.Caret` component to add a caret to a custom dropdown trigger.\n\nDropdown.Menu wraps your menu content. Be sure to pass a `direction` prop to this component to position the menu in relation to the Dropdown.Button.\n\n## Default example\n\n```jsx live deprecated\n<Dropdown>\n  <Dropdown.Button>Dropdown</Dropdown.Button>\n  <Dropdown.Menu direction=\"sw\">\n    <Dropdown.Item>Item 1</Dropdown.Item>\n    <Dropdown.Item>Item 2</Dropdown.Item>\n    <Dropdown.Item>Item 3</Dropdown.Item>\n  </Dropdown.Menu>\n</Dropdown>\n```\n\n## With custom button\n\n```jsx live deprecated\n<Dropdown>\n  <summary>\n    Dropdown\n    <Dropdown.Caret />\n  </summary>\n  <Dropdown.Menu direction=\"sw\">\n    <Dropdown.Item>Item 1</Dropdown.Item>\n    <Dropdown.Item>Item 2</Dropdown.Item>\n    <Dropdown.Item>Item 3</Dropdown.Item>\n  </Dropdown.Menu>\n</Dropdown>\n```\n\n## Component props\n\nThe Dropdown component is extended from the [`Details`](/Details) component and gets all props that the [`Details`](/Details) component gets.\n\n### Dropdown.Menu\n\n| Name      | Type              | Default | Description                                                                           |\n| :-------- | :---------------- | :-----: | :------------------------------------------------------------------------------------ |\n| direction | String            |  'sw'   | Sets the direction of the dropdown menu. Pick from 'ne', 'e', 'se', 's', 'sw', or 'w' |\n| sx        | SystemStyleObject |   {}    | Style to be applied to the component                                                  |\n\n### Dropdown.Button\n\nSee https://primer.style/react/Buttons#component-props\n\n### Dropdown.Caret\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n### Dropdown.Item\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n","parent":{"relativeDirectory":"deprecated","name":"Dropdown"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/DropdownMenu.mdx","frontmatter":{"title":"DropdownMenu"},"rawBody":"---\ntitle: DropdownMenu\nstatus: Deprecated\n---\n\nA `DropdownMenu` provides an anchor (button by default) that will open a floating menu of selectable items. The menu can be opened and navigated using keyboard or mouse. When an item is selected, the menu will close and the `onChange` callback will be called. If the default anchor button is used, the anchor contents will be updated with the selection.\n\n## Deprecation\n\nUse [new version of ActionMenu](/ActionMenu#with-selection) with composable API, design updates and accessibility fixes.\n\n### Before\n\n```jsx\nconst fieldTypes = [\n  {key: 0, text: 'Text'},\n  {key: 1, text: 'Number'},\n  {key: 3, text: 'Date'},\n  {key: 4, text: 'Single select'},\n  {key: 5, text: 'Iteration'},\n]\n\nconst Example = () => {\n  const [selectedType, setSelectedType] = React.useState()\n\n  return (\n    <DropdownMenu\n      renderAnchor={({children, ...anchorProps}) => (\n        <ButtonInvisible {...anchorProps}>\n          {children} <GearIcon />\n        </ButtonInvisible>\n      )}\n      placeholder=\"Field type\"\n      items={fieldTypes}\n      selectedItem={selectedType}\n      onChange={setSelectedType}\n    />\n  )\n}\n```\n\n### After\n\nInstead of `DropdownMenu`, you can use the `ActionMenu` with `ActionList selectionVariant=single`, this will give menu items the correct semantics:\n\n```jsx\nconst fieldTypes = [\n  {id: 0, text: 'Text'},\n  {id: 1, text: 'Number'},\n  {id: 3, text: 'Date'},\n  {id: 4, text: 'Single select'},\n  {id: 5, text: 'Iteration'},\n]\n\nconst Example = () => {\n  const [selectedType, setSelectedType] = React.useState()\n\n  render(\n    <ActionMenu>\n      <ActionMenu.Button aria-label=\"Select field type\">{selectedType.name || 'Field type'}</ActionMenu.Button>\n      <ActionMenu.Overlay>\n        <ActionList selectionVariant=\"single\">\n          {fieldTypes.map(type => (\n            <ActionList.Item\n              key={type.id}\n              selected={type.id === selectedType.id}\n              onSelect={() => setSelectedType(type)}\n            >\n              {type.name}\n            </ActionList.Item>\n          ))}\n        </ActionList>\n      </ActionMenu.Overlay>\n    </ActionMenu>,\n  )\n}\n```\n\nOr continue using deprecated API:\n\n```js\nimport {DropdownMenu} from '@primer/react/deprecated'\n```\n\n## Example\n\n```javascript live noinline deprecated\nfunction DemoComponent() {\n  const items = React.useMemo(\n    () => [\n      {text: '🔵 Cyan', id: 5, key: 'cyan'},\n      {text: '🔴 Magenta', key: 'magenta'},\n      {text: '🟡 Yellow', key: 'yellow'},\n    ],\n    [],\n  )\n  const [selectedItem, setSelectedItem] = React.useState()\n\n  return (\n    <DropdownMenu\n      renderAnchor={({children, 'aria-labelledby': ariaLabelledBy, ...anchorProps}) => (\n        <DropdownButton aria-labelledby={`favorite-color-label ${ariaLabelledBy}`} {...anchorProps}>\n          {children}\n        </DropdownButton>\n      )}\n      placeholder=\"🎨\"\n      items={items}\n      selectedItem={selectedItem}\n      onChange={setSelectedItem}\n    />\n  )\n}\n\nrender(<DemoComponent />)\n```\n\n## Component props\n\n| Name          | Type                                          |      Default      | Description                                                                                                                                                                                    |\n| :------------ | :-------------------------------------------- | :---------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| items         | `ItemProps[]`                                 |    `undefined`    | Required. A list of item objects to display in the menu                                                                                                                                        |\n| selectedItem  | `ItemInput`                                   |    `undefined`    | An `ItemProps` item from the list of `items` which is currently selected. This item will receive a checkmark next to it in the menu.                                                           |\n| onChange?     | (item?: ItemInput) => unknown                 |    `undefined`    | A callback which receives the selected item or `undefined` when an item is activated in the menu. If the activated item is the same as the current `selectedItem`, `undefined` will be passed. |\n| placeholder   | `string`                                      |    `undefined`    | Optional. A placeholder value to display when there is no current selection.                                                                                                                   |\n| renderAnchor  | `(props: DropdownButtonProps) => JSX.Element` | `DropdownButton`  | Optional. If defined, provided component will be used to render the menu anchor. Will receive the selected `Item` text as `children` prop when an item is activated.                           |\n| renderItem    | `(props: ItemProps) => JSX.Element`           | `ActionList.Item` | Optional. If defined, each item in `items` will be passed to this function, allowing for custom item rendering.                                                                                |\n| groupMetadata | `GroupProps[]`                                |    `undefined`    | Optional. If defined, `DropdownMenu` will group `items` into `ActionList.Group`s separated by `ActionList.Divider` according to their `groupId` property.                                      |\n","parent":{"relativeDirectory":"deprecated","name":"DropdownMenu"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Flex.md","frontmatter":{"title":"Flex"},"rawBody":"---\ntitle: Flex\nstatus: Deprecated\n---\n\nThe `Flex` component behaves the same as the `Box` component except that it has `display: flex` set by default.\n\n## Deprecation\n\nUse [Box](/Box) instead.\n\n### Before\n\n```jsx deprecated\n<Flex flexWrap=\"nowrap\">\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n    Item 1\n  </Box>\n</Flex>\n```\n\n### After\n\n```jsx deprecated\n<Box display=\"flex\" flexWrap=\"nowrap\">\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n    Item 1\n  </Box>\n</Box>\n```\n\n## Default example\n\n```jsx deprecated live\n<Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" width={300} height={300} borderRadius={0}>\n  <Flex flexWrap=\"nowrap\">\n    <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n      Item 1\n    </Box>\n    <Box p={3} color=\"fg.onEmphasis\" bg=\"attention.emphasis\">\n      Item 2\n    </Box>\n    <Box p={3} color=\"fg.onEmphasis\" bg=\"danger.emphasis\">\n      Item 3\n    </Box>\n  </Flex>\n</Box>\n```\n\n## System props\n\nFlex components get `FLEX`, `COMMON`, and `LAYOUT` system props.\n\nRead our [System Props](/system-props) doc page for a full list of available props.\n\n## Component props\n\n`Flex` does not get any additional props other than the system props mentioned above.\n","parent":{"relativeDirectory":"deprecated","name":"Flex"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/FormGroup.md","frontmatter":{"title":"FormGroup"},"rawBody":"---\ntitle: FormGroup\nstatus: Deprecated\n---\n\nAdds styles for multiple form elements used together.\n\n## Deprecation\n\nUse [FormControl](/FormControl) instead.\n\n## Default example\n\n```jsx live deprecated\n<>\n  <FormGroup>\n    <FormGroup.Label htmlFor=\"example-text\">Example text</FormGroup.Label>\n    <TextInput id=\"example-text\" value=\"Example Value\" />\n  </FormGroup>\n\n  <FormGroup>\n    <FormGroup.Label htmlFor=\"example-text-b\">Example text</FormGroup.Label>\n    <TextInput id=\"example-text-b\" value=\"Example Value\" />\n  </FormGroup>\n</>\n```\n\n## Component props\n\n### FormGroup\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| as   | String            |  `div`  | Sets the HTML tag for the component  |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n### FormGroup.Label\n\n| Name    | Type              | Default | Description                                                                    |\n| :------ | :---------------- | :-----: | :----------------------------------------------------------------------------- |\n| as      | String            | `label` | Sets the HTML tag for the component                                            |\n| htmlFor | String            |         | The value of `htmlFor` needs to be the same as the `id` of the input it labels |\n| sx      | SystemStyleObject |   {}    | Style to be applied to the component                                           |\n","parent":{"relativeDirectory":"deprecated","name":"FormGroup"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Grid.md","frontmatter":{"title":"Grid"},"rawBody":"---\ntitle: Grid\nstatus: Deprecated\n---\n\nGrid is a component that exposes grid system props. See the [CSS Tricks Complete Guide to Grid](https://css-tricks.com/snippets/css/complete-guide-grid/) to learn more about Grid Layout.\n\n## Deprecation\n\nUse [Box](/Box) instead.\n\n### Before\n\n```jsx deprecated\n<Grid gridTemplateColumns=\"repeat(2, auto)\" gridGap={3}>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n    1\n  </Box>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"attention.emphasis\">\n    2\n  </Box>\n</Grid>\n```\n\n### After\n\n```jsx deprecated\n<Box display=\"grid\" gridTemplateColumns=\"repeat(2, auto)\" gridGap={3}>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n    1\n  </Box>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"attention.emphasis\">\n    2\n  </Box>\n</Box>\n```\n\n## Default example\n\n```jsx deprecated live\n<Grid gridTemplateColumns=\"repeat(2, auto)\" gridGap={3}>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"accent.emphasis\">\n    1\n  </Box>\n  <Box p={3} color=\"fg.onEmphasis\" bg=\"attention.emphasis\">\n    2\n  </Box>\n</Grid>\n```\n\n## System props\n\nGrid components get `GRID`, `COMMON`, and `LAYOUT` system props.\n\nRead our [System Props](/system-props) doc page for a full list of available props.\n\n## Component props\n\n`Grid` does not get any additional props other than the system props mentioned above.\n","parent":{"relativeDirectory":"deprecated","name":"Grid"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/InputField.mdx","frontmatter":{"title":"InputField"},"rawBody":"---\ntitle: InputField\nstatus: Deprecated\ndescription: The InputField component is used to render a labelled text input and, optionally, associated validation text and hint text.\nsource: https://github.com/primer/react/blob/main/src/InputField/InputField.tsx\nstorybook: '/react/storybook?path=/story/forms-inputfield--text-input-field'\n---\n\nimport {TextInputWithTokens, Autocomplete, Select} from '@primer/react'\n\n## Deprecation\n\nUse [FormControl](/FormControl) instead.\n\n## Examples\n\n### Basic\n\n```jsx live deprecated\n<InputField>\n  <InputField.Label>Name</InputField.Label>\n  <TextInput />\n</InputField>\n```\n\n### Required\n\n```jsx live deprecated\n<InputField required>\n  <InputField.Label>Name</InputField.Label>\n  <TextInput />\n</InputField>\n```\n\n### Disabled\n\n```jsx live deprecated\n<InputField disabled>\n  <InputField.Label>Name</InputField.Label>\n  <TextInput />\n</InputField>\n```\n\n### Using different input components\n\n```javascript live noinline deprecated\nconst TextInputWithTokensExample = () => {\n  const [tokens, setTokens] = React.useState([\n    {text: 'zero', id: 0},\n    {text: 'one', id: 1},\n    {text: 'two', id: 2},\n  ])\n  const onTokenRemove = tokenId => {\n    setTokens(tokens.filter(token => token.id !== tokenId))\n  }\n\n  return (\n    <Box\n      display=\"flex\"\n      flexDirection=\"column\"\n      sx={{\n        '> * + *': {\n          marginTop: 4,\n        },\n      }}\n    >\n      <InputField>\n        <InputField.Label>TextInputWithTokens</InputField.Label>\n        <TextInputWithTokens onTokenRemove={onTokenRemove} tokens={tokens} />\n      </InputField>\n      <InputField>\n        <InputField.Label>Autocomplete</InputField.Label>\n        <Autocomplete>\n          <Autocomplete.Input block />\n          <Autocomplete.Overlay>\n            <Autocomplete.Menu\n              items={[\n                {text: 'css', id: 0},\n                {text: 'css-in-js', id: 1},\n                {text: 'styled-system', id: 2},\n                {text: 'javascript', id: 3},\n                {text: 'typescript', id: 4},\n                {text: 'react', id: 5},\n                {text: 'design-systems', id: 6},\n              ]}\n              selectedItemIds={[]}\n            />\n          </Autocomplete.Overlay>\n        </Autocomplete>\n      </InputField>\n      <InputField>\n        <InputField.Label>Select</InputField.Label>\n        <Select>\n          <Select.Option value=\"figma\">Figma</Select.Option>\n          <Select.Option value=\"css\">Primer CSS</Select.Option>\n          <Select.Option value=\"prc\">Primer React components</Select.Option>\n          <Select.Option value=\"pvc\">Primer ViewComponents</Select.Option>\n        </Select>\n      </InputField>\n    </Box>\n  )\n}\n\nrender(TextInputWithTokensExample)\n```\n\n### With a visually hidden label\n\n<Note>\n\nEvery input must have a corresponding label to be accessible to assistive technology. That's why you'd use `InputField` instead of using [`TextInput`](/TextInput) directly.\n\n`InputField` also provides an interface for showing a hint text caption and a validation message, and associating those with the input for assistive technology.\n\n</Note>\n\n```jsx live deprecated\n<InputField>\n  <InputField.Label visuallyHidden>Name</InputField.Label>\n  <TextInput />\n</InputField>\n```\n\n### With a caption\n\n```jsx live deprecated\n<InputField>\n  <InputField.Label>Name</InputField.Label>\n  <TextInput />\n  <InputField.Caption>Hint: your first name</InputField.Caption>\n</InputField>\n```\n\n### With validation\n\n```javascript live noinline deprecated\nconst ValidationExample = () => {\n  const [value, setValue] = React.useState('mona lisa')\n  const [validationResult, setValidationResult] = React.useState()\n  const doesValueContainSpaces = inputValue => /\\s/g.test(inputValue)\n  const handleInputChange = e => {\n    setValue(e.currentTarget.value)\n  }\n\n  React.useEffect(() => {\n    if (doesValueContainSpaces(value)) {\n      setValidationResult('noSpaces')\n    } else if (value) {\n      setValidationResult('validName')\n    }\n  }, [value])\n\n  return (\n    <InputField\n      validationMap={{\n        noSpaces: 'error',\n        validName: 'success',\n      }}\n      validationResult={validationResult}\n    >\n      <InputField.Label>GitHub handle</InputField.Label>\n      <TextInput block value={value} onChange={handleInputChange} />\n      <InputField.Validation validationKey=\"noSpaces\">GitHub handles cannot contain spaces</InputField.Validation>\n      <InputField.Validation validationKey=\"validName\">Valid name</InputField.Validation>\n      <InputField.Caption>With or without \"@\". For example \"monalisa\" or \"@monalisa\"</InputField.Caption>\n    </InputField>\n  )\n}\n\nrender(ValidationExample)\n```\n\n## Props\n\n### InputField\n\nThe container that handles the layout and passes the relevant IDs and ARIA attributes it's children.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"InputField.Label | InputField.Caption | InputField.Validation | Autocomplete | TextInput | TextInputWithTokens | Select\"\n    required\n  />\n  <PropsTableRow\n    name=\"disabled\"\n    type=\"boolean\"\n    defaultValue=\"false\"\n    description=\"Whether the field is ready for user input\"\n  />\n  <PropsTableRow\n    name=\"id\"\n    type=\"string\"\n    defaultValue=\"a generated string\"\n    description=\"The unique identifier for this field. Used to associate the label, validation text, and caption text\"\n  />\n  <PropsTableRow\n    name=\"required\"\n    type=\"boolean\"\n    defaultValue=\"false\"\n    description=\"Whether the field is ready for user input\"\n  />\n  <PropsTableRow\n    name=\"validationMap\"\n    type=\"Record<string, 'error'|'success'>\"\n    description=\"A map of validation statuses and their associated validation keys. When one of the validation keys is passed to the `validationResult` prop, the associated validation message will be rendered in the correct style\"\n  />\n  <PropsTableRow name=\"validationResult\" type=\"string\" description=\"The key of the validation message to show \" />\n</PropsTable>\n\n### InputField.Label\n\nA `InputField.Label` must be passed for the field to be accessible to assistive technology, but it may be visually hidden.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"boolean\"\n    type=\"InputField.Label | InputField.Caption | InputField.Validation | Autocomplete | TextInput | TextInputWithTokens\"\n    defaultValue=\"false\"\n    description=\"Whether the label should be visually hidden\"\n  />\n</PropsTable>\n\n### InputField.Caption\n\n`InputField.Caption` may be used to render hint text for fields that require additional context.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"React.ReactNode\"\n    description=\"The content (usually just text) that is rendered to give contextual info about the field\"\n  />\n</PropsTable>\n\n### InputField.Validation\n\n`InputField.Validation` may be used to render contextual validation information if the field was flagged during validation.\n\n<PropsTable>\n  <PropsTableRow\n    name=\"children\"\n    type=\"React.ReactNode\"\n    description=\"The content (usually just text) that is rendered to give contextual info about the validation result for the field\"\n  />\n  <PropsTableRow\n    name=\"validationKey\"\n    type=\"string\"\n    description=\"The key of the property from `InputField` that corresponds to this validation message. When `InputField`'s `validationResult` prop matches `InputField.Validation`'s `validationKey` prop, this message is shown.\"\n  />\n</PropsTable>\n\n## Component status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n\n## Related components\n\n- [ChoiceInputField](/ChoiceInputField)\n- [TextInput](/TextInput)\n","parent":{"relativeDirectory":"deprecated","name":"InputField"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Label.mdx","frontmatter":{"title":"Label (legacy)"},"rawBody":"---\ntitle: Label (legacy)\ndescription: Use Label components to add contextual metadata to a design.\nstatus: Deprecated\nsource: https://github.com/primer/react/blob/main/src/Label.tsx\ncomponentId: legacy_label\n---\n\n## Deprecation\n\nUse the new [Label](/Label) instead.\n\n## Example\n\n```jsx live deprecated\n<>\n  <Label variant=\"small\" outline sx={{borderColor: 'danger.emphasis', mr: 2, color: 'danger.fg'}}>\n    small\n  </Label>\n  <Label variant=\"medium\" sx={{mr: 2}}>\n    medium (default)\n  </Label>\n  <Label variant=\"large\" sx={{mr: 2}}>\n    large\n  </Label>\n  <Label variant=\"xl\">xl label</Label>\n\n  <Box mt={4} />\n  <Label variant=\"medium\" sx={{bg: '#A575FF', m: 1}}>\n    good first issue\n  </Label>\n  <Label variant=\"medium\" sx={{bg: '#FF75C8', m: 1}}>\n    🚂 deploy: train\n  </Label>\n  <Label variant=\"medium\" sx={{bg: '#1C90FA', m: 1}}>\n    css\n  </Label>\n  <Label variant=\"medium\" sx={{bg: '#FFF06C', color: '#24292E', m: 1}}>\n    documentation\n  </Label>\n  <Label variant=\"medium\" sx={{bg: '#656BFE', m: 1}}>\n    primer\n  </Label>\n</>\n```\n\n## Props\n\n<PropsTable>\n  <PropsTableRow name=\"outline\" type=\"boolean\" defaultValue=\"false\" description=\"Creates an outline style label\" />\n  <PropsTableRow name=\"variant\" type=\"'small' | 'medium' | 'large' | 'xl'\" defaultValue=\"'medium'\" />\n  <PropsTableRow name=\"dropshadow\" type=\"boolean\" defaultValue=\"false\" description=\"Adds a dropshadow to the label\" />\n  <PropsTableSxRow />\n</PropsTable>\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: false,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"deprecated","name":"Label"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/Position.md","frontmatter":{"title":"Position"},"rawBody":"---\ntitle: Position\nstatus: Deprecated\n---\n\nThe Position component is a wrapper component that gives the containing component css positioning abilities.\n\n## Deprecation\n\nUse [Box](/Box) instead.\n\n### Before\n\n```jsx deprecated\n<>\n  <Position position=\"absolute\">...</Position>\n  <Absolute>...</Absolute>\n  <Relative>...</Relative>\n  <Fixed>...</Fixed>\n  <Sticky>...</Sticky>\n</>\n```\n\n### After\n\n```jsx deprecated\n<>\n  <Box position=\"absolute\">...</Box>\n  <Box position=\"absolute\">...</Box>\n  <Box position=\"relative\">...</Box>\n  <Box position=\"fixed\">...</Box>\n  <Box position=\"sticky\">...</Box>\n</>\n```\n\n## Default examples\n\n```jsx deprecated live\n<Box p={2} mb={200}>\n  <Heading mb={2}>Relative + Absolute</Heading>\n  <Relative size={128} mx={128} my={6}>\n    <Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"border.default\" borderRadius={2} size=\"100%\">\n      <Absolute left=\"100%\" top={0} color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        rt\n      </Absolute>\n      <Absolute right=\"100%\" top={0} color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        lt\n      </Absolute>\n      <Absolute left=\"100%\" bottom={0} color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        rb\n      </Absolute>\n      <Absolute right=\"100%\" bottom={0} color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        lb\n      </Absolute>\n      <Absolute left={0} top=\"100%\" color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        bl\n      </Absolute>\n      <Absolute right={0} top=\"100%\" color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        br\n      </Absolute>\n      <Absolute left={0} bottom=\"100%\" color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        tl\n      </Absolute>\n      <Absolute right={0} bottom=\"100%\" color=\"fg.onEmphasis\" bg=\"success.emphasis\" p={1}>\n        tr\n      </Absolute>\n    </Box>\n  </Relative>\n\n  <Heading my={2}>Sticky</Heading>\n\n  <Box borderWidth=\"1px\" borderStyle=\"solid\" borderColor=\"success.emphasis\" borderRadius={2} border={1} height={500}>\n    <Sticky top={0} bg=\"success.subtle\" p={6}>\n      I'm sticky!\n    </Sticky>\n  </Box>\n\n  <Heading my={2}>Fixed</Heading>\n  <p>(see the bottom right of the screen)</p>\n\n  <Fixed bottom={0} right={0} color=\"fg.onEmphasis\" bg=\"danger.emphasis\" p={2}>\n    I'm fixed to the bottom right.\n  </Fixed>\n</Box>\n```\n\n## System props\n\nPosition components get `POSITION`, `LAYOUT`, `FLEX`, and `COMMON` system props. Read our [System Props](/system-props) doc page for a full list of available props.\n\n## Component props\n\nPosition does not get any additional props other than the system props mentioned above.\n","parent":{"relativeDirectory":"deprecated","name":"Position"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/SelectMenu.md","frontmatter":{"title":"SelectMenu"},"rawBody":"---\ntitle: SelectMenu\nstatus: Deprecated\n---\n\n## Deprecation\n\nUse [ActionMenu](/ActionMenu) instead.\n\n---\n\nThe `SelectMenu` components are a suite of components which can be combined together to make several different variations of our GitHub select menu. At it's most basic form, a select menu is comprised of a `SelectMenu` wrapper, which contains a `summary` component of your choice and a `Select.Modal` which contains the select menu content. Use `SelectMenu.List` to wrap items in the select menu, and `SelectMenu.Item` to wrap each item.\n\nSeveral additional components exist to provide even more functionality: `SelectMenu.Header`, `SelectMenu.Filter`, `SelectMenu.Tabs`, `SelectMenu.TabPanel` `SelectMenu.Footer` and `SelectMenu.Divider`.\n\n## Basic Example\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.List>\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n    </SelectMenu.List>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n## SelectMenu\n\nMain wrapper component for select menu.\n\n```jsx deprecated\n<SelectMenu>{/* all other sub components are wrapped here*/}</SelectMenu>\n```\n\n### Component Props\n\n| Name       | Type              | Default | Description                                                                                                                              |\n| :--------- | :---------------- | :-----: | :--------------------------------------------------------------------------------------------------------------------------------------- |\n| initialTab | String            |         | If using the `SelectMenu.Tabs` component, you can use this prop to change the tab shown on open. By default, the first tab will be used. |\n| ref        | React ref         |         | ref to pass down to SelectMenu component                                                                                                 |\n| sx         | SystemStyleObject |   {}    | Style to be applied to the component                                                                                                     |\n\n## SelectMenu.MenuContext\n\nSelectMenu.MenuContext is a [context object](https://reactjs.org/docs/context.html#reactcreatecontext) that exposes some helpful state values to be used via [`React.useContext`](https://reactjs.org/docs/hooks-reference.html#usecontext) in consuming applications. SelectMenu.MenuContext can only be used in components that are already wrapped in a `SelectMenu` as `SelectMenu` contains the [context provider](https://reactjs.org/docs/context.html#contextprovider).\n\n### Values available on MenuContext\n\n| Name           | Type     | Description                                                                                                                                     |\n| :------------- | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------- |\n| selectedTab    | string   | The currently selected tab                                                                                                                      |\n| setSelectedTab | function | Used to update the currently selected tab state                                                                                                 |\n| open           | boolean  | State for open/closed status of the menu modal                                                                                                  |\n| setOpen        | function | Used to update the `open` state                                                                                                                 |\n| initialTab     | string   | Mostly used internally to pass down which tab should be set to open by default. To change this value use the `initialTab` prop on `SelectMenu`. |\n\n### Example Usage\n\n```jsx deprecated\nimport {SelectMenu, Button} from '@primer/react'\nimport React, {useContext} from 'react'\n\nconst MyMenu = () => (\n  <SelectMenu>\n    <MyButton />\n    <SelectMenu.Modal>content</SelectMenu.Modal>\n  </SelectMenu>\n)\n\n// note that we can only use the context in components that are already wrapped by SelectMenu (and thus the Context.Provider)\nconst MyButton = () => {\n  const menuContext = useContext(SelectMenu.MenuContext)\n\n  return <Button as=\"summary\">{menuContext.open ? 'Open' : 'Closed'}</Button>\n}\n```\n\n## SelectMenu.Modal\n\nUsed to wrap the content in a `SelectMenu`.\n\n```jsx deprecated\n<SelectMenu.Modal>{/* all menu content is wrapped in the modal*/}</SelectMenu.Modal>\n```\n\n### Right-aligned modal\n\nUse the `align='right'` prop to align the modal to the right. Note that this only modifies alignment for the modal, and not the SelectMenu itself. You will need to wrap the SelectMenu in a relatively positioned element for this to work properly.\n\n```jsx deprecated live\n<Box position=\"relative\" display=\"flex\" justifyContent=\"flex-end\">\n  <SelectMenu>\n    <Button as=\"summary\">Projects</Button>\n    <SelectMenu.Modal align=\"right\">\n      <SelectMenu.Header>Projects</SelectMenu.Header>\n      <SelectMenu.List>\n        <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n      </SelectMenu.List>\n    </SelectMenu.Modal>\n  </SelectMenu>\n</Box>\n```\n\n### Component Props\n\n| Prop name | Type              | Default | Description                                       |\n| :-------- | :---------------- | :------ | ------------------------------------------------- |\n| align     | String            | 'left'  | Use `right` to align the select menu to the right |\n| width     | String or Number  | 300px   | Sets the modal width                              |\n| sx        | SystemStyleObject | {}      | Style to be applied to the component              |\n\n## SelectMenu.List\n\nUsed to wrap the select menu list content. All menu items **must** be wrapped in a SelectMenu.List in order for the accessibility keyboard handling to function properly. If you are using the `SelectMenu.TabPanel` you do not need to provide a `SelectMenu.List` as that component renders a `SelectMenu.List` as a wrapper.\n\n```jsx deprecated\n<SelectMenu.List>{/* all menu  list items are wrapped in the list*/}</SelectMenu.List>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n## SelectMenu.Item\n\nIndividual items in a select menu. SelectMenu.Item renders an anchor tag by default, you'll need to make sure to provide the appropriate `href`.\n\nYou can use a `button` tag instead by utilizing the [`as` prop](/core-concepts#the-as-prop). Be sure to consider [which HTML element is the right choice](https://marcysutton.com/links-vs-buttons-in-modern-web-applications) for your usage of the component.\n\n```jsx deprecated\n<SelectMenu.Item href=\"/link/to/thing\" selected={true}>\n  {/* wraps an individual list item*/}\n</SelectMenu.Item>\n```\n\n### Component Props\n\n| Name     | Type              | Default | Description                                                                                                                                                                                    |\n| :------- | :---------------- | :-----: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| selected | boolean           |         | Used to apply styles to the selected items in the list.                                                                                                                                        |\n| onClick  | function          |         | Function called when item is clicked. By default we also close the menu when items are clicked. If you would like the menu to stay open, pass an `e.preventDefault()` to your onClick handler. |\n| sx       | SystemStyleObject |   {}    | Style to be applied to the component                                                                                                                                                           |\n\n## SelectMenu.Filter\n\nUse a `SelectMenu.Filter` to add a filter UI to your select menu. Users are expected to implement their own filtering and manage the state of the `value` prop on the input. This gives users more flexibility over the type of filtering and type of content passed into each select menu item.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Filter by Project</SelectMenu.Header>\n    <SelectMenu.Filter placeholder=\"Filter projects\" value=\"\" aria-label=\"Filter Projects\" />\n    <SelectMenu.List>\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Divider>More Options</SelectMenu.Divider>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n    </SelectMenu.List>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\nSelectMenu.Filter components receive all the props that the [TextInput](/TextInput) component gets.\n\n| Name  | Type              | Default | Description                                                                                                    |\n| :---- | :---------------- | :-----: | :------------------------------------------------------------------------------------------------------------- |\n| value | String            |         | Users of this component must provide a value for the filter input that is managed in the consuming application |\n| sx    | SystemStyleObject |   {}    | Style to be applied to the component                                                                           |\n\n## SelectMenu.Tabs\n\nUse `SelectMenu.Tabs` to wrap the tab navigation and `SelectMenu.Tab` for each tab in the navigation.\n\n`SelectMenu.TabPanel` should wrap each corresponding panel for each of the tabs. The `tabName` prop for each `SelectMenu.TabPanel` must match the name provided in the `tabName` prop on `SelectMenu.Tab`.\n\nTo set one of the tabs to be open by default, use `initialTab` on the main `SelectMenu` component. Otherwise, the first tab will be shown by default.\n\nEach `Select.Menu` tab will need to have an `index` prop. The first tab should be at index `0`, the second at index `1` and so forth. The `index` prop is used to show the first tab by default.\n\nIf you need access to the selected tab state, you can find it in the MenuContext object exported from `SelectMenu` as `MenuContext.selectedTab`.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.Tabs>\n      <SelectMenu.Tab index={0} tabName=\"Repository\" />\n      <SelectMenu.Tab index={1} tabName=\"Organization\" />\n    </SelectMenu.Tabs>\n    <SelectMenu.TabPanel tabName=\"Repository\">\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n    </SelectMenu.TabPanel>\n    <SelectMenu.TabPanel tabName=\"Organization\">\n      <SelectMenu.Item href=\"#\"> Project 2</SelectMenu.Item>\n    </SelectMenu.TabPanel>\n    <SelectMenu.Footer>Showing 3 of 3</SelectMenu.Footer>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n## SelectMenu.Tab\n\nUsed for each individual tab inside of a `SelectMenu.Tabs`. Be sure to set the `index` prop to correspond to the order the tab is in. The `tabName` prop should correspond to the `tabName` set on the `SelectMenu.TabPanel`.\n\nThe `onClick` prop is optional and can be used for any events or data fetching you might need to trigger on tab clicks.\n\n```jsx deprecated\n<>\n  <SelectMenu.Tab index={0} tabName=\"Repository\" />\n  <SelectMenu.Tab index={1} tabName=\"Organization\" />\n</>\n```\n\n### Component Props\n\n| Name    | Type              | Default | Description                                                                                                                |\n| :------ | :---------------- | :-----: | :------------------------------------------------------------------------------------------------------------------------- |\n| tabName | String            |         | Used to identify the corresponding tab. Must match the string used in the `tabs` array in the `SelectMenu.Tabs` component. |\n| index   | Number            |         | The index at which the tab is in the list of tabs                                                                          |\n| onClick | Function          |         | Function to be called when the tab is clicked. Optional.                                                                   |\n| sx      | SystemStyleObject |   {}    | Style to be applied to the component                                                                                       |\n\n## SelectMenu.TabPanel\n\nWraps the content for each tab. Make sure to use the `tabName` prop to identify each tab panel with the correct tab in the tab navigation.\n\n**Note**: SelectMenu.TabPanel wraps content in a SelectMenu.List, so adding a SelectMenu.List manually is not necessary.\n\n```jsx deprecated\n<SelectMenu.TabPanel tabName=\"Repository\">{/* Wraps content for each tab */}</SelectMenu.TabPanel>\n```\n\n### Component Props\n\n| Name    | Type              | Default | Description                                                                                                                |\n| :------ | :---------------- | :-----: | :------------------------------------------------------------------------------------------------------------------------- |\n| tabName | String            |         | Used to identify the corresponding tab. Must match the string used in the `tabs` array in the `SelectMenu.Tabs` component. |\n| sx      | SystemStyleObject |   {}    | Style to be applied to the component                                                                                       |\n\n## SelectMenu.Divider\n\nUse a `SelectMenu.Divider` to add information between items in a `SelectMenu.List`.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.List>\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Divider>More Options</SelectMenu.Divider>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n    </SelectMenu.List>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n## SelectMenu.Footer\n\nUse a `SelectMenu.Footer` to add content to the bottom of the select menu.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.List>\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n      <SelectMenu.Footer>Use ⌥ + click/return to exclude labels.</SelectMenu.Footer>\n    </SelectMenu.List>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n## SelectMenu.Header\n\nUse a `SelectMenu.Header` to add a header to the top of the select menu content.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.List>\n      <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n      <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n      <SelectMenu.Footer>Use ⌥ + click/return to exclude labels.</SelectMenu.Footer>\n    </SelectMenu.List>\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n\n## SelectMenu.LoadingAnimation\n\nUse a `SelectMenu.LoadingAnimation` to add a loading animation inside of the SelectMenu.\n\n**Note**: You will need to handle showing/hiding the appropriate modal content for your application during the loading state. We recommend always showing the `SelectMenu.Filter` and `SelectMenu.Header` (if used) and hiding the rest of the modal content during the loading state.\n\n```jsx deprecated live\n<SelectMenu>\n  <Button as=\"summary\">Projects</Button>\n  <SelectMenu.Modal>\n    <SelectMenu.Header>Projects</SelectMenu.Header>\n    <SelectMenu.Filter placeholder=\"Filter projects\" value=\"\" aria-label=\"Filter Projects\" />\n    {true ? (\n      <SelectMenu.LoadingAnimation />\n    ) : (\n      <SelectMenu.List>\n        <SelectMenu.Item href=\"#\">Primer React bugs</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\">Primer React roadmap</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\"> Project 3</SelectMenu.Item>\n        <SelectMenu.Item href=\"#\">Project 4</SelectMenu.Item>\n        <SelectMenu.Footer>Use ⌥ + click/return to exclude labels.</SelectMenu.Footer>\n      </SelectMenu.List>\n    )}\n  </SelectMenu.Modal>\n</SelectMenu>\n```\n\n### Component Props\n\n| Name | Type              | Default | Description                          |\n| :--- | :---------------- | :-----: | :----------------------------------- |\n| sx   | SystemStyleObject |   {}    | Style to be applied to the component |\n","parent":{"relativeDirectory":"deprecated","name":"SelectMenu"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/deprecated/SideNav.md","frontmatter":{"title":"SideNav"},"rawBody":"---\ncomponentId: side_nav\ntitle: SideNav\nstatus: Deprecated\n---\n\nThe Side Nav is a vertical list of navigational links, typically used on the left side of a page. For maximum flexibility, SideNav elements have no default width or positioning.\n\n## Deprecation\n\nUse [NavList](/NavList) instead.\n\n### Before\n\n```jsx\n<SideNav aria-label=\"Main\">\n  <SideNav.Link href=\"/\" selected>\n    Home\n  </SideNav.Link>\n  <SideNav.Link href=\"/about\">About</SideNav.Link>\n  <SideNav.Link href=\"/contact\">Contact</SideNav.Link>\n</SideNav>\n```\n\n### After\n\n```jsx\n<NavList aria-label=\"Main\">\n  <NavList.Item href=\"/\" aria-current=\"page\">\n    Home\n  </NavList.Item>\n  <NavList.Item href=\"/about\">About</NavList.Item>\n  <NavList.Item href=\"/contact\">Contact</NavList.Item>\n</NavList>\n```\n\n## Default example\n\n```jsx live\n<SideNav bordered maxWidth={360} aria-label=\"Main\">\n  <SideNav.Link href=\"#account\">\n    <Text>Account</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#home\" selected>\n    <Text>Profile</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#emails\">\n    <Text>Emails</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#notifications\">\n    <Text>Notifications</Text>\n  </SideNav.Link>\n</SideNav>\n```\n\nDifferent kinds of content can be added inside a SideNav item. Use system props to further style them if needed.\n\n## Full variant\n\nAdd the `variant='full'` prop to a `SideNav.Link` to spread child elements across the link, which is useful for status icons, labels, and the like.\n\n```jsx live\n<SideNav bordered maxWidth={360} aria-label=\"Main\">\n  <SideNav.Link href=\"#url\">\n    <Text>Text Only</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\">\n    <Avatar size={16} mr={2} src=\"https://avatars.githubusercontent.com/hubot?s=32\" />\n    <Text>With an avatar</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\">\n    <Octicon sx={{mr: 2}} size={16} icon={ZapIcon} />\n    <Text>With an Octicon</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\" variant=\"full\" selected>\n    <Text>With a status icon</Text>\n    <Octicon sx={{mr: 2}} size={16} icon={DotIcon} color=\"success.fg\" />\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\" variant=\"full\">\n    <Text>With a label</Text>\n    <Label outline>label</Label>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\" variant=\"full\">\n    <Text>With a counter</Text>\n    <CounterLabel>16</CounterLabel>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\">\n    <Heading as=\"h5\" sx={{fontSize: 1}}>\n      A heading\n    </Heading>\n    <Text>and some more content</Text>\n  </SideNav.Link>\n</SideNav>\n```\n\n## Lightweight variant\n\nAdd the `variant=\"lightweight\"` prop to `SideNav` to render an alternative, more lightweight version that has items with no borders and are more condensed.\n\n```jsx live\n<Box\n  borderWidth=\"1px\"\n  borderStyle=\"solid\"\n  borderColor=\"border.default\"\n  borderRadius={2}\n  p={3}\n  backgroundColor=\"canvas.subtle\"\n  maxWidth={360}\n>\n  <Box\n    borderStyle=\"solid\"\n    borderColor=\"border.default\"\n    borderWidth={0}\n    borderBottomWidth={1}\n    borderRadius={0}\n    mb={2}\n    pb={1}\n  >\n    <Heading as=\"h5\" fontSize={1} color=\"fg.muted\">\n      Menu\n    </Heading>\n  </Box>\n  <SideNav variant=\"lightweight\">\n    <SideNav.Link href=\"#url\">\n      <Text>Account</Text>\n    </SideNav.Link>\n    <SideNav.Link href=\"#url\" selected>\n      <Text>Profile</Text>\n    </SideNav.Link>\n    <SideNav.Link href=\"#url\">\n      <Text>Emails</Text>\n    </SideNav.Link>\n    <SideNav.Link href=\"#url\">\n      <Text>Notifications</Text>\n    </SideNav.Link>\n  </SideNav>\n</Box>\n```\n\nIt can also appear nested, as a sub navigation. Use margin/padding [System Props](/system-props) to add indentation.\n\n```jsx live\n<SideNav bordered maxWidth={360}>\n  <SideNav.Link href=\"#url\">\n    <Octicon size={16} icon={PersonIcon} />\n    <Text>Account</Text>\n  </SideNav.Link>\n  <SideNav.Link href=\"#url\" selected>\n    <Octicon mr={2} size={16} icon={SmileyIcon} />\n    <Text>Profile</Text>\n  </SideNav.Link>\n\n  <SideNav bordered variant=\"lightweight\" py={3} pl={6} backgroundColor=\"sidenav.selectedBg\">\n    <SideNav.Link href=\"#url\" selected>\n      <Text>Sub item 1</Text>\n    </SideNav.Link>\n    <SideNav.Link href=\"#url\">\n      <Text>Sub item 2</Text>\n    </SideNav.Link>\n    <SideNav.Link href=\"#url\">\n      <Text>Sub item 3</Text>\n    </SideNav.Link>\n  </SideNav>\n\n  <SideNav.Link href=\"#url\">\n    <Octicon mr={2} size={16} icon={MailIcon} />\n    <Text>Emails</Text>\n  </SideNav.Link>\n</SideNav>\n```\n\n## Usage with React Router\n\nIf using React Router, you can use the `as` prop to render the element as a `NavLink`. React Router will automatically handle setting `aria-current=\"page\"` for you.\n\n```\n<SideNav.Link as={NavLink} to=\"...\">...</SideNav.Link>\n```\n\n## Component props\n\n### SideNav\n\n| Name     | Type              | Default  | Description                                                                    |\n| :------- | :---------------- | :------: | :----------------------------------------------------------------------------- |\n| as       | String            |  'nav'   | Sets the HTML tag for the component.                                           |\n| bordered | Boolean           |  false   | Renders the component with a border.                                           |\n| variant  | String            | 'normal' | Set to `lightweight` to render [in a lightweight style](#lightweight-variant). |\n| sx       | SystemStyleObject |    {}    | Style to be applied to the component                                           |\n\n### SideNav.Link\n\n| Name      | Type              | Default  | Description                                                                                       |\n| :-------- | :---------------- | :------: | :------------------------------------------------------------------------------------------------ |\n| as        | String            |   'a'    | Sets the HTML tag for the component.                                                              |\n| href      | String            |          | URL to be used for the Link                                                                       |\n| muted     | Boolean           |  false   | Uses a less prominent shade for Link color, and the default link shade on hover                   |\n| selected  | Boolean           |  false   | Sets the link as selected, giving it a different style and setting the `aria-current` attribute.  |\n| underline | Boolean           |  false   | Adds underline to the Link                                                                        |\n| variant   | String            | 'normal' | Set to `full` to render [a full variant](#full-variant), suitable for including icons and labels. |\n| sx        | SystemStyleObject |    {}    | Style to be applied to the component                                                              |\n","parent":{"relativeDirectory":"deprecated","name":"SideNav"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/DataTable.mdx","frontmatter":{"title":"DataTable"},"rawBody":"---\ntitle: DataTable\ncomponentId: data_table\nstatus: Draft\n---\n\nimport data from '../../../src/DataTable/DataTable.docs.json'\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: false,\n    noUnnecessaryDeps: false,\n    adaptsToThemes: false,\n    adaptsToScreenSizes: false,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"DataTable"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/Dialog.mdx","frontmatter":{"title":"Dialog v2"},"rawBody":"---\ntitle: Dialog v2\ncomponentId: dialog\nstatus: Draft\n---\n\nimport data from '../../../src/Dialog/Dialog.docs.json'\n\n```js\nimport {Dialog} from '@primer/react/drafts'\n```\n\nimport State from '../../components/State'\n\nThe dialog component is the Primer implementation of the ARIA design pattern [Dialog](https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal). A dialog is a type of overlay that can be used for confirming actions, asking for disambiguation, and presenting small forms. They generally allow the user to focus on a quick task without having to navigate to a different page.\n\n**Dialogs appear in the page after a direct user interaction**. Don't show dialogs on page load or as system alerts.\n\n**Dialogs appear centered in the page**, with a visible backdrop that dims the rest of the window for focus.\n\n**All dialogs should have a title and a close button**. Use the `title` prop to set the title. The close button is created automatically, but must be handled with an `onClose` prop.\n\n**Dialogs are modal**. Dialogs can be dismissed by clicking on the close button, by interacting with another button in the overlay, or by clicking outside of the overlay.\n\n**(Coming soon) Make sure larger dialogs remain mobile-friendly**. Even large dialogs need to be responsive. A dialog's width and height will be readjusted depending on the screen size and should never exceed the available space. Use responsive solutions to adjust the UI so they behave well on smaller screens.\n\n**(Coming soon) Simple and small dialogs can remain as-is on mobile**. As more elements are added to it, mobile-specific style variations such as **Bottom sheet** and **Full-screen** should be considered.\n\n### State\n\nThe dialog component is completely stateless. The parent component must conditionally render a dialog based on the necessary criteria. The parent component can be notified by a gesture to close the dialog (e.g. by clicking the \"X\" button or by pressing the Escape key) by passing in the `onClose` prop.\n\n### Accessibility\n\nThe dialog component is fully accessible out-of-the-box. The dialog's title is used for `aria-labelledby`, and the dialog's description is used for `aria-describedby`. The `aria-modal=\"true\"` attribute is used to inform screen readers that the rest of the content on the page is inert.\n\n#### Keyboard\n\nThe default keyboard API for a dialog employs three mechanisms:\n\n1. The Escape key can be pressed to close the dialog.\n2. Focus is trapped within the top-most dialog. When a dialog is opened, the close button receives initial focus by default, or on a button defined with `autoFocus: true`.\n3. If there are buttons in the dialog footer, focus can be moved between them with left and right arrow keys or tab/shift+tab.\n4. When a dialog is closed, it can optionally handle returning focus to the element that was focused immediately before the dialog was opened. Otherwise, it is the consumer's responsibility to move focus to a suitable element.\n\n### Custom rendering\n\n**Note: using custom rendering allows breaking out of the defined design, UX, and accessibility patterns of the dialog. Use only as a last resort.**\n\nBy default, the Dialog component implements the design and interactions defined by the Primer design system. If necessary, you can provide custom renderers for the header, body, or footer using the `renderHeader`, `renderBody`, and `renderFooter` props, respectively. The JSX produced by these render props will render full-bleed into their respective areas of the dialog. If you are using the custom renderers, you should use the provided sub-components `Dialog.Header`, `Dialog.Title`, `Dialog.Subtitle`, `Dialog.CloseButton`, `Dialog.Body`, `Dialog.Footer`, and `Dialog.Buttons` to the extent possible.\n\n### Example\n\n```jsx live drafts\n<State default={false}>\n  {([isOpen, setIsOpen]) => {\n    const openDialog = React.useCallback(() => setIsOpen(true), [setIsOpen])\n    const closeDialog = React.useCallback(() => setIsOpen(false), [setIsOpen])\n    return (\n      <>\n        <Button onClick={openDialog}>Open</Button>\n        {isOpen && (\n          <Dialog\n            title=\"Dialog example\"\n            subtitle={\n              <>\n                This is a <b>description</b> of the dialog.\n              </>\n            }\n            footerButtons={[{content: 'Ok', onClick: closeDialog}]}\n            onClose={closeDialog}\n          >\n            <Text fontFamily=\"sans-serif\">Some content</Text>\n          </Dialog>\n        )}\n      </>\n    )\n  }}\n</State>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n### DialogHeaderProps\n\nThe `DialogHeaderProps` interface extends `DialogProps` and adds these additional properties:\n\n| Prop name           | Type     | Description                                                                                                                                                     |\n| :------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| dialogLabelId       | `string` | ID of the element that will be used as the `aria-labelledby` attribute on the dialog. This ID should be set to the element that renders the dialog's title.     |\n| dialogDescriptionId | `string` | ID of the element that will be used as the `aria-describedby` attribute on the dialog. This ID should be set to the element that renders the dialog's subtitle. |\n\n### DialogButtonProps\n\nThe `DialogButtonProps` interface extends `ButtonProps` (see Button) and adds these additional properties:\n\n| Prop name  | Type                              | Default  | Description                                                                                                                                                        |\n| :--------- | :-------------------------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| buttonType | `\"normal\" │ \"primary\" │ \"danger\"` | `Button` | The type of button to render                                                                                                                                       |\n| content    | `React.ReactNode`                 |          | Required. The button's inner content.                                                                                                                              |\n| autoFocus  | `boolean`                         | false    | If true, this button will be automatically focused when the dialog is first rendered. If `autoFocus` is true on subsequent button definitions, it will be ignored. |\n\n## ConfirmationDialog\n\nA `ConfirmationDialog` is a special kind of dialog with more rigid behavior. It is used to confirm a user action. `ConfirmationDialog`s always have exactly two buttons: one to cancel the action and one to confirm it. No custom rendering capabilities are provided for ConfirmationDialog.\n\n### useConfirm hook\n\nAn alternate way to use `ConfirmationDialog` is with the `useConfirm()` hook. It takes no parameters and returns an `async` function, `confirm`. When `confirm` is called (see ConfirmOptions below for its argument), it shows the confirmation dialog. When the dialog is dismissed, a promise is resolved with `true` or `false` depending on whether or not the confirm button was used.\n\n### Example (with `useConfirm` hook)\n\n```javascript live noinline\nfunction ShorthandExample2() {\n  const confirm = useConfirm()\n  const buttonClick = React.useCallback(\n    async function (e) {\n      if (await confirm({title: 'Are you sure?', content: 'You must confirm this action to continue.'})) {\n        e.target.textContent = 'Confirmed!'\n      }\n    },\n    [confirm],\n  )\n  return (\n    <>\n      <Button onClick={buttonClick}>Confirmable action</Button>\n    </>\n  )\n}\nrender(<ShorthandExample2 />)\n```\n\n### Example (using the full `ConfirmationDialog` component)\n\n```jsx live\n<State default={false}>\n  {([isOpen, setIsOpen]) => {\n    const openDialog = React.useCallback(() => setIsOpen(true), [setIsOpen])\n    const closeDialog = React.useCallback(() => setIsOpen(false), [setIsOpen])\n    return (\n      <>\n        <Button onClick={openDialog}>Open</Button>\n        {isOpen && (\n          <ConfirmationDialog title=\"Confirm action?\" onClose={closeDialog}>\n            Are you sure you want to confirm this action?\n          </ConfirmationDialog>\n        )}\n      </>\n    )\n  }}\n</State>\n```\n\n### ConfirmationDialogProps\n\n| Prop name            | Type                                                                  | Default    | Description                                                                                                                   |\n| :------------------- | :-------------------------------------------------------------------- | :--------- | :---------------------------------------------------------------------------------------------------------------------------- |\n| title                | `React.ReactNode`                                                     |            | Required. Sets the title of the dialog, which by default is also used as the `aria-labelledby` attribute.                     |\n| onClose              | `(gesture: 'confirm' │ 'cancel' │ 'close-button' │ 'escape') => void` |            | Required. This callback is invoked when a gesture to close the dialog is performed. The first argument indicates the gesture. |\n| cancelButtonContent  | `React.ReactNode`                                                     | `\"Cancel\"` | The content to use for the cancel button.                                                                                     |\n| confirmButtonContent | `React.ReactNode`                                                     | `\"OK\"`     | The content to use for the confirm button.                                                                                    |\n| confirmButtonType    | `\"normal\" │ \"primary\" │ \"danger\"`                                     | `Button`   | The type of button to use for the confirm button.                                                                             |\n\n### ConfirmOptions\n\n| Prop name            | Type                              | Default    | Description                                                                                               |\n| :------------------- | :-------------------------------- | :--------- | :-------------------------------------------------------------------------------------------------------- |\n| title                | `React.ReactNode`                 |            | Required. Sets the title of the dialog, which by default is also used as the `aria-labelledby` attribute. |\n| content              | `React.ReactNode`                 |            | Required. Used as the body of the ConfirmationDialog that is displayed.                                   |\n| cancelButtonContent  | `React.ReactNode`                 | `\"Cancel\"` | The content to use for the cancel button.                                                                 |\n| confirmButtonContent | `React.ReactNode`                 | `\"OK\"`     | The content to use for the confirm button.                                                                |\n| confirmButtonType    | `\"normal\" │ \"primary\" │ \"danger\"` | `Button`   | The type of button to use for the confirm button.                                                         |\n","parent":{"relativeDirectory":"drafts","name":"Dialog"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/Hidden.mdx","frontmatter":{"title":"Hidden"},"rawBody":"---\ntitle: Hidden\ncomponentId: hidden\nstatus: Draft\ndescription: Use Hidden to responsively hide or show content in narrow, regular and wide viewports.\nsource: https://github.com/primer/react/blob/main/src/Hidden/index.tsx\nstorybook: '/react/storybook/?path=/story/drafts-components-hidden--playground'\n---\n\nimport data from '../../../src/Hidden/Hidden.docs.json'\n\nThe `Hidden` component is a utility component that will help you hide or show content/components in different viewports.\n\n<Note>Use Hidden only to control behaviour in a responsive manner. It does not take any `sx` props.</Note>\n\n## Examples\n\n### Single viewport value provided\n\n```jsx live drafts\n<Hidden when=\"narrow\">\n  <Placeholder height=\"80px\" label=\"This is not visible in narrow viewport\" />\n</Hidden>\n```\n\n### Multiple viewport values provided\n\n```jsx live drafts\n<Hidden when={['narrow', 'wide']}>\n  <Placeholder height=\"80px\" label=\"This is not visible in narrow and wide viewport\" />\n</Hidden>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"Hidden"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/InlineAutocomplete.mdx","frontmatter":{"title":"InlineAutocomplete"},"rawBody":"---\ntitle: InlineAutocomplete\ncomponentId: inline_autocomplete\nstatus: Draft\ndescription: Provides inline auto completion suggestions for an input or textarea.\nsource: https://github.com/primer/react/tree/main/src/InlineAutocomplete\nstorybook: '/react/storybook?path=/story/components-forms-inlineautocomplete--default'\n---\n\nimport data from '../../../src/drafts/InlineAutocomplete/InlineAutocomplete.docs.json'\n\n```js\nimport {InlineAutocomplete} from '@primer/react/drafts'\n```\n\nThe `InlineAutocomplete` component extends an `Input` or `Textarea` component to provide inline suggestions, similar to those provided by a code editor.\n\n## Examples\n\n<Note variant=\"warning\">\n\nInput components **must always** be accompanied by a corresponding label to improve support for assistive\ntechnologies. Examples below are provided for conciseness and may not reflect accessibility best practices.\n\n`InlineAutocomplete` can be used with the [`FormControl`](/FormControl) component to render a corresponding label.\n\n</Note>\n\n### Multi-line input\n\nTry typing a `#` symbol to see suggestions. Use `Enter` or click to apply a suggestion.\n\n```javascript live noinline drafts\nconst options = ['javascript', 'typescript', 'css', 'html', 'webassembly']\n\nconst SimpleExample = () => {\n  const [suggestions, setSuggestions] = React.useState([])\n\n  return (\n    <InlineAutocomplete\n      triggers={[{triggerChar: '#'}]}\n      suggestions={suggestions}\n      onShowSuggestions={({query}) => setSuggestions(options.filter(tag => tag.includes(query)))}\n      onHideSuggestions={() => setSuggestions([])}\n    >\n      <Textarea />\n    </InlineAutocomplete>\n  )\n}\n\nrender(SimpleExample)\n```\n\n### Single-line input\n\n```javascript live noinline drafts\nconst options = ['javascript', 'typescript', 'css', 'html', 'webassembly']\n\nconst SimpleExample = () => {\n  const [suggestions, setSuggestions] = React.useState([])\n\n  return (\n    <InlineAutocomplete\n      triggers={[{triggerChar: '#'}]}\n      suggestions={suggestions}\n      onShowSuggestions={({query}) => setSuggestions(options.filter(tag => tag.includes(query)))}\n      onHideSuggestions={() => setSuggestions([])}\n    >\n      <TextInput />\n    </InlineAutocomplete>\n  )\n}\n\nrender(SimpleExample)\n```\n\n### Labelled\n\n```javascript live noinline drafts\nconst options = ['javascript', 'typescript', 'css', 'html', 'webassembly']\n\nconst SimpleExample = () => {\n  const [suggestions, setSuggestions] = React.useState([])\n\n  return (\n    <FormControl>\n      <FormControl.Label>Example</FormControl.Label>\n      <InlineAutocomplete\n        triggers={[{triggerChar: '#'}]}\n        suggestions={suggestions}\n        onShowSuggestions={({query}) => setSuggestions(options.filter(tag => tag.includes(query)))}\n        onHideSuggestions={() => setSuggestions([])}\n      >\n        <Textarea />\n      </InlineAutocomplete>\n    </FormControl>\n  )\n}\n\nrender(SimpleExample)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: false,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"InlineAutocomplete"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/MarkdownEditor.mdx","frontmatter":{"title":"MarkdownEditor"},"rawBody":"---\ncomponentId: markdown_editor\ntitle: MarkdownEditor\nstatus: Draft\ndescription: Full-featured Markdown input.\nstorybook: '/react/storybook?path=/story/components-forms-markdowneditor--default'\n---\n\nimport data from '../../../src/drafts/MarkdownEditor/MarkdownEditor.docs.json'\n\n```js\nimport {MarkdownEditor} from '@primer/react/drafts'\n```\n\n`MarkdownEditor` is a full-featured editor for GitHub Flavored Markdown, with support for:\n\n- Formatting (keyboard shortcuts & toolbar buttons)\n- File uploads (drag & drop, paste, click to upload)\n- Inline suggestions (emojis, `@` mentions, and `#` references)\n- Saved replies\n- Markdown pasting (ie, paste URL onto selected text to create a link)\n- List editing (create a new list item on `Enter`)\n- Indenting selected text\n\n## Examples\n\n### Minimal Example\n\nA `Label` is always required for accessibility:\n\n```javascript live noinline drafts\nconst renderMarkdown = async markdown => {\n  // In production code, this would make a query to some external API endpoint to render\n  return 'Rendered Markdown.'\n}\n\nconst MinimalExample = () => {\n  const [value, setValue] = React.useState('')\n\n  return (\n    <MarkdownEditor value={value} onChange={setValue} onRenderPreview={renderMarkdown}>\n      <MarkdownEditor.Label>Minimal Example</MarkdownEditor.Label>\n    </MarkdownEditor>\n  )\n}\n\nrender(MinimalExample)\n```\n\n### Suggestions, File Uploads, and Saved Replies\n\n```javascript live noinline drafts\nconst renderMarkdown = async markdown => 'Rendered Markdown.'\n\nconst uploadFile = async file => ({\n  url: `https://example.com/${encodeURIComponent(file.name)}`,\n  file,\n})\n\nconst emojis = [\n  {name: '+1', character: '👍'},\n  {name: '-1', character: '👎'},\n  {name: 'heart', character: '❤️'},\n  {name: 'wave', character: '👋'},\n  {name: 'raised_hands', character: '🙌'},\n  {name: 'pray', character: '🙏'},\n  {name: 'clap', character: '👏'},\n  {name: 'ok_hand', character: '👌'},\n  {name: 'point_up', character: '☝️'},\n  {name: 'point_down', character: '👇'},\n  {name: 'point_left', character: '👈'},\n  {name: 'point_right', character: '👉'},\n  {name: 'raised_hand', character: '✋'},\n  {name: 'thumbsup', character: '👍'},\n  {name: 'thumbsdown', character: '👎'},\n]\n\nconst references = [\n  {id: '1', titleText: 'Add logging functionality', titleHtml: 'Add logging functionality'},\n  {\n    id: '2',\n    titleText: 'Error: `Failed to install` when installing',\n    titleHtml: 'Error: <code>Failed to install</code> when installing',\n  },\n  {id: '3', titleText: 'Add error-handling functionality', titleHtml: 'Add error-handling functionality'},\n]\n\nconst mentionables = [\n  {identifier: 'monalisa', description: 'Monalisa Octocat'},\n  {identifier: 'github', description: 'GitHub'},\n  {identifier: 'primer', description: 'Primer'},\n]\n\nconst savedReplies = [\n  {name: 'Duplicate', content: 'Duplicate of #'},\n  {name: 'Welcome', content: 'Welcome to the project!\\n\\nPlease be sure to read the contributor guidelines.'},\n  {name: 'Thanks', content: 'Thanks for your contribution!'},\n]\n\nconst MinimalExample = () => {\n  const [value, setValue] = React.useState('')\n\n  return (\n    <MarkdownEditor\n      value={value}\n      onChange={setValue}\n      onRenderPreview={renderMarkdown}\n      onUploadFile={uploadFile}\n      emojiSuggestions={emojis}\n      referenceSuggestions={references}\n      mentionSuggestions={mentionables}\n      savedReplies={savedReplies}\n    >\n      <MarkdownEditor.Label>Suggestions, File Uploads, and Saved Replies Example</MarkdownEditor.Label>\n    </MarkdownEditor>\n  )\n}\n\nrender(MinimalExample)\n```\n\n### Custom Buttons\n\n```javascript live noinline drafts\nconst renderMarkdown = async markdown => 'Rendered Markdown.'\n\nconst MinimalExample = () => {\n  const [value, setValue] = React.useState('')\n\n  return (\n    <MarkdownEditor value={value} onChange={setValue} onRenderPreview={renderMarkdown}>\n      <MarkdownEditor.Label visuallyHidden>Custom Buttons</MarkdownEditor.Label>\n\n      <MarkdownEditor.Toolbar>\n        <MarkdownEditor.ToolbarButton icon={SquirrelIcon} aria-label=\"Custom button 1\" />\n        <MarkdownEditor.DefaultToolbarButtons />\n        <MarkdownEditor.ToolbarButton icon={BugIcon} aria-label=\"Custom button 2\" />\n      </MarkdownEditor.Toolbar>\n\n      <MarkdownEditor.Footer>\n        <MarkdownEditor.FooterButton variant=\"danger\">Custom Button</MarkdownEditor.FooterButton>\n\n        <MarkdownEditor.Action>\n          <MarkdownEditor.ActionButton variant=\"danger\">Cancel</MarkdownEditor.ActionButton>\n          <MarkdownEditor.ActionButton variant=\"primary\">Submit</MarkdownEditor.ActionButton>\n        </MarkdownEditor.Action>\n      </MarkdownEditor.Footer>\n    </MarkdownEditor>\n  )\n}\n\nrender(MinimalExample)\n```\n\n## Props\n\n<ComponentProps data={data} />\n","parent":{"relativeDirectory":"drafts","name":"MarkdownEditor"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/MarkdownViewer.mdx","frontmatter":{"title":"MarkdownViewer"},"rawBody":"---\ncomponentId: markdown_viewer\ntitle: MarkdownViewer\nstatus: Draft\ndescription: Displays rendered Markdown and facilitates interaction.\n---\n\nimport data from '../../../src/drafts/MarkdownViewer/MarkdownViewer.docs.json'\n\n```js\nimport {MarkdownViewer} from '@primer/react/drafts'\n```\n\nThe `MarkdownViewer` displays rendered Markdown and handles interaction (link clicking and checkbox checking/unchecking) with that content.\n\n## Examples\n\n### Simple Example\n\n```javascript live noinline drafts\nconst MarkdownViewerExample = () => {\n  return (\n    // eslint-disable-next-line github/unescaped-html-literal\n    <MarkdownViewer dangerousRenderedHTML={{__html: '<strong>Lorem ipsum</strong> dolor sit amet.'}} />\n  )\n}\n\nrender(MarkdownViewerExample)\n```\n\n### Link-Handling Example\n\n```javascript live noinline drafts\nconst MarkdownViewerExample = () => {\n  return (\n    <MarkdownViewer\n      // eslint-disable-next-line github/unescaped-html-literal\n      dangerousRenderedHTML={{__html: \"<a href='https://example.com'>Example link</a>\"}}\n      onLinkClick={ev => console.log(ev)}\n    />\n  )\n}\n\nrender(MarkdownViewerExample)\n```\n\n### Checkbox Interaction Example\n\n```javascript live noinline drafts\nconst markdownSource = `\ntext before list\n\n- [ ] item 1\n- [ ] item 2\n\ntext after list`\n\nconst renderedHtml = `\n<p>text before list</p>\n<ul class='contains-task-list'>\n  <li class='task-list-item'><input type='checkbox' class='task-list-item-checkbox' disabled/> item 1</li>\n  <li class='task-list-item'><input type='checkbox' class='task-list-item-checkbox' disabled/> item 2</li>\n</ul>\n<p>text after list</p>`\n\nconst MarkdownViewerExample = () => {\n  return (\n    <MarkdownViewer\n      dangerousRenderedHTML={{__html: renderedHtml}}\n      markdownValue={markdownSource}\n      onChange={value => console.log(value) /* save the value to the server */}\n      disabled={false}\n    />\n  )\n}\n\nrender(MarkdownViewerExample)\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: false,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    usedInProduction: true,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"MarkdownViewer"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/PageHeader.mdx","frontmatter":{"title":"PageHeader"},"rawBody":"---\ntitle: PageHeader\ncomponentId: page_header\nstatus: Draft\ndescription: PageHeader is used to determine the arrangement of the top-level headings and how elements adopt to different viewports.\nsource: https://github.com/primer/react/tree/main/src/PageHeader\nstorybook: '/react/storybook/?path=/story/drafts-components-pageheader--playground'\n---\n\nimport data from '../../../src/PageHeader/PageHeader.docs.json'\n\n```js\nimport {PageHeader} from '@primer/react/drafts'\n```\n\n## Examples\n\n### Has title only\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### Title `variant=\"large\"`\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea variant=\"large\">\n    <PageHeader.Title>Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With leading and trailing visuals\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.LeadingVisual>\n      <GitPullRequestIcon />\n    </PageHeader.LeadingVisual>\n    <PageHeader.Title>Title</PageHeader.Title>\n    <PageHeader.TrailingVisual>\n      <Label>Beta</Label>\n    </PageHeader.TrailingVisual>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With leading visual is hidden on regular viewport\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.LeadingVisual hidden={{regular: true}}>\n      <GitPullRequestIcon />\n    </PageHeader.LeadingVisual>\n    <PageHeader.Title>Title</PageHeader.Title>\n    <PageHeader.TrailingVisual>\n      <Label>Beta</Label>\n    </PageHeader.TrailingVisual>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### Component as Title\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <Breadcrumbs>\n      <Breadcrumbs.Item href=\"#\">...</Breadcrumbs.Item>\n      <Breadcrumbs.Item href=\"#\">primer</Breadcrumbs.Item>\n      <Breadcrumbs.Item href=\"#\">react</Breadcrumbs.Item>\n      <Breadcrumbs.Item href=\"#\">src</Breadcrumbs.Item>\n      <Breadcrumbs.Item href=\"#\">PageHeader</Breadcrumbs.Item>\n      <Breadcrumbs.Item href=\"#\">PageHeader.tsx</Breadcrumbs.Item>\n    </Breadcrumbs>\n    <Heading\n      as=\"h2\"\n      sx={{\n        position: 'absolute',\n        width: '1px',\n        height: '1px',\n        padding: 0,\n        margin: '-1px',\n        overflow: 'hidden',\n        clip: 'rect(0, 0, 0, 0)',\n        whiteSpace: 'nowrap',\n        borderWidth: 0,\n      }}\n    >\n      Visually Hidden Title\n    </Heading>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With leading and trailing actions\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.LeadingAction>\n      <IconButton aria-label=\"Expand\" icon={SidebarExpandIcon} variant=\"invisible\" />\n    </PageHeader.LeadingAction>\n    <PageHeader.Title>Title</PageHeader.Title>\n    <PageHeader.TrailingAction>\n      <IconButton aria-label=\"Edit\" icon={PencilIcon} variant=\"invisible\" />\n    </PageHeader.TrailingAction>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With actions\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Title</PageHeader.Title>\n    <PageHeader.Actions>\n      <IconButton aria-label=\"Workflows\" icon={WorkflowIcon} />\n      <IconButton aria-label=\"Insights\" icon={GraphIcon} />\n      <Button variant=\"primary\" trailingIcon={TriangleDownIcon}>\n        Add Item\n      </Button>\n      <IconButton aria-label=\"Settings\" icon={GearIcon} />\n    </PageHeader.Actions>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With description slot\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>add-pageheader-docs</PageHeader.Title>\n  </PageHeader.TitleArea>\n  <PageHeader.Description>\n    <Text sx={{fontSize: 1, color: 'fg.muted'}}>\n      <Link href=\"#\" muted sx={{fontWeight: 'bold'}}>\n        broccolinisoup\n      </Link>{' '}\n      created this branch 5 days ago · 14 commits · updated today\n    </Text>\n  </PageHeader.Description>\n</PageHeader>\n```\n\n### With navigation slot\n\n#### Utilizing a Navigation component\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Pull request title</PageHeader.Title>\n  </PageHeader.TitleArea>\n  <PageHeader.Navigation>\n    <UnderlineNav2 aria-label=\"Pull Request\">\n      <UnderlineNav2.Item icon={CommentDiscussionIcon} counter=\"12\" aria-current=\"page\">\n        Conversation\n      </UnderlineNav2.Item>\n      <UnderlineNav2.Item counter={3} icon={CommitIcon}>\n        Commits\n      </UnderlineNav2.Item>\n      <UnderlineNav2.Item counter={7} icon={ChecklistIcon}>\n        Checks\n      </UnderlineNav2.Item>\n      <UnderlineNav2.Item counter={4} icon={FileDiffIcon}>\n        Files Changes\n      </UnderlineNav2.Item>\n    </UnderlineNav2>\n  </PageHeader.Navigation>\n</PageHeader>\n```\n\n#### Utilizing a custom navigation\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Page Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n  <PageHeader.Navigation as=\"nav\" aria-label=\"Item list\">\n    <Box as=\"ul\" sx={{display: 'flex', gap: '8px', listStyle: 'none', paddingY: 0, paddingX: 3}} role=\"list\">\n      <li>\n        <Link href=\"#\" aria-current=\"page\">\n          Item 1\n        </Link>\n      </li>\n      <li>\n        <Link href=\"#\">Item 2</Link>\n      </li>\n    </Box>\n  </PageHeader.Navigation>\n</PageHeader>\n```\n\n### With ContextArea\n\n#### With parent link and actions (only visible on mobile)\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.ContextArea>\n    <PageHeader.ParentLink href=\"http://github.com\">Parent Link</PageHeader.ParentLink>\n\n    <PageHeader.ContextAreaActions>\n      <Button size=\"small\" leadingIcon={GitBranchIcon}>\n        Main\n      </Button>\n      <IconButton size=\"small\" aria-label=\"More Options\" icon={KebabHorizontalIcon} />\n    </PageHeader.ContextAreaActions>\n  </PageHeader.ContextArea>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n#### With context bar and actions (only visible on mobile)\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.ContextArea>\n    <PageHeader.ContextBar>\n      <Breadcrumbs>\n        <Breadcrumbs.Item href=\"#\">...</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">primer</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">react</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">src</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">PageHeader</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">PageHeader.tsx</Breadcrumbs.Item>\n      </Breadcrumbs>\n    </PageHeader.ContextBar>\n\n    <PageHeader.ContextAreaActions>\n      <Button size=\"small\" leadingIcon={GitBranchIcon}>\n        Main\n      </Button>\n      <IconButton size=\"small\" aria-label=\"More Options\" icon={KebabHorizontalIcon} />\n    </PageHeader.ContextAreaActions>\n  </PageHeader.ContextArea>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n#### With a ContextArea with all possible children (always visible)\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.ContextArea hidden={false}>\n    <PageHeader.ParentLink href=\"http://github.com\" hidden={false}>\n      Parent Link\n    </PageHeader.ParentLink>\n\n    <PageHeader.ContextBar hidden={false}>\n      <Breadcrumbs>\n        <Breadcrumbs.Item href=\"#\">...</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">primer</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">react</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">src</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">PageHeader</Breadcrumbs.Item>\n        <Breadcrumbs.Item href=\"#\">PageHeader.tsx</Breadcrumbs.Item>\n      </Breadcrumbs>\n    </PageHeader.ContextBar>\n\n    <PageHeader.ContextAreaActions hidden={false}>\n      <Button size=\"small\" leadingIcon={GitBranchIcon}>\n        Main\n      </Button>\n      <IconButton size=\"small\" aria-label=\"More Options\" icon={KebabHorizontalIcon} />\n    </PageHeader.ContextAreaActions>\n  </PageHeader.ContextArea>\n  <PageHeader.TitleArea>\n    <PageHeader.Title>Title</PageHeader.Title>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n### With actions that have responsive content\n\n```jsx live drafts\n<PageHeader>\n  <PageHeader.TitleArea>\n    <PageHeader.Title as=\"h2\">Webhooks</PageHeader.Title>\n    <PageHeader.Actions>\n      <Hidden when={['narrow']}>\n        <Button variant=\"primary\">New webhook</Button>\n      </Hidden>\n      <Hidden when={['regular', 'wide']}>\n        <Button variant=\"primary\">New</Button>\n      </Hidden>\n    </PageHeader.Actions>\n  </PageHeader.TitleArea>\n</PageHeader>\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: false,\n    usedInProduction: false,\n    usageExamplesDocumented: false,\n    hasStorybookStories: false,\n    designReviewed: false,\n    a11yReviewed: false,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"PageHeader"}},{"fileAbsolutePath":"/home/runner/work/react/react/docs/content/drafts/UnderlineNav2.mdx","frontmatter":{"title":"UnderlineNav v2"},"rawBody":"---\ntitle: UnderlineNav v2\ncomponentId: underline_nav_2\nstatus: Draft\na11yReviewed: true\ndescription: Use an underlined nav to allow tab like navigation with overflow behaviour in your UI.\nsource: https://github.com/primer/react/tree/main/src/UnderlineNav2\nstorybook: '/react/storybook/?path=/story/drafts-components-underlinenav--playground'\n---\n\nimport data from '../../../src/UnderlineNav2/UnderlineNav2.docs.json'\n\n```js\nimport {UnderlineNav} from '@primer/react/drafts'\n```\n\n## Examples\n\n### Simple\n\n```jsx live drafts\n<UnderlineNav aria-label=\"Repository\">\n  <UnderlineNav.Item aria-current=\"page\">Code</UnderlineNav.Item>\n  <UnderlineNav.Item>Issues</UnderlineNav.Item>\n  <UnderlineNav.Item>Pull Requests</UnderlineNav.Item>\n</UnderlineNav>\n```\n\n### With Icons\n\n```jsx live drafts\n<UnderlineNav aria-label=\"Repository\">\n  <UnderlineNav.Item aria-current=\"page\" icon={CodeIcon}>\n    Code\n  </UnderlineNav.Item>\n  <UnderlineNav.Item icon={IssueOpenedIcon} counter={30}>\n    Issues\n  </UnderlineNav.Item>\n  <UnderlineNav.Item icon={GitPullRequestIcon} counter={3}>\n    Pull Requests\n  </UnderlineNav.Item>\n  <UnderlineNav.Item icon={CommentDiscussionIcon}>Discussions</UnderlineNav.Item>\n  <UnderlineNav.Item icon={EyeIcon} counter={9}>\n    Actions\n  </UnderlineNav.Item>\n  <UnderlineNav.Item icon={EyeIcon} counter={7}>\n    Projects\n  </UnderlineNav.Item>\n</UnderlineNav>\n```\n\n### Overflow Behaviour\n\nComponent first hides icons if they present to optimize for space and show as many items as possible. If there is still an overflow, it will display the items that don't fit in the `More` menu.\n\n```javascript noinline live drafts\nconst Navigation = () => {\n  const items = [\n    {navigation: 'Code', icon: CodeIcon},\n    {navigation: 'Issues', icon: IssueOpenedIcon, counter: 120},\n    {navigation: 'Pull Requests', icon: GitPullRequestIcon, counter: 13},\n    {navigation: 'Discussions', icon: CommentDiscussionIcon, counter: 5},\n    {navigation: 'Actions', icon: PlayIcon, counter: 4},\n    {navigation: 'Projects', icon: ProjectIcon, counter: 9},\n    {navigation: 'Insights', icon: GraphIcon},\n    {navigation: 'Settings', icon: GearIcon, counter: 10},\n    {navigation: 'Security', icon: ShieldLockIcon},\n  ]\n  const [selectedIndex, setSelectedIndex] = React.useState(0)\n  return (\n    <Box sx={{width: 750, border: '1px solid', borderBottom: 0, borderColor: 'border.default'}}>\n      <UnderlineNav aria-label=\"Repository\">\n        {items.map((item, index) => (\n          <UnderlineNav.Item\n            key={item.navigation}\n            icon={item.icon}\n            aria-current={index === selectedIndex ? 'page' : undefined}\n            onSelect={e => {\n              setSelectedIndex(index)\n              e.preventDefault()\n            }}\n            counter={item.counter}\n          >\n            {item.navigation}\n          </UnderlineNav.Item>\n        ))}\n      </UnderlineNav>\n    </Box>\n  )\n}\nrender(<Navigation />)\n```\n\n### Loading State For Counters\n\n```jsx live drafts\n<UnderlineNav aria-label=\"Repository\" loadingCounters={true}>\n  <UnderlineNav.Item counter={4} aria-current=\"page\">\n    Code\n  </UnderlineNav.Item>\n  <UnderlineNav.Item counter={44}>Issues</UnderlineNav.Item>\n  <UnderlineNav.Item>Pull Requests</UnderlineNav.Item>\n</UnderlineNav>\n```\n\n### With React Router\n\n```jsx\nimport {Link, useMatch, useResolvedPath} from 'react-router-dom'\nimport {UnderlineNav} from '@primer/react/drafts'\n\nfunction UnderlineNavItem({to, children, ...rest}) {\n  const resolved = useResolvedPath(to)\n  const isCurrent = useMatch({path: resolved.pathname, end: true})\n  return (\n    <UnderlineNav.Item as={Link} to={to} aria-current={isCurrent ? 'page' : undefined} {...rest}>\n      {children}\n    </UnderlineNav.Item>\n  )\n}\n\nconst Navigation = () => {\n  return (\n    <UnderlineNav aria-label=\"Repository\">\n      <UnderlineNavItem to=\"/code\" counter={4}>\n        Code\n      </UnderlineNavItem>\n      <UnderlineNavItem to=\"/issues\" counter={44}>\n        Issues\n      </UnderlineNavItem>\n      <UnderlineNavItem to=\"/pulls\">Pull Requests</UnderlineNavItem>\n    </UnderlineNav>\n  )\n}\n```\n\n### With Next.js\n\n```jsx\nimport {useRouter} from 'next/router'\nimport Link from 'next/link'\nimport {UnderlineNav} from '@primer/react/drafts'\n\nfunction UnderlineNavItem({href, children, ...rest}) {\n  const router = useRouter()\n  const isCurrent = typeof href === 'string' ? router.asPath === href : router.pathname === href.pathname\n  return (\n    <UnderlineNav.Item as={Link} href={href} aria-current={isCurrent ? 'page' : undefined} {...rest}>\n      {children}\n    </UnderlineNav.Item>\n  )\n}\n\nconst Navigation = () => {\n  return (\n    <UnderlineNav aria-label=\"Repository\">\n      <UnderlineNavItem href=\"/code\" counter={4}>\n        Code\n      </UnderlineNavItem>\n      <UnderlineNavItem href=\"/issues\" counter={44}>\n        Issues\n      </UnderlineNavItem>\n      <UnderlineNavItem href=\"/pulls\">Pull Requests</UnderlineNavItem>\n    </UnderlineNav>\n  )\n}\n```\n\n## Props\n\n<ComponentProps data={data} />\n\n## Status\n\n<ComponentChecklist\n  items={{\n    propsDocumented: true,\n    noUnnecessaryDeps: true,\n    adaptsToThemes: true,\n    adaptsToScreenSizes: true,\n    fullTestCoverage: true,\n    visualRegressionCoverage: true,\n    noAxeViolations: true,\n    usedInProduction: false,\n    usageExamplesDocumented: true,\n    hasStorybookStories: true,\n    designReviewed: true,\n    a11yReviewed: true,\n    stableApi: false,\n    addressedApiFeedback: false,\n    hasDesignGuidelines: false,\n    hasFigmaComponent: false,\n  }}\n/>\n","parent":{"relativeDirectory":"drafts","name":"UnderlineNav2"}}]}}}