@primer/components 33.0.0-rc.b495ba4a → 33.1.0-rc.6856bcf5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/.devcontainer/devcontainer.json +1 -1
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/release.yml +6 -27
  4. package/.github/workflows/release_canary.yml +4 -60
  5. package/.github/workflows/release_candidate.yml +5 -51
  6. package/.github/workflows/statuses.yml +32 -0
  7. package/.gitignore +1 -0
  8. package/.nvmrc +1 -1
  9. package/CHANGELOG.md +20 -0
  10. package/contributor-docs/CONTRIBUTING.md +14 -61
  11. package/dist/browser.esm.js +2 -2209
  12. package/dist/browser.esm.js.map +1 -1
  13. package/dist/browser.umd.js +2 -2209
  14. package/dist/browser.umd.js.map +1 -1
  15. package/docs/content/AnchoredOverlay.mdx +121 -1
  16. package/docs/content/Avatar.mdx +29 -14
  17. package/docs/content/AvatarPair.mdx +47 -0
  18. package/docs/content/AvatarStack.mdx +14 -6
  19. package/docs/content/Box.mdx +13 -11
  20. package/docs/content/BranchName.mdx +52 -0
  21. package/docs/content/{Breadcrumbs.md → Breadcrumbs.mdx} +21 -13
  22. package/docs/content/Link.mdx +75 -0
  23. package/docs/content/Radio.md +90 -0
  24. package/docs/content/TextInput.mdx +125 -0
  25. package/docs/content/drafts/ActionList2.mdx +484 -0
  26. package/docs/content/drafts/ActionMenu2.mdx +302 -0
  27. package/docs/src/@primer/gatsby-theme-doctocat/live-code-scope.js +9 -1
  28. package/docs/src/@primer/gatsby-theme-doctocat/mdx-components.js +15 -2
  29. package/docs/src/@primer/gatsby-theme-doctocat/nav.yml +4 -0
  30. package/docs/src/component-checklist.js +10 -2
  31. package/docs/src/props-table.js +165 -0
  32. package/docs/src/props.js +14 -28
  33. package/lib/ActionList/Header.js +1 -1
  34. package/lib/ActionList/Item.js +10 -10
  35. package/lib/ActionList/List.js +1 -1
  36. package/lib/ActionList2/ActionListContainerContext.d.ts +10 -0
  37. package/lib/ActionList2/ActionListContainerContext.js +15 -0
  38. package/lib/ActionList2/Divider.d.ts +3 -2
  39. package/lib/ActionList2/Divider.js +10 -5
  40. package/lib/ActionList2/Item.js +22 -8
  41. package/lib/ActionList2/List.js +12 -2
  42. package/lib/ActionList2/Selection.js +11 -0
  43. package/lib/ActionList2/index.d.ts +1 -2
  44. package/lib/ActionMenu2.d.ts +317 -0
  45. package/lib/ActionMenu2.js +125 -0
  46. package/lib/Autocomplete/Autocomplete.d.ts +2 -1
  47. package/lib/Autocomplete/AutocompleteInput.d.ts +2 -1
  48. package/lib/BaseStyles.js +2 -20
  49. package/lib/BorderBox.js +1 -1
  50. package/lib/Box.js +1 -1
  51. package/lib/BranchName.js +1 -1
  52. package/lib/Breadcrumbs.js +3 -3
  53. package/lib/Button/Button.d.ts +2 -2
  54. package/lib/Button/Button.js +1 -1
  55. package/lib/Button/ButtonClose.d.ts +2 -2
  56. package/lib/Button/ButtonDanger.d.ts +2 -2
  57. package/lib/Button/ButtonGroup.js +1 -1
  58. package/lib/Button/ButtonInvisible.d.ts +2 -2
  59. package/lib/Button/ButtonOutline.d.ts +2 -2
  60. package/lib/Button/ButtonPrimary.d.ts +2 -2
  61. package/lib/Checkbox.d.ts +1 -1
  62. package/lib/Checkbox.js +1 -1
  63. package/lib/CircleOcticon.d.ts +35 -35
  64. package/lib/Details.js +1 -1
  65. package/lib/Dialog.d.ts +37 -37
  66. package/lib/Dropdown.d.ts +6 -6
  67. package/lib/DropdownMenu/DropdownButton.d.ts +6 -3
  68. package/lib/FilterList.d.ts +1 -1
  69. package/lib/FilteredActionList/FilteredActionList.js +1 -1
  70. package/lib/Flex.js +1 -1
  71. package/lib/LabelGroup.js +1 -1
  72. package/lib/Overlay.js +1 -1
  73. package/lib/Pagination/Pagination.js +2 -2
  74. package/lib/Position.d.ts +4 -4
  75. package/lib/Position.js +1 -1
  76. package/lib/Radio.d.ts +38 -0
  77. package/lib/Radio.js +55 -0
  78. package/lib/SelectMenu/SelectMenu.d.ts +11 -10
  79. package/lib/SelectMenu/SelectMenu.js +1 -1
  80. package/lib/SelectMenu/SelectMenuFilter.js +1 -1
  81. package/lib/SelectMenu/SelectMenuFooter.js +1 -1
  82. package/lib/SelectMenu/SelectMenuItem.d.ts +1 -1
  83. package/lib/SelectMenu/SelectMenuItem.js +1 -1
  84. package/lib/SelectMenu/SelectMenuModal.d.ts +1 -1
  85. package/lib/SelectMenu/SelectMenuTab.js +1 -1
  86. package/lib/SelectMenu/SelectMenuTabPanel.js +1 -1
  87. package/lib/SelectMenu/SelectMenuTabs.js +1 -1
  88. package/lib/StateLabel.js +1 -1
  89. package/lib/StyledOcticon.js +1 -1
  90. package/lib/SubNav.js +3 -3
  91. package/lib/TextInputWithTokens.d.ts +2 -1
  92. package/lib/ThemeProvider.d.ts +1 -0
  93. package/lib/ThemeProvider.js +17 -4
  94. package/lib/Timeline.js +4 -4
  95. package/lib/Token/AvatarToken.d.ts +1 -1
  96. package/lib/Token/AvatarToken.js +1 -1
  97. package/lib/Token/IssueLabelToken.d.ts +1 -1
  98. package/lib/Token/Token.d.ts +1 -1
  99. package/lib/Token/TokenBase.js +1 -1
  100. package/lib/Tooltip.js +1 -1
  101. package/lib/UnderlineNav.js +2 -2
  102. package/lib/__tests__/Radio.test.d.ts +2 -0
  103. package/lib/__tests__/Radio.test.js +202 -0
  104. package/lib/__tests__/ThemeProvider.test.js +114 -0
  105. package/lib/drafts.d.ts +1 -0
  106. package/lib/drafts.js +13 -0
  107. package/lib/hooks/index.d.ts +1 -0
  108. package/lib/hooks/index.js +9 -1
  109. package/lib/index.d.ts +2 -0
  110. package/lib/index.js +8 -0
  111. package/lib/stories/ActionList.stories.js +3 -3
  112. package/lib/stories/ActionList2.stories.js +1 -1
  113. package/lib/stories/ActionMenu2.stories.js +455 -0
  114. package/lib/stories/Checkbox.stories.js +4 -4
  115. package/lib/stories/Radio.stories.js +146 -0
  116. package/lib/stories/ThemeProvider.stories.js +1 -5
  117. package/lib/stories/useFocusTrap.stories.js +1 -11
  118. package/lib/stories/useFocusZone.stories.js +2 -6
  119. package/lib-esm/ActionList/Header.js +1 -1
  120. package/lib-esm/ActionList/Item.js +10 -10
  121. package/lib-esm/ActionList/List.js +1 -1
  122. package/lib-esm/ActionList2/ActionListContainerContext.d.ts +10 -0
  123. package/lib-esm/ActionList2/ActionListContainerContext.js +3 -0
  124. package/lib-esm/ActionList2/Divider.d.ts +3 -2
  125. package/lib-esm/ActionList2/Divider.js +8 -5
  126. package/lib-esm/ActionList2/Item.js +20 -8
  127. package/lib-esm/ActionList2/List.js +10 -2
  128. package/lib-esm/ActionList2/Selection.js +9 -0
  129. package/lib-esm/ActionList2/index.d.ts +1 -2
  130. package/lib-esm/ActionMenu2.d.ts +317 -0
  131. package/lib-esm/ActionMenu2.js +100 -0
  132. package/lib-esm/Autocomplete/Autocomplete.d.ts +2 -1
  133. package/lib-esm/Autocomplete/AutocompleteInput.d.ts +2 -1
  134. package/lib-esm/BaseStyles.js +2 -20
  135. package/lib-esm/BorderBox.js +1 -1
  136. package/lib-esm/Box.js +1 -1
  137. package/lib-esm/BranchName.js +1 -1
  138. package/lib-esm/Breadcrumbs.js +3 -3
  139. package/lib-esm/Button/Button.d.ts +2 -2
  140. package/lib-esm/Button/Button.js +1 -1
  141. package/lib-esm/Button/ButtonClose.d.ts +2 -2
  142. package/lib-esm/Button/ButtonDanger.d.ts +2 -2
  143. package/lib-esm/Button/ButtonGroup.js +1 -1
  144. package/lib-esm/Button/ButtonInvisible.d.ts +2 -2
  145. package/lib-esm/Button/ButtonOutline.d.ts +2 -2
  146. package/lib-esm/Button/ButtonPrimary.d.ts +2 -2
  147. package/lib-esm/Checkbox.d.ts +1 -1
  148. package/lib-esm/Checkbox.js +1 -1
  149. package/lib-esm/CircleOcticon.d.ts +35 -35
  150. package/lib-esm/Details.js +1 -1
  151. package/lib-esm/Dialog.d.ts +37 -37
  152. package/lib-esm/Dropdown.d.ts +6 -6
  153. package/lib-esm/DropdownMenu/DropdownButton.d.ts +6 -3
  154. package/lib-esm/FilterList.d.ts +1 -1
  155. package/lib-esm/FilteredActionList/FilteredActionList.js +1 -1
  156. package/lib-esm/Flex.js +1 -1
  157. package/lib-esm/LabelGroup.js +1 -1
  158. package/lib-esm/Overlay.js +1 -1
  159. package/lib-esm/Pagination/Pagination.js +2 -2
  160. package/lib-esm/Position.d.ts +4 -4
  161. package/lib-esm/Position.js +1 -1
  162. package/lib-esm/Radio.d.ts +38 -0
  163. package/lib-esm/Radio.js +40 -0
  164. package/lib-esm/SelectMenu/SelectMenu.d.ts +11 -10
  165. package/lib-esm/SelectMenu/SelectMenu.js +1 -1
  166. package/lib-esm/SelectMenu/SelectMenuFilter.js +1 -1
  167. package/lib-esm/SelectMenu/SelectMenuFooter.js +1 -1
  168. package/lib-esm/SelectMenu/SelectMenuItem.d.ts +1 -1
  169. package/lib-esm/SelectMenu/SelectMenuItem.js +1 -1
  170. package/lib-esm/SelectMenu/SelectMenuModal.d.ts +1 -1
  171. package/lib-esm/SelectMenu/SelectMenuTab.js +1 -1
  172. package/lib-esm/SelectMenu/SelectMenuTabPanel.js +1 -1
  173. package/lib-esm/SelectMenu/SelectMenuTabs.js +1 -1
  174. package/lib-esm/StateLabel.js +1 -1
  175. package/lib-esm/StyledOcticon.js +1 -1
  176. package/lib-esm/SubNav.js +3 -3
  177. package/lib-esm/TextInputWithTokens.d.ts +2 -1
  178. package/lib-esm/ThemeProvider.d.ts +1 -0
  179. package/lib-esm/ThemeProvider.js +17 -4
  180. package/lib-esm/Timeline.js +4 -4
  181. package/lib-esm/Token/AvatarToken.d.ts +1 -1
  182. package/lib-esm/Token/AvatarToken.js +1 -1
  183. package/lib-esm/Token/IssueLabelToken.d.ts +1 -1
  184. package/lib-esm/Token/Token.d.ts +1 -1
  185. package/lib-esm/Token/TokenBase.js +1 -1
  186. package/lib-esm/Tooltip.js +1 -1
  187. package/lib-esm/UnderlineNav.js +2 -2
  188. package/lib-esm/__tests__/Radio.test.d.ts +2 -0
  189. package/lib-esm/__tests__/Radio.test.js +183 -0
  190. package/lib-esm/__tests__/ThemeProvider.test.js +114 -0
  191. package/lib-esm/drafts.d.ts +1 -0
  192. package/lib-esm/drafts.js +2 -1
  193. package/lib-esm/hooks/index.d.ts +1 -0
  194. package/lib-esm/hooks/index.js +2 -1
  195. package/lib-esm/index.d.ts +2 -0
  196. package/lib-esm/index.js +1 -0
  197. package/lib-esm/stories/ActionList.stories.js +3 -3
  198. package/lib-esm/stories/ActionList2.stories.js +1 -1
  199. package/lib-esm/stories/ActionMenu2.stories.js +393 -0
  200. package/lib-esm/stories/Checkbox.stories.js +5 -5
  201. package/lib-esm/stories/Radio.stories.js +121 -0
  202. package/lib-esm/stories/ThemeProvider.stories.js +1 -5
  203. package/lib-esm/stories/useFocusTrap.stories.js +1 -11
  204. package/lib-esm/stories/useFocusZone.stories.js +2 -6
  205. package/package-lock.json +1366 -3544
  206. package/package.json +14 -8
  207. package/script/component-status-project/build.ts +100 -0
  208. package/script/component-status-project/deploy.rb +142 -0
  209. package/src/ActionList2/ActionListContainerContext.tsx +14 -0
  210. package/src/ActionList2/Divider.tsx +13 -8
  211. package/src/ActionList2/Item.tsx +14 -6
  212. package/src/ActionList2/List.tsx +6 -2
  213. package/src/ActionList2/Selection.tsx +9 -0
  214. package/src/ActionMenu2.tsx +116 -0
  215. package/src/BranchName.tsx +2 -1
  216. package/src/Radio.tsx +76 -0
  217. package/src/ThemeProvider.tsx +22 -5
  218. package/src/__tests__/Radio.test.tsx +174 -0
  219. package/src/__tests__/ThemeProvider.test.tsx +116 -0
  220. package/src/__tests__/__snapshots__/BranchName.test.tsx.snap +3 -1
  221. package/src/__tests__/__snapshots__/Radio.test.tsx.snap +16 -0
  222. package/src/drafts.ts +1 -0
  223. package/src/hooks/index.ts +1 -0
  224. package/src/index.ts +2 -0
  225. package/src/stories/ActionMenu2.stories.tsx +605 -0
  226. package/src/stories/Checkbox.stories.tsx +1 -3
  227. package/src/stories/Radio.stories.tsx +126 -0
  228. package/stats.html +1 -1
  229. package/tsconfig.build.json +1 -1
  230. package/tsconfig.json +1 -1
  231. package/docs/content/ActionList2.mdx +0 -379
  232. package/docs/content/BranchName.md +0 -39
  233. package/docs/content/Link.md +0 -29
  234. package/docs/content/TextInput.md +0 -42
@@ -0,0 +1,125 @@
1
+ ---
2
+ title: TextInput
3
+ status: Alpha
4
+ source: https://github.com/primer/react/blob/main/src/TextInput.tsx
5
+ ---
6
+
7
+ import {PropsTable} from '../src/props-table'
8
+ import {Link} from '@primer/components'
9
+
10
+ TextInput is a form component to add default styling to the native text input.
11
+
12
+ **Note:** Don't forget to set `aria-label` to make the TextInput accessible to screen reader users.
13
+
14
+ ## Examples
15
+
16
+ ```jsx live
17
+ <>
18
+ <TextInput aria-label="Zipcode" name="zipcode" placeholder="Zipcode" autoComplete="postal-code" />
19
+
20
+ <TextInput sx={{ml: 4}} aria-label="City" name="city" placeholder="City" contrast />
21
+
22
+ <TextInput
23
+ sx={{ml: 4}}
24
+ icon={SearchIcon}
25
+ aria-label="Zipcode"
26
+ name="zipcode"
27
+ placeholder="Find user"
28
+ autoComplete="postal-code"
29
+ />
30
+ </>
31
+ ```
32
+
33
+ ## Props
34
+
35
+ ### TextInput
36
+
37
+ <PropsTable>
38
+ <PropsTable.Row name="aria-label" type="string" description="Allows input to be accessible." />
39
+ <PropsTable.Row
40
+ name="block"
41
+ type="boolean"
42
+ defaultValue="false"
43
+ description={
44
+ <>
45
+ Adds <InlineCode>display: block</InlineCode> to element
46
+ </>
47
+ }
48
+ />
49
+ <PropsTable.Row
50
+ name="contrast"
51
+ type="boolean"
52
+ defaultValue="false"
53
+ description="Changes background color to a higher contrast color"
54
+ />
55
+ <PropsTable.Row
56
+ name="variant"
57
+ type="'small' | 'large'"
58
+ description="Creates a smaller or larger input than the default."
59
+ />
60
+ <PropsTable.Row
61
+ name="width"
62
+ type={
63
+ <>
64
+ string | number | <Link href="https://styled-system.com/guides/array-props">Array&lt;string | number&gt;</Link>
65
+ </>
66
+ }
67
+ description="Set the width of the input"
68
+ />
69
+ <PropsTable.Row
70
+ name="maxWidth"
71
+ type={
72
+ <>
73
+ string | number | <Link href="https://styled-system.com/guides/array-props">Array&lt;string | number&gt;</Link>
74
+ </>
75
+ }
76
+ description="Set the maximum width of the input"
77
+ />
78
+ <PropsTable.Row
79
+ name="minWidth"
80
+ type={
81
+ <>
82
+ string | number | <Link href="https://styled-system.com/guides/array-props">Array&lt;string | number&gt;</Link>
83
+ </>
84
+ }
85
+ description="Set the minimum width of the input"
86
+ />
87
+ <PropsTable.Row
88
+ name="icon"
89
+ type="React.ComponentType"
90
+ description="An Octicon React component. To be used inside of input. Positioned on the left edge."
91
+ />
92
+ <PropsTable.SxRow />
93
+ <PropsTable.RefRow
94
+ elementType="input"
95
+ refType="HTMLInputElement"
96
+ description="A ref to the input element rendered by this component. Note: this is not the outermost element rendered by TextInput. There is also a div wrapper for which a ref is not accepted."
97
+ />
98
+ <PropsTable.PassthroughPropsRow
99
+ elementName="input"
100
+ passthroughPropsLink={
101
+ <Link href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes">MDN</Link>
102
+ }
103
+ />
104
+ </PropsTable>
105
+
106
+ ## Status
107
+
108
+ <ComponentChecklist
109
+ items={{
110
+ propsDocumented: true,
111
+ noUnnecessaryDeps: true,
112
+ adaptsToThemes: true,
113
+ adaptsToScreenSizes: true,
114
+ fullTestCoverage: false,
115
+ usedInProduction: true,
116
+ usageExamplesDocumented: false,
117
+ hasStorybookStories: false,
118
+ designReviewed: false,
119
+ a11yReviewed: false,
120
+ stableApi: false,
121
+ addressedApiFeedback: false,
122
+ hasDesignGuidelines: false,
123
+ hasFigmaComponent: false
124
+ }}
125
+ />
@@ -0,0 +1,484 @@
1
+ ---
2
+ title: ActionList v2
3
+ status: Alpha
4
+ source: https://github.com/primer/react/tree/main/src/ActionList2
5
+ storybook: '/react/storybook?path=/story/composite-components-actionlist2'
6
+ description: An ActionList is a list of items that can be activated or selected. ActionList is the base component for many menu-type components, including DropdownMenu and ActionMenu.
7
+ ---
8
+
9
+ import {Box, Avatar, Link} from '@primer/components'
10
+ import {ActionList} from '@primer/components/drafts'
11
+ import {LinkIcon, AlertIcon, ArrowRightIcon} from '@primer/octicons-react'
12
+ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code'
13
+
14
+ <Box sx={{border: '1px solid', borderColor: 'border.default', borderRadius: 2, padding: 6, marginBottom: 3}}>
15
+ <ActionList sx={{width: 320}}>
16
+ <ActionList.Item>
17
+ <ActionList.LeadingVisual>
18
+ <LinkIcon />
19
+ </ActionList.LeadingVisual>
20
+ github.com/primer
21
+ <ActionList.Description variant="block">
22
+ A React implementation of GitHub's Primer Design System
23
+ </ActionList.Description>
24
+ </ActionList.Item>
25
+ <ActionList.Item>
26
+ <ActionList.LeadingVisual>
27
+ <Avatar src="https://github.com/mona.png" />
28
+ </ActionList.LeadingVisual>
29
+ mona
30
+ <ActionList.Description>Monalisa Octocat</ActionList.Description>
31
+ </ActionList.Item>
32
+ <ActionList.Item variant="danger">
33
+ <ActionList.LeadingVisual>
34
+ <AlertIcon />
35
+ </ActionList.LeadingVisual>
36
+ 4 vulnerabilities
37
+ <ActionList.TrailingVisual>
38
+ <ArrowRightIcon />
39
+ </ActionList.TrailingVisual>
40
+ </ActionList.Item>
41
+ </ActionList>
42
+ </Box>
43
+
44
+ ```js
45
+ import {ActionList} from '@primer/components/drafts'
46
+ ```
47
+
48
+ ## Examples
49
+
50
+ ### Minimal example
51
+
52
+ ```javascript live noinline
53
+ // import {ActionList} from '@primer/components/drafts'
54
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
55
+
56
+ render(
57
+ <ActionList>
58
+ <ActionList.Item>New file</ActionList.Item>
59
+ <ActionList.Item>Copy link</ActionList.Item>
60
+ <ActionList.Item>Edit file</ActionList.Item>
61
+ <ActionList.Divider />
62
+ <ActionList.Item variant="danger">Delete file</ActionList.Item>
63
+ </ActionList>
64
+ )
65
+ ```
66
+
67
+ ### With leading visual
68
+
69
+ Leading 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.
70
+
71
+ <!-- prettier-ignore -->
72
+ ```javascript live noinline
73
+ // import {ActionList} from '@primer/components/drafts'
74
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
75
+
76
+ render(
77
+ <ActionList>
78
+ <ActionList.Item>
79
+ <ActionList.LeadingVisual><LinkIcon /></ActionList.LeadingVisual>
80
+ github.com/primer
81
+ </ActionList.Item>
82
+ <ActionList.Item variant="danger">
83
+ <ActionList.LeadingVisual><AlertIcon /></ActionList.LeadingVisual>
84
+ 4 vulnerabilities
85
+ </ActionList.Item>
86
+ <ActionList.Item>
87
+ <ActionList.LeadingVisual><Avatar src="https://github.com/mona.png" /></ActionList.LeadingVisual>
88
+ mona
89
+ </ActionList.Item>
90
+ </ActionList>
91
+ )
92
+ ```
93
+
94
+ ### With trailing visual
95
+
96
+ Trailing 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.
97
+
98
+ ```javascript live noinline
99
+ // import {ActionList} from '@primer/components/drafts'
100
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
101
+
102
+ render(
103
+ <ActionList>
104
+ <ActionList.Item>
105
+ New file
106
+ <ActionList.TrailingVisual>⌘ + N</ActionList.TrailingVisual>
107
+ </ActionList.Item>
108
+ <ActionList.Item>
109
+ Copy link
110
+ <ActionList.TrailingVisual>⌘ + C</ActionList.TrailingVisual>
111
+ </ActionList.Item>
112
+ <ActionList.Item>
113
+ Edit file
114
+ <ActionList.TrailingVisual>⌘ + E</ActionList.TrailingVisual>
115
+ </ActionList.Item>
116
+ <ActionList.Item variant="danger">
117
+ Delete file
118
+ <ActionList.TrailingVisual>⌫</ActionList.TrailingVisual>
119
+ </ActionList.Item>
120
+ </ActionList>
121
+ )
122
+ ```
123
+
124
+ ### With description and dividers
125
+
126
+ Item 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.
127
+
128
+ ```javascript live noinline
129
+ // import {ActionList} from '@primer/components/drafts'
130
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
131
+
132
+ render(
133
+ <ActionList showDividers>
134
+ <ActionList.Item>
135
+ <ActionList.LeadingVisual>
136
+ <Avatar src="https://github.com/mona.png" />
137
+ </ActionList.LeadingVisual>
138
+ mona
139
+ <ActionList.Description>Monalisa Octocat</ActionList.Description>
140
+ </ActionList.Item>
141
+ <ActionList.Item>
142
+ <ActionList.LeadingVisual>
143
+ <Avatar src="https://github.com/hubot.png" />
144
+ </ActionList.LeadingVisual>
145
+ hubot
146
+ <ActionList.Description>Hubot</ActionList.Description>
147
+ </ActionList.Item>
148
+ <ActionList.Item>
149
+ <ActionList.LeadingVisual>
150
+ <Avatar src="https://github.com/primer-css.png" />
151
+ </ActionList.LeadingVisual>
152
+ primer-css
153
+ <ActionList.Description>GitHub Design Systems Bot</ActionList.Description>
154
+ </ActionList.Item>
155
+ </ActionList>
156
+ )
157
+ ```
158
+
159
+ ### With links
160
+
161
+ When you want to add links to the List instead of actions, use `ActionList.LinkItem`
162
+
163
+ <!-- prettier-ignore -->
164
+ ```javascript live noinline
165
+ // import {ActionList} from '@primer/components/drafts'
166
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
167
+
168
+ render(
169
+ <ActionList>
170
+ <ActionList.LinkItem href="https://github.com/primer">
171
+ <ActionList.LeadingVisual>
172
+ <LinkIcon />
173
+ </ActionList.LeadingVisual>
174
+ github/primer
175
+ </ActionList.LinkItem>
176
+ <ActionList.LinkItem as={ReactRouterLink} to="/">
177
+ <ActionList.LeadingVisual>
178
+ <LawIcon />
179
+ </ActionList.LeadingVisual>
180
+ MIT License
181
+ </ActionList.LinkItem>
182
+ <ActionList.LinkItem
183
+ href="https://github.com/primer/react/stargazers"
184
+ target="_blank"
185
+ rel="noopener noreferrer"
186
+ >
187
+ <ActionList.LeadingVisual>
188
+ <StarIcon />
189
+ </ActionList.LeadingVisual>
190
+ 1.4k stars
191
+ </ActionList.LinkItem>
192
+ </ActionList>
193
+ )
194
+ ```
195
+
196
+ ### With groups
197
+
198
+ ```javascript live noinline
199
+ // import {ActionList} from '@primer/components/drafts'
200
+ const {ActionList} = drafts // ignore docs silliness; import like that ↑
201
+
202
+ const SelectFields = () => {
203
+ const [options, setOptions] = React.useState([
204
+ {text: 'Status', selected: true},
205
+ {text: 'Stage', selected: true},
206
+ {text: 'Assignee', selected: true},
207
+ {text: 'Team', selected: true},
208
+ {text: 'Estimate', selected: false},
209
+ {text: 'Due Date', selected: false}
210
+ ])
211
+
212
+ const visibleOptions = options.filter(option => option.selected)
213
+ const hiddenOptions = options.filter(option => !option.selected)
214
+
215
+ const toggle = text => {
216
+ setOptions(
217
+ options.map(option => {
218
+ if (option.text === text) option.selected = !option.selected
219
+ return option
220
+ })
221
+ )
222
+ }
223
+
224
+ return (
225
+ <ActionList selectionVariant="multiple">
226
+ <ActionList.Group title="Visible fields">
227
+ {visibleOptions.map(option => (
228
+ <ActionList.Item key={option.text} selected={true} onSelect={() => toggle(option.text)}>
229
+ {option.text}
230
+ </ActionList.Item>
231
+ ))}
232
+ </ActionList.Group>
233
+ <ActionList.Group
234
+ title="Hidden fields"
235
+ selectionVariant={
236
+ /** selectionVariant override on Group: disable selection if there are no options */
237
+ hiddenOptions.length ? 'multiple' : false
238
+ }
239
+ >
240
+ {hiddenOptions.map((option, index) => (
241
+ <ActionList.Item key={option.text} selected={false} onSelect={() => toggle(option.text)}>
242
+ {option.text}
243
+ </ActionList.Item>
244
+ ))}
245
+ {hiddenOptions.length === 0 && <ActionList.Item disabled>No hidden fields</ActionList.Item>}
246
+ </ActionList.Group>
247
+ </ActionList>
248
+ )
249
+ }
250
+
251
+ render(<SelectFields />)
252
+ ```
253
+
254
+ ## Props
255
+
256
+ ### ActionList
257
+
258
+ <PropsTable>
259
+ <PropsTableRow
260
+ name="children"
261
+ required
262
+ type="ActionList.Item[] | ActionList.LinkItem[] | ActionList.Group[]"
263
+ />
264
+ <PropsTableRow
265
+ name="variant"
266
+ type="'inset' | 'full'"
267
+ defaultValue="'inset'"
268
+ description={
269
+ <>
270
+ <InlineCode>inset</InlineCode> children are offset (vertically and horizontally) from list edges.{' '}
271
+ <InlineCode>full</InlineCode> children are flush (vertically and horizontally) with list edges
272
+ </>
273
+ }
274
+ />
275
+ <PropsTableRow
276
+ name="selectionVariant"
277
+ type="'single' | 'multiple'"
278
+ description="Whether multiple items or a single item can be selected."
279
+ />
280
+ <PropsTableRow
281
+ name="showDivider"
282
+ type="boolean"
283
+ defaultValue="false"
284
+ description="Display a divider above each item in this list when it does not follow a header or divider."
285
+ />
286
+ <PropsTableRow
287
+ name="role"
288
+ type={
289
+ <Link href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles">AriaRole</Link>
290
+ }
291
+ description={
292
+ <>
293
+ ARIA role describing the function of the list. <InlineCode>listbox</InlineCode> and{' '}
294
+ <InlineCode>menu</InlineCode> are a common values.
295
+ </>
296
+ }
297
+ />
298
+ <PropsTableSxRow />
299
+ </PropsTable>
300
+
301
+ ### ActionList.Item
302
+
303
+ <PropsTable>
304
+ <PropsTableRow
305
+ name="children"
306
+ required
307
+ type="React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual"
308
+ />
309
+ <PropsTableRow
310
+ name="variant"
311
+ type="'default' | 'danger'"
312
+ defaultValue="'default'"
313
+ description={
314
+ <>
315
+ <InlineCode>danger</InlineCode> indicates that the item is destructive.
316
+ </>
317
+ }
318
+ />
319
+ <PropsTableRow
320
+ name="onSelect"
321
+ type="(event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLLIElement>) => void"
322
+ description="Callback that is called when the item is selected using either the mouse or keyboard."
323
+ />
324
+ <PropsTableRow
325
+ name="selected"
326
+ type="boolean"
327
+ defaultValue="false"
328
+ description="Indicate whether the item is selected. Only applies to items that can be selected."
329
+ />
330
+ <PropsTableRow
331
+ name="disabled"
332
+ type="boolean"
333
+ defaultValue="false"
334
+ description="Items that are disabled can not be clicked, selected, or navigated to."
335
+ />
336
+ <PropsTableRow
337
+ name="role"
338
+ type={
339
+ <Link href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles">AriaRole</Link>
340
+ }
341
+ description={
342
+ <>
343
+ ARIA role describing the function of the item. <InlineCode>option</InlineCode> is a common value.
344
+ </>
345
+ }
346
+ />
347
+ <PropsTableSxRow />
348
+ </PropsTable>
349
+
350
+ ### ActionList.LinkItem
351
+
352
+ <PropsTable>
353
+ <PropsTableRow
354
+ name="children"
355
+ required
356
+ type="React.ReactNode | ActionList.LeadingVisual | ActionList.Description | ActionList.TrailingVisual"
357
+ />
358
+ <PropsTableBasePropRows
359
+ elementType="a"
360
+ isPolymorphic
361
+ refType="HTMLAnchorElement"
362
+ passthroughPropsLink={
363
+ <Link href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#Attributes">MDN</Link>
364
+ }
365
+ />
366
+ </PropsTable>
367
+
368
+ ### ActionList.LeadingVisual
369
+
370
+ <PropsTable>
371
+ <PropsTableRow
372
+ name="children"
373
+ required
374
+ type="React.ReactNode"
375
+ description="Icon (or similar) positioned before item text."
376
+ />
377
+ <PropsTableSxRow />
378
+ </PropsTable>
379
+
380
+ ### ActionList.TrailingVisual
381
+
382
+ <PropsTable>
383
+ <PropsTableRow
384
+ name="children"
385
+ required
386
+ type="React.ReactNode"
387
+ description="Visual positioned after item text."
388
+ />
389
+ <PropsTableSxRow />
390
+ </PropsTable>
391
+
392
+ ### ActionList.Description
393
+
394
+ <PropsTable>
395
+ <PropsTableRow name="children" required type="React.ReactNode" />
396
+ <PropsTableRow
397
+ name="variant"
398
+ type="'inline' | 'block'"
399
+ defaultValue="'inline'"
400
+ description={
401
+ <>
402
+ <InlineCode>inline</InlineCode> descriptions are positioned beside primary text. <InlineCode>block</InlineCode>{' '}
403
+ descriptions are positioned below primary text.
404
+ </>
405
+ }
406
+ />
407
+ <PropsTableSxRow />
408
+ </PropsTable>
409
+
410
+ ### ActionList.Group
411
+
412
+ <PropsTable>
413
+ <PropsTableRow name="children" required type="ActionList.Item[] | ActionList.LinkItem[]" />
414
+ <PropsTableRow name="title" type="string" description="Title of the group." />
415
+ <PropsTableRow
416
+ name="auxiliaryText"
417
+ type="string"
418
+ description="Secondary text that provides additional information about the group."
419
+ />
420
+ <PropsTableRow
421
+ name="variant"
422
+ type="'filled' | 'subtle'"
423
+ defaultValue="'subtle'"
424
+ description={
425
+ <>
426
+ <InlineCode>inline</InlineCode> descriptions are positioned beside primary text. <InlineCode>block</InlineCode>{' '}
427
+ descriptions are positioned below primary text.
428
+ </>
429
+ }
430
+ />
431
+ <PropsTableRow
432
+ name="selectionVariant"
433
+ type="'single' | 'multiple' | false"
434
+ description={
435
+ <>
436
+ Set <InlineCode>selectionVariant</InlineCode> at the group level.
437
+ </>
438
+ }
439
+ />
440
+ <PropsTableRow
441
+ name="role"
442
+ type={
443
+ <Link href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques#roles">AriaRole</Link>
444
+ }
445
+ description={
446
+ <>
447
+ ARIA role describing the function of the list inside the group. <InlineCode>listbox</InlineCode> and{' '}
448
+ <InlineCode>menu</InlineCode> are a common values.
449
+ </>
450
+ }
451
+ />
452
+ <PropsTableSxRow />
453
+ </PropsTable>
454
+
455
+ ## Status
456
+
457
+ <ComponentChecklist
458
+ items={{
459
+ propsDocumented: true,
460
+ noUnnecessaryDeps: true,
461
+ adaptsToThemes: true,
462
+ adaptsToScreenSizes: true,
463
+ fullTestCoverage: false,
464
+ usedInProduction: false,
465
+ usageExamplesDocumented: true,
466
+ hasStorybookStories: true,
467
+ designReviewed: false,
468
+ a11yReviewed: false,
469
+ stableApi: false,
470
+ addressedApiFeedback: false,
471
+ hasDesignGuidelines: true,
472
+ hasFigmaComponent: true
473
+ }}
474
+ />
475
+
476
+ ## Further reading
477
+
478
+ - [Interface guidelines: Action List](https://primer.style/design/components/action-list)
479
+
480
+ ## Related components
481
+
482
+ - [ActionMenu](/drafts/ActionMenu2)
483
+ - [DropdownMenu](/DropdownMenu)
484
+ - [SelectPanel](/SelectPanel)