@webtides/element-library 0.3.1 → 0.5.0

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 (252) hide show
  1. package/CHANGELOG.md +300 -0
  2. package/README.md +72 -56
  3. package/all.js +16 -0
  4. package/catalog.js +17 -1
  5. package/custom-elements.json +15912 -10065
  6. package/package.json +1 -1
  7. package/src/components/accordion/accordion.changelog.md +11 -0
  8. package/src/components/accordion/accordion.js +15 -3
  9. package/src/components/accordion/accordion.readme.md +27 -1
  10. package/src/components/accordion/accordion.style.js +19 -0
  11. package/src/components/app-bar/app-bar.changelog.md +24 -0
  12. package/src/components/app-bar/app-bar.define.js +3 -0
  13. package/src/components/app-bar/app-bar.js +91 -0
  14. package/src/components/app-bar/app-bar.readme.md +130 -0
  15. package/src/components/app-bar/app-bar.style.js +103 -0
  16. package/src/components/app-frame/app-frame.changelog.md +59 -0
  17. package/src/components/app-frame/app-frame.define.js +3 -0
  18. package/src/components/app-frame/app-frame.events.js +6 -0
  19. package/src/components/app-frame/app-frame.js +1085 -0
  20. package/src/components/app-frame/app-frame.readme.md +425 -0
  21. package/src/components/app-frame/app-frame.style.js +534 -0
  22. package/src/components/button/button.changelog.md +21 -0
  23. package/src/components/button/button.events.js +3 -0
  24. package/src/components/button/button.js +145 -3
  25. package/src/components/button/button.readme.md +72 -4
  26. package/src/components/button/button.style.js +167 -8
  27. package/src/components/button-group/button-group.changelog.md +10 -0
  28. package/src/components/button-group/button-group.readme.md +2 -0
  29. package/src/components/button-group/button-group.style.js +6 -2
  30. package/src/components/checkbox-group-field/checkbox-group-field.changelog.md +6 -0
  31. package/src/components/checkbox-group-field/checkbox-group-field.js +7 -2
  32. package/src/components/checkbox-group-field/checkbox-group-field.readme.md +23 -1
  33. package/src/components/combobox-field/combobox-field.changelog.md +6 -0
  34. package/src/components/combobox-field/combobox-field.readme.md +8 -0
  35. package/src/components/combobox-field/combobox-field.style.js +2 -0
  36. package/src/components/date-field/date-field.changelog.md +6 -0
  37. package/src/components/date-field/date-field.readme.md +10 -0
  38. package/src/components/date-field/date-field.style.js +8 -3
  39. package/src/components/description-list/description-list.changelog.md +42 -0
  40. package/src/components/description-list/description-list.define.js +3 -0
  41. package/src/components/description-list/description-list.js +49 -0
  42. package/src/components/description-list/description-list.readme.md +161 -0
  43. package/src/components/description-list/description-list.style.js +169 -0
  44. package/src/components/dialog/dialog.changelog.md +7 -0
  45. package/src/components/dialog/dialog.readme.md +5 -0
  46. package/src/components/dialog/dialog.style.js +17 -2
  47. package/src/components/divider/divider.changelog.md +6 -0
  48. package/src/components/divider/divider.readme.md +1 -1
  49. package/src/components/divider/divider.style.js +6 -0
  50. package/src/components/drawer/drawer.changelog.md +7 -0
  51. package/src/components/drawer/drawer.readme.md +7 -6
  52. package/src/components/drawer/drawer.style.js +35 -2
  53. package/src/components/dropdown/dropdown.readme.md +6 -1
  54. package/src/components/file-field/file-field.changelog.md +8 -0
  55. package/src/components/file-field/file-field.js +135 -5
  56. package/src/components/file-field/file-field.readme.md +35 -6
  57. package/src/components/file-field/file-field.style.js +71 -0
  58. package/src/components/form-field/form-field.js +1 -1
  59. package/src/components/input-field/input-field.changelog.md +10 -0
  60. package/src/components/input-field/input-field.js +192 -14
  61. package/src/components/input-field/input-field.readme.md +88 -2
  62. package/src/components/input-field/input-field.style.js +2 -0
  63. package/src/components/list/list.changelog.md +30 -0
  64. package/src/components/list/list.define.js +3 -0
  65. package/src/components/list/list.js +68 -0
  66. package/src/components/list/list.readme.md +123 -0
  67. package/src/components/list/list.style.js +56 -0
  68. package/src/components/list-item/list-item.changelog.md +40 -0
  69. package/src/components/list-item/list-item.define.js +3 -0
  70. package/src/components/list-item/list-item.js +130 -0
  71. package/src/components/list-item/list-item.readme.md +144 -0
  72. package/src/components/list-item/list-item.style.js +246 -0
  73. package/src/components/menu/menu.changelog.md +44 -0
  74. package/src/components/menu/menu.define.js +3 -0
  75. package/src/components/menu/menu.events.js +5 -0
  76. package/src/components/menu/menu.js +793 -0
  77. package/src/components/menu/menu.readme.md +313 -0
  78. package/src/components/menu/menu.style.js +59 -0
  79. package/src/components/menu-group/menu-group.changelog.md +20 -0
  80. package/src/components/menu-group/menu-group.define.js +3 -0
  81. package/src/components/menu-group/menu-group.js +44 -0
  82. package/src/components/menu-group/menu-group.readme.md +74 -0
  83. package/src/components/menu-group/menu-group.style.js +38 -0
  84. package/src/components/menu-item/menu-item.changelog.md +32 -0
  85. package/src/components/menu-item/menu-item.define.js +3 -0
  86. package/src/components/menu-item/menu-item.js +168 -0
  87. package/src/components/menu-item/menu-item.readme.md +132 -0
  88. package/src/components/menu-item/menu-item.style.js +117 -0
  89. package/src/components/nav/nav.changelog.md +35 -0
  90. package/src/components/nav/nav.define.js +3 -0
  91. package/src/components/nav/nav.js +212 -0
  92. package/src/components/nav/nav.readme.md +248 -0
  93. package/src/components/nav/nav.style.js +269 -0
  94. package/src/components/nav-item/nav-item.changelog.md +25 -0
  95. package/src/components/nav-item/nav-item.define.js +3 -0
  96. package/src/components/nav-item/nav-item.js +75 -0
  97. package/src/components/nav-item/nav-item.readme.md +111 -0
  98. package/src/components/nav-item/nav-item.style.js +159 -0
  99. package/src/components/otp-field/otp-field.changelog.md +6 -0
  100. package/src/components/otp-field/otp-field.readme.md +8 -0
  101. package/src/components/otp-field/otp-field.style.js +8 -3
  102. package/src/components/pagination/pagination.changelog.md +8 -0
  103. package/src/components/pagination/pagination.js +123 -49
  104. package/src/components/pagination/pagination.readme.md +24 -6
  105. package/src/components/pagination/pagination.style.js +11 -1
  106. package/src/components/password-field/password-field.changelog.md +7 -0
  107. package/src/components/password-field/password-field.readme.md +11 -1
  108. package/src/components/password-field/password-field.style.js +2 -0
  109. package/src/components/popover/popover.changelog.md +6 -0
  110. package/src/components/popover/popover.style.js +1 -0
  111. package/src/components/radio-field/radio-field.changelog.md +6 -0
  112. package/src/components/radio-field/radio-field.js +7 -2
  113. package/src/components/radio-field/radio-field.readme.md +23 -1
  114. package/src/components/scroll-to-top/scroll-to-top.changelog.md +7 -5
  115. package/src/components/scroll-to-top/scroll-to-top.js +16 -12
  116. package/src/components/scroll-to-top/scroll-to-top.readme.md +2 -0
  117. package/src/components/segmented-field/segmented-field.changelog.md +27 -0
  118. package/src/components/segmented-field/segmented-field.define.js +3 -0
  119. package/src/components/segmented-field/segmented-field.js +175 -0
  120. package/src/components/segmented-field/segmented-field.readme.md +140 -0
  121. package/src/components/segmented-field/segmented-field.style.js +193 -0
  122. package/src/components/splitter/splitter.changelog.md +24 -0
  123. package/src/components/splitter/splitter.define.js +3 -0
  124. package/src/components/splitter/splitter.events.js +4 -0
  125. package/src/components/splitter/splitter.js +237 -0
  126. package/src/components/splitter/splitter.readme.md +164 -0
  127. package/src/components/splitter/splitter.style.js +100 -0
  128. package/src/components/status-bar/status-bar.changelog.md +25 -0
  129. package/src/components/status-bar/status-bar.define.js +3 -0
  130. package/src/components/status-bar/status-bar.js +74 -0
  131. package/src/components/status-bar/status-bar.readme.md +139 -0
  132. package/src/components/status-bar/status-bar.style.js +122 -0
  133. package/src/components/tab-group/tab-group.changelog.md +7 -0
  134. package/src/components/tab-group/tab-group.js +30 -9
  135. package/src/components/tab-group/tab-group.readme.md +14 -0
  136. package/src/components/textarea-field/textarea-field.changelog.md +6 -0
  137. package/src/components/textarea-field/textarea-field.js +14 -1
  138. package/src/components/textarea-field/textarea-field.readme.md +23 -1
  139. package/src/components/toast/toast.changelog.md +6 -0
  140. package/src/components/toast/toast.readme.md +5 -3
  141. package/src/components/toast/toast.style.js +22 -6
  142. package/src/components/toolbar/toolbar.changelog.md +24 -0
  143. package/src/components/toolbar/toolbar.define.js +3 -0
  144. package/src/components/toolbar/toolbar.js +233 -0
  145. package/src/components/toolbar/toolbar.readme.md +156 -0
  146. package/src/components/toolbar/toolbar.style.js +49 -0
  147. package/src/components/tooltip/tooltip.changelog.md +11 -0
  148. package/src/components/tooltip/tooltip.js +51 -4
  149. package/src/components/tooltip/tooltip.readme.md +26 -1
  150. package/src/components/tree/tree.changelog.md +23 -0
  151. package/src/components/tree/tree.define.js +3 -0
  152. package/src/components/tree/tree.js +138 -0
  153. package/src/components/tree/tree.readme.md +119 -0
  154. package/src/components/tree/tree.style.js +16 -0
  155. package/src/components/tree-item/tree-item.changelog.md +23 -0
  156. package/src/components/tree-item/tree-item.define.js +3 -0
  157. package/src/components/tree-item/tree-item.events.js +3 -0
  158. package/src/components/tree-item/tree-item.js +246 -0
  159. package/src/components/tree-item/tree-item.readme.md +128 -0
  160. package/src/components/tree-item/tree-item.style.js +226 -0
  161. package/src/styles/appearance.style.js +47 -0
  162. package/src/styles/choice-group.style.js +27 -1
  163. package/src/styles/input-control.style.js +87 -0
  164. package/src/styles/modal.style.js +14 -1
  165. package/src/styles/native.css +100 -0
  166. package/src/styles/size.style.js +41 -0
  167. package/src/utils/floating.js +15 -1
  168. package/src/utils/focus.js +69 -0
  169. package/src/utils/options.js +35 -0
  170. package/src/utils/scroll.js +24 -0
  171. package/src/utils/text-entry-attributes.js +13 -0
  172. package/types/all.d.ts +16 -0
  173. package/types/src/components/accordion/accordion.d.ts +3 -1
  174. package/types/src/components/app-bar/app-bar.d.ts +43 -0
  175. package/types/src/components/app-bar/app-bar.define.d.ts +1 -0
  176. package/types/src/components/app-bar/app-bar.style.d.ts +2 -0
  177. package/types/src/components/app-frame/app-frame.d.ts +497 -0
  178. package/types/src/components/app-frame/app-frame.define.d.ts +1 -0
  179. package/types/src/components/app-frame/app-frame.events.d.ts +7 -0
  180. package/types/src/components/app-frame/app-frame.style.d.ts +8 -0
  181. package/types/src/components/button/button.d.ts +61 -0
  182. package/types/src/components/button/button.events.d.ts +4 -0
  183. package/types/src/components/checkbox-group-field/checkbox-group-field.d.ts +5 -2
  184. package/types/src/components/combobox-field/combobox-field.d.ts +10 -0
  185. package/types/src/components/date-field/date-field.d.ts +10 -0
  186. package/types/src/components/description-list/description-list.d.ts +34 -0
  187. package/types/src/components/description-list/description-list.define.d.ts +1 -0
  188. package/types/src/components/description-list/description-list.style.d.ts +2 -0
  189. package/types/src/components/file-field/file-field.d.ts +68 -3
  190. package/types/src/components/form-field/form-field.d.ts +1 -1
  191. package/types/src/components/input-field/input-field.d.ts +99 -0
  192. package/types/src/components/list/list.d.ts +41 -0
  193. package/types/src/components/list/list.define.d.ts +1 -0
  194. package/types/src/components/list/list.style.d.ts +2 -0
  195. package/types/src/components/list-item/list-item.d.ts +64 -0
  196. package/types/src/components/list-item/list-item.define.d.ts +1 -0
  197. package/types/src/components/list-item/list-item.style.d.ts +2 -0
  198. package/types/src/components/menu/menu.d.ts +362 -0
  199. package/types/src/components/menu/menu.define.d.ts +1 -0
  200. package/types/src/components/menu/menu.events.d.ts +6 -0
  201. package/types/src/components/menu/menu.style.d.ts +2 -0
  202. package/types/src/components/menu-group/menu-group.d.ts +24 -0
  203. package/types/src/components/menu-group/menu-group.define.d.ts +1 -0
  204. package/types/src/components/menu-group/menu-group.style.d.ts +2 -0
  205. package/types/src/components/menu-item/menu-item.d.ts +80 -0
  206. package/types/src/components/menu-item/menu-item.define.d.ts +1 -0
  207. package/types/src/components/menu-item/menu-item.style.d.ts +2 -0
  208. package/types/src/components/nav/nav.d.ts +103 -0
  209. package/types/src/components/nav/nav.define.d.ts +1 -0
  210. package/types/src/components/nav/nav.style.d.ts +2 -0
  211. package/types/src/components/nav-item/nav-item.d.ts +39 -0
  212. package/types/src/components/nav-item/nav-item.define.d.ts +1 -0
  213. package/types/src/components/nav-item/nav-item.style.d.ts +2 -0
  214. package/types/src/components/otp-field/otp-field.d.ts +10 -0
  215. package/types/src/components/pagination/pagination.d.ts +31 -2
  216. package/types/src/components/password-field/password-field.d.ts +10 -0
  217. package/types/src/components/radio-field/radio-field.d.ts +5 -2
  218. package/types/src/components/scroll-to-top/scroll-to-top.d.ts +6 -5
  219. package/types/src/components/segmented-field/segmented-field.d.ts +85 -0
  220. package/types/src/components/segmented-field/segmented-field.define.d.ts +1 -0
  221. package/types/src/components/segmented-field/segmented-field.style.d.ts +2 -0
  222. package/types/src/components/splitter/splitter.d.ts +127 -0
  223. package/types/src/components/splitter/splitter.define.d.ts +1 -0
  224. package/types/src/components/splitter/splitter.events.d.ts +5 -0
  225. package/types/src/components/splitter/splitter.style.d.ts +2 -0
  226. package/types/src/components/status-bar/status-bar.d.ts +44 -0
  227. package/types/src/components/status-bar/status-bar.define.d.ts +1 -0
  228. package/types/src/components/status-bar/status-bar.style.d.ts +2 -0
  229. package/types/src/components/tab-group/tab-group.d.ts +17 -0
  230. package/types/src/components/textarea-field/textarea-field.d.ts +7 -0
  231. package/types/src/components/toolbar/toolbar.d.ts +96 -0
  232. package/types/src/components/toolbar/toolbar.define.d.ts +1 -0
  233. package/types/src/components/toolbar/toolbar.style.d.ts +2 -0
  234. package/types/src/components/tooltip/tooltip.d.ts +26 -0
  235. package/types/src/components/tree/tree.d.ts +62 -0
  236. package/types/src/components/tree/tree.define.d.ts +1 -0
  237. package/types/src/components/tree/tree.style.d.ts +2 -0
  238. package/types/src/components/tree-item/tree-item.d.ts +106 -0
  239. package/types/src/components/tree-item/tree-item.define.d.ts +1 -0
  240. package/types/src/components/tree-item/tree-item.events.d.ts +4 -0
  241. package/types/src/components/tree-item/tree-item.style.d.ts +2 -0
  242. package/types/src/styles/appearance.style.d.ts +31 -0
  243. package/types/src/styles/choice-group.style.d.ts +1 -1
  244. package/types/src/styles/input-control.style.d.ts +15 -0
  245. package/types/src/styles/modal.style.d.ts +5 -0
  246. package/types/src/styles/size.style.d.ts +24 -0
  247. package/types/src/utils/floating.d.ts +11 -0
  248. package/types/src/utils/focus.d.ts +25 -0
  249. package/types/src/utils/options.d.ts +17 -0
  250. package/types/src/utils/scroll.d.ts +11 -0
  251. package/types/src/utils/text-entry-attributes.d.ts +10 -0
  252. package/web-types.json +2935 -308
@@ -0,0 +1,248 @@
1
+ # Nav
2
+
3
+ `nav` holds the destinations of an application: the places the user goes to all the time. Each destination is an [`el-nav-item`](../nav-item/nav-item.readme.md), a link with an icon and a short text, and the one of the current view is marked.
4
+
5
+ It has three layouts. A **bar** for the lower edge of a phone, in reach of the thumb. A **rail** for the side of a wider screen: a narrow column of icons. A **list** for a sidebar: an icon and its text in one row. In the frame of an application the page writes the destinations once, and they are a bar or a column by the width.
6
+
7
+ ## How to use
8
+
9
+ #### Install
10
+
11
+ ```sh
12
+ npm i --save @webtides/element-library
13
+ ```
14
+
15
+ #### Use
16
+
17
+ ```js
18
+ import '@webtides/element-library/nav/define';
19
+ import '@webtides/element-library/nav-item/define';
20
+ ```
21
+
22
+ ```html
23
+ <el-nav label="Main">
24
+ <el-nav-item href="/inbox" current="true"><svg slot="icon" aria-hidden="true">…</svg>Inbox</el-nav-item>
25
+ <el-nav-item href="/today"><svg slot="icon" aria-hidden="true">…</svg>Today</el-nav-item>
26
+ <el-nav-item href="/done"><svg slot="icon" aria-hidden="true">…</svg>Done</el-nav-item>
27
+ </el-nav>
28
+ ```
29
+
30
+ > Boolean attributes are passed as strings (`current="true"`), matching the rest of the library.
31
+
32
+ ## API
33
+
34
+ #### Properties/Attributes
35
+
36
+ | Name | Type | Default | Description |
37
+ | --- | --- | --- | --- |
38
+ | `label` | `string` | `''` | The name of the navigation for assistive technology. A page with more than one navigation needs it to tell them apart. |
39
+ | `layout` | `'auto' \| 'bar' \| 'rail' \| 'list'` | `'auto'` | How the destinations lie: `bar`, a row in equal parts; `rail`, a narrow column; `list`, rows of an icon and its text; `auto`, a bar, and in the column at the side of an `el-app-frame` what `column` names. |
40
+ | `column` | `'rail' \| 'list'` | `'rail'` | What the destinations are in the column at the side of an `el-app-frame`, with `layout="auto"`. |
41
+ | `secondary-label` | `string` | `''` | The heading of the second group, and its name for assistive technology. |
42
+ | `labels` | `boolean` | `true` | Whether the destinations show their texts. With `false` they show an icon alone, and their texts as tooltips. |
43
+
44
+ #### Methods
45
+
46
+ _None._
47
+
48
+ #### Events
49
+
50
+ _None._
51
+
52
+ #### Slots
53
+
54
+ | Name | Description |
55
+ | --- | --- |
56
+ | (default) | The destinations: `el-nav-item` elements. |
57
+ | `secondary` | A second group of destinations, below the first: the pages that have no room in a bar. Not shown in a bar. |
58
+ | `end` | The destinations at the lower end of a rail or a list: the settings, the account. Not shown in a bar. |
59
+
60
+ #### CSS Parts
61
+
62
+ | Name | Description |
63
+ | --- | --- |
64
+ | `base` | The navigation landmark (`<nav>`): the surface and its line to the content. |
65
+ | `groups` | The two groups at the top, which scroll where a rail or a list has more destinations than height. |
66
+ | `list` | The list of the destinations. |
67
+ | `secondary` | The second group: its heading and its list. |
68
+ | `secondary-label` | The heading of the second group, which a list shows. |
69
+ | `secondary-list` | The list of the destinations of the second group. |
70
+ | `end` | The list of the destinations at the lower end of a rail or a list. |
71
+ | `tooltip` | The tooltip of a destination that shows an icon alone: an `el-tooltip`. |
72
+
73
+ #### CSS Custom Properties
74
+
75
+ | Name | Default | Description |
76
+ | -------------------- | ------- | ---------------------------------------------------------------- |
77
+ | `--el-nav-rail-size` | `5rem` | The width of a rail. |
78
+ | `--el-nav-list-size` | `16rem` | The width of a list where its place is as wide as what is in it. |
79
+
80
+ Reads `--el-color-bg` and `--el-color-fg` for its surface and its text, and `--el-color-border` and `--el-border-width` for the line to the content. A list reads `--el-space-1` and `--el-space-2` for the room between and around its rows, and `--el-color-fg-muted`, `--el-font-size-xs` and `--el-space-3` for the heading of its second group. The destinations read the tokens named in the readme of [`el-nav-item`](../nav-item/nav-item.readme.md).
81
+
82
+ ## The bar
83
+
84
+ `layout="bar"`, and what the element is where nothing says otherwise.
85
+
86
+ - **Three to five destinations.** They share the width in equal parts, however long their texts are. More than five do not fit a phone: the fifth is "More" then, and leads to a view with the rest.
87
+ - **A short text.** One word as a rule. A text that does not fit is cut with an ellipsis: it does not wrap, and the bar keeps its height.
88
+ - The `secondary` and the `end` slot are not shown: a bar has no room for another group.
89
+
90
+ ## The rail
91
+
92
+ `layout="rail"`: the destinations below each other, in a column of `--el-nav-rail-size`.
93
+
94
+ ```html
95
+ <el-nav label="Main" layout="rail">
96
+ <el-nav-item href="/inbox" current="true"><svg slot="icon" aria-hidden="true">…</svg>Inbox</el-nav-item>
97
+ <el-nav-item href="/today"><svg slot="icon" aria-hidden="true">…</svg>Today</el-nav-item>
98
+ <el-nav-item slot="end" href="/settings"><svg slot="icon" aria-hidden="true">…</svg>Settings</el-nav-item>
99
+ </el-nav>
100
+ ```
101
+
102
+ - **Two groups.** The destinations at the top, and the ones in the `end` slot at the lower end: the settings, the account. Each group is a list to assistive technology. A third one, below the first, is the `secondary` slot: see below.
103
+ - **As high as its place.** Give the rail a place with a height: the column of an `el-app-frame`, or an element the page sizes. With more destinations than the height takes, the group at the top scrolls, and the one at the lower end stays in view.
104
+ - **A line to the content** at the side that faces it, which follows the reading direction.
105
+
106
+ ## The list
107
+
108
+ `layout="list"`: the destinations below each other, each a row with its icon and its text beside it. What a sidebar is.
109
+
110
+ ```html
111
+ <el-nav label="Main" layout="list" secondary-label="More">
112
+ <el-nav-item href="/inbox" current="true"><svg slot="icon" aria-hidden="true">…</svg>Inbox</el-nav-item>
113
+ <el-nav-item href="/today"><svg slot="icon" aria-hidden="true">…</svg>Today</el-nav-item>
114
+ <el-nav-item slot="secondary" href="/news"><svg slot="icon" aria-hidden="true">…</svg>What's new</el-nav-item>
115
+ <el-nav-item slot="end" href="/settings"><svg slot="icon" aria-hidden="true">…</svg>Settings</el-nav-item>
116
+ </el-nav>
117
+ ```
118
+
119
+ - **As wide as its place.** In a column of 20rem the rows are 20rem wide, in one of 12rem they are 12rem, and a text that does not fit is cut. Where the place is as wide as what is in it, the list is `--el-nav-list-size` wide (`16rem`): the column of an `el-app-frame` with `narrow-navigation="bar"` is such a place.
120
+ - **As high as its place**, as a rail is. The groups at the top scroll where they have more destinations than height, and the one in the `end` slot stays in view.
121
+ - **A row is as high as a control** (`--el-control-height`), and at least `--el-touch-target` on a touch screen.
122
+ - **The current destination** has a surface behind its whole row and a heavier text. A count in its `badge` slot is at the end of the row.
123
+ - **A line to the content** at the side that faces it, as a rail has.
124
+
125
+ ## A second group
126
+
127
+ The destinations in the `secondary` slot are a group of their own below the first: the pages that have no room among the five of a phone. `secondary-label` is its heading.
128
+
129
+ - **A list** shows the heading over the group.
130
+ - **A rail** shows the group below a line. The heading does not show, and is the name of the group for assistive technology.
131
+ - **A bar** leaves the group out. A phone needs another way to those pages: a "More" destination, or a menu.
132
+
133
+ The group is a list to assistive technology, with `secondary-label` as its name. The heading the eye sees is not read a second time.
134
+
135
+ ## An icon alone
136
+
137
+ `labels="false"` leaves the texts off the screen. A destination keeps its text as the name of its link, so write it as before, and shows it as a tooltip for the pointer and for the focus of the keyboard: beside a rail, above a bar.
138
+
139
+ ```html
140
+ <el-nav label="Main" layout="rail" labels="false">…</el-nav>
141
+ ```
142
+
143
+ The tooltips come with the script. They are `el-tooltip` elements in the shadow root of the element (`::part(tooltip)`), so nothing is added to what the page wrote. The element imports the tooltip, and with it `@floating-ui/dom`. A screen reader has the name already and does not read it twice.
144
+
145
+ ## The links
146
+
147
+ - A destination is a link with an address. The Tab key stops at every one of them: this is a navigation, not a menu, and the arrow keys do nothing.
148
+ - **The current one** has `current="true"`. The page sets it: the element does not know the address of the view.
149
+
150
+ ## In the frame of an application
151
+
152
+ Written once, in the `navigation` slot of an [`el-app-frame`](../app-frame/app-frame.readme.md) with `narrow-navigation="bar"`:
153
+
154
+ ```html
155
+ <el-app-frame narrow-navigation="bar">
156
+ <main id="main">…</main>
157
+ <el-nav slot="navigation" label="Main">
158
+ <el-nav-item href="/inbox" current="true"><svg slot="icon" aria-hidden="true">…</svg>Inbox</el-nav-item>
159
+ <el-nav-item href="/today"><svg slot="icon" aria-hidden="true">…</svg>Today</el-nav-item>
160
+ <el-nav-item slot="end" href="/settings"><svg slot="icon" aria-hidden="true">…</svg>Settings</el-nav-item>
161
+ </el-nav>
162
+ </el-app-frame>
163
+ ```
164
+
165
+ - Where the frame is narrow, its navigation lies at the lower edge, and the destinations are a bar.
166
+ - Where the frame is wide, its navigation is the column at the side, and the destinations are a rail, or a list with `column="list"`.
167
+
168
+ ```html
169
+ <el-nav slot="navigation" label="Main" column="list" secondary-label="More">…</el-nav>
170
+ ```
171
+
172
+ The stylesheets decide, by the width of the frame: the frame tells the element in a CSS property that is inherited, and nothing is written onto it. That holds before any script has run. `column` is an attribute a server writes, so an application can have a list on most of its views and a rail on the ones that need the width themselves, without a script.
173
+
174
+ A list fills a column that has a width: the `--el-app-frame-navigation-size` of the page, or the one the user has set by dragging the edge of the column.
175
+
176
+ In both places the surface reaches the edge of the screen and the destinations stay clear of the home indicator and the notch of a phone: the region says how far its surface reaches. The line to the content is the one of the region.
177
+
178
+ The element is a navigation landmark itself. It goes into the slot without a `nav` around it.
179
+
180
+ A bar alone, with something else in the column of the wide frame, goes into the `footer` slot instead, with `narrow-only="footer"` on the frame.
181
+
182
+ ## With what is no destination
183
+
184
+ A sidebar has more than destinations: the name of the application above them, the account and a form that logs out below them. Those are no destinations, and they are not in the element. Write an element of your own into the `navigation` slot, with the `el-nav` in it:
185
+
186
+ ```html
187
+ <el-app-frame narrow-navigation="bar">
188
+ <div slot="navigation" class="side">
189
+ <a class="side-only" href="/">Tasks</a>
190
+ <el-nav label="Main" column="list">…</el-nav>
191
+ <div class="side-only">
192
+ ada@example.com
193
+ <form method="post" action="/logout"><button>Log out</button></form>
194
+ </div>
195
+ </div>
196
+ <main id="main">…</main>
197
+ </el-app-frame>
198
+ ```
199
+
200
+ ```css
201
+ .side {
202
+ display: flex;
203
+ flex-direction: column;
204
+ block-size: 100%;
205
+ }
206
+
207
+ /* The frame is a container. Its step is 48rem here. */
208
+ @container (width < 48rem) {
209
+ .side-only {
210
+ display: none;
211
+ }
212
+ }
213
+ ```
214
+
215
+ - **The `el-nav` takes its layout from the frame** as one that is in the slot itself: the property of the frame is inherited.
216
+ - **In a column of your element** (a flex column with a height) it takes the height that is left between what is above and below it. Its destinations scroll, and its group at the lower end stays in view. Without that layout it is as high as its destinations, and the column of the frame scrolls as a whole.
217
+ - **Where the frame is narrow**, your element lies at the lower edge with the bar in it. What is no destination is yours to hide there. The frame is a container for the queries of the page (`container-type: inline-size`), so a query by its width needs no script: write the width of `wide-from` into it.
218
+
219
+ ## Alone
220
+
221
+ Outside of a frame the element keeps its destinations clear of the edges of the screen itself (`env(safe-area-inset-*)`, with `viewport-fit=cover` in the viewport of the page): a bar of the home indicator and the sides, a rail of the top, its side and the lower edge. Its place is the business of the page:
222
+
223
+ ```css
224
+ el-nav.bottom {
225
+ position: fixed;
226
+ inset: auto 0 0;
227
+ }
228
+ ```
229
+
230
+ ## The on-screen keyboard
231
+
232
+ A bar does nothing about it, and does not need to. A browser lays its keyboard over the page and leaves the layout as it is: the bar is under the keyboard, and takes no room from what the user types into. Safari on iOS moves the page up while the keyboard is open, to bring the field into view, and back when it closes.
233
+
234
+ A page that asks the browser to resize its content for the keyboard (`interactive-widget=resizes-content` in the viewport) has the bar above the keyboard instead.
235
+
236
+ In an [`el-app-frame`](../app-frame/app-frame.readme.md) the bar lies above the keyboard: the frame is as high as what shows above it, so its header stays in view.
237
+
238
+ ## Server-side rendering
239
+
240
+ The element and its destinations render on a server with `@webtides/element-js-ssr-renderer`. Their look is their stylesheets: the layout, what the column of a frame makes of the destinations, the second group and its heading, the mark of the current destination, the texts that are off the screen and the room for the home indicator are there before the script has run, and nothing moves when the elements take over. The script adds the tooltips.
241
+
242
+ ## Accessibility
243
+
244
+ - A navigation landmark (`<nav>`) with the name of `label`, and in it one list of links, and one more for each of the `secondary` and the `end` slot that has destinations. The list of the second group has the name of `secondary-label`.
245
+ - The current destination has `aria-current="page"`, and is told apart by more than its colour: see the readme of the destination.
246
+ - A destination that shows an icon alone has its text as its name.
247
+ - On a touch screen every destination is at least `--el-touch-target` wide and high, and so is a row of a list.
248
+ - Without a theme the element paints nothing and reads as the page does, in a light and in a dark scheme. The line to the content is a border: it stays where the user forces colours, and it is there without a theme then.
@@ -0,0 +1,269 @@
1
+ import hostStyle from '../../styles/host.style.js';
2
+
3
+ const css = String.raw;
4
+
5
+ /*
6
+ * What a column has that a bar has not, as the values of internal properties: a rail and a list
7
+ * are both a column. Every rule below reads one of them and falls back to the value of the bar.
8
+ */
9
+ const column = {
10
+ // A column, which takes the height it is given and scrolls where it has more destinations.
11
+ direction: 'column',
12
+ 'block-size': '100%',
13
+ 'groups-flex': '1 1 auto',
14
+ overflow: 'auto',
15
+ // The second group, and the group at the lower end.
16
+ 'secondary-display': 'block',
17
+ 'end-display': 'flex',
18
+ // A destination is as high as it is, not a share of the height.
19
+ 'item-flex': 'none',
20
+ // The line is at the side that faces the content. A region of a frame draws it itself.
21
+ 'line-block-start': '0px',
22
+ 'line-inline-end': 'var(--_el-context-line-inline-end, var(--_el-nav-line-width))',
23
+ // Alone, a column lies at the side from the top of the screen to its lower edge.
24
+ 'inset-block-start': 'var(--_el-context-inset-block-start, env(safe-area-inset-top, 0px))',
25
+ 'inset-inline-end': 'var(--_el-context-inset-inline-end, 0px)',
26
+ };
27
+
28
+ /* The room of the screen at the start side and the line are on top of the width of a column. */
29
+ const onTop =
30
+ 'var(--_el-context-inset-inline-start, var(--_el-nav-screen-start)) + var(--_el-context-line-inline-end, var(--_el-nav-line-width))';
31
+
32
+ /* A rail: as narrow as an icon with a word under it. */
33
+ const rail = {
34
+ ...column,
35
+ 'inline-size': `calc(var(--el-nav-rail-size, 5rem) + ${onTop})`,
36
+ // The second group is below a line, and its heading is its name alone.
37
+ 'secondary-line': 'var(--_el-nav-line-width)',
38
+ 'secondary-room': 'var(--el-space-2, 0.5rem)',
39
+ };
40
+
41
+ /*
42
+ * A list: an icon and its text in one row, as wide as the place of the list. Its own width counts
43
+ * where the place is as wide as what is in it: the column of a frame without a width.
44
+ */
45
+ const list = {
46
+ ...column,
47
+ 'inline-size': `calc(var(--el-nav-list-size, 16rem) + ${onTop})`,
48
+ fill: 'calc(100% + var(--_el-context-inset-inline-start, 0px) + var(--_el-context-inset-inline-end, 0px))',
49
+ 'list-gap': 'var(--el-space-1, 0.25rem)',
50
+ 'list-padding': 'var(--el-space-2, 0.5rem)',
51
+ // The second group is below its heading.
52
+ 'secondary-line': '0px',
53
+ 'secondary-room': 'var(--el-space-2, 0.5rem)',
54
+ 'heading-display': 'block',
55
+ // A destination: a row, with the mark of the current one behind the whole of it.
56
+ 'item-direction': 'row',
57
+ 'item-justify': 'flex-start',
58
+ 'item-gap': 'var(--el-space-3, 0.75rem)',
59
+ 'item-min-block-size': 'var(--el-control-height, 2.5rem)',
60
+ 'item-padding-block': '0px',
61
+ 'item-padding-inline': 'var(--el-space-3, 0.75rem)',
62
+ 'item-radius': 'var(--el-radius-md, 0)',
63
+ 'item-font-size': 'var(--el-font-size-sm, 0.875rem)',
64
+ 'item-mark-width': '1px',
65
+ 'item-mark-background': 'var(--el-color-bg-muted, transparent)',
66
+ 'icon-mark-width': '0px',
67
+ 'icon-mark-background': 'transparent',
68
+ 'icon-padding-block': '0px',
69
+ 'icon-padding-inline': '0px',
70
+ 'label-flex': '1 1 auto',
71
+ // A count is at the end of the row, in the flow.
72
+ 'badge-position': 'static',
73
+ 'badge-margin': '0px',
74
+ };
75
+
76
+ /** The properties of a layout, each with `condition` in front of its value. */
77
+ const properties = (layout, condition = '') =>
78
+ Object.entries(layout)
79
+ .map(([name, value]) => `--_el-nav-${name}: ${condition}${value};`)
80
+ .join('\n ');
81
+
82
+ /* What a frame says where it has the element in the column at its side: a property that is set to
83
+ nothing. In front of a value it leaves the value as it is, and where the property is not set,
84
+ the declaration is not valid and the rule that reads it falls back to the value of the bar. */
85
+ const inColumn = 'var(--_el-context-nav-column) ';
86
+
87
+ const style = css`
88
+ :host {
89
+ display: block;
90
+ /* A column fills the height of its place: where a frame has the element in the column at
91
+ its side. In an element of the page that lays out a column of its own (a flex column),
92
+ it takes the height that is left, and not the one of its destinations. */
93
+ --_el-nav-host-block-size: ${inColumn}100%;
94
+ --_el-nav-host-min-block-size: ${inColumn}0px;
95
+ block-size: var(--_el-nav-host-block-size, auto);
96
+ min-block-size: var(--_el-nav-host-min-block-size, auto);
97
+ /* A line to the content, which the region of a frame draws itself where the element is in
98
+ one. Where the user forces colours it is there without a theme as well. */
99
+ --_el-nav-line-width: var(--el-border-width, 0px);
100
+
101
+ /* The sides of the screen, as a phone that lies on its side has them. Alone, the element
102
+ asks the screen itself. */
103
+ --_el-nav-screen-start: env(safe-area-inset-left, 0px);
104
+ --_el-nav-screen-end: env(safe-area-inset-right, 0px);
105
+ }
106
+
107
+ /* Asked of the host: with \`dir\` on an element around it, Chromium does not match
108
+ \`:dir(rtl)\` for an element inside the shadow root. */
109
+ :host(:dir(rtl)) {
110
+ --_el-nav-screen-start: env(safe-area-inset-right, 0px);
111
+ --_el-nav-screen-end: env(safe-area-inset-left, 0px);
112
+ }
113
+
114
+ @media (forced-colors: active) {
115
+ :host {
116
+ --_el-nav-line-width: max(var(--el-border-width, 0px), 1px);
117
+ }
118
+ }
119
+
120
+ /* And where the page says what the destinations are. */
121
+ :host([layout='rail']),
122
+ :host([layout='list']) {
123
+ block-size: 100%;
124
+ min-block-size: 0;
125
+ }
126
+
127
+ /* As wide as the rail, not as its place. A list is as wide as its place. */
128
+ :host([layout='rail']) {
129
+ inline-size: fit-content;
130
+ }
131
+
132
+ :host([layout='bar']) {
133
+ block-size: auto;
134
+ min-block-size: auto;
135
+ }
136
+
137
+ /* ── Bar, rail or list ────────────────────────────────────────────────── */
138
+
139
+ /* A rail or a list, because the page says so. */
140
+ .nav--rail {
141
+ ${properties(rail)}
142
+ }
143
+
144
+ .nav--list {
145
+ ${properties(list)}
146
+ }
147
+
148
+ /*
149
+ * And where a frame has the element in the column at its side: a rail, or the list the page
150
+ * asks for there (\`column\`). The stylesheet decides, so this holds before the script has run.
151
+ */
152
+ .nav--auto {
153
+ ${properties(rail, inColumn)}
154
+ }
155
+
156
+ .nav--auto.nav--column-list {
157
+ ${properties(list, inColumn)}
158
+ }
159
+
160
+ /* ── The surface ──────────────────────────────────────────────────────── */
161
+
162
+ /*
163
+ * In a region of a frame the surface reaches as far as the surface of the region: to the edge
164
+ * of the screen. That room is padding here, so the destinations stay clear of the home
165
+ * indicator and the notch. Alone, the element asks the screen: a bar lies at the lower edge,
166
+ * a column at the side.
167
+ *
168
+ * The margins are on the landmark and not on the element: a reset of the page (margin: 0 for
169
+ * everything) wins over a rule for the host, and the room would be there twice.
170
+ */
171
+ .nav {
172
+ display: flex;
173
+ flex-direction: column;
174
+ box-sizing: border-box;
175
+ block-size: var(--_el-nav-block-size, auto);
176
+ inline-size: var(--_el-nav-inline-size, auto);
177
+ /* A list is as wide as its place, wider or narrower than its own width. */
178
+ min-inline-size: var(--_el-nav-fill, 0);
179
+ max-inline-size: var(--_el-nav-fill, none);
180
+ margin-block: calc(-1 * var(--_el-context-inset-block-start, 0px))
181
+ calc(-1 * var(--_el-context-inset-block-end, 0px));
182
+ margin-inline: calc(-1 * var(--_el-context-inset-inline-start, 0px))
183
+ calc(-1 * var(--_el-context-inset-inline-end, 0px));
184
+ padding-block: var(--_el-nav-inset-block-start, var(--_el-context-inset-block-start, 0px))
185
+ var(--_el-context-inset-block-end, env(safe-area-inset-bottom, 0px));
186
+ padding-inline: var(--_el-context-inset-inline-start, var(--_el-nav-screen-start))
187
+ var(--_el-nav-inset-inline-end, var(--_el-context-inset-inline-end, var(--_el-nav-screen-end)));
188
+ background: var(--el-color-bg, transparent);
189
+ color: var(--el-color-fg, inherit);
190
+ border: 0 solid var(--el-color-border, transparent);
191
+ border-block-start-width: var(
192
+ --_el-nav-line-block-start,
193
+ var(--_el-context-line-block-start, var(--_el-nav-line-width))
194
+ );
195
+ border-inline-end-width: var(--_el-nav-line-inline-end, 0px);
196
+ }
197
+
198
+ /* The two groups at the top. In a column they scroll together where the height does not take
199
+ them, and the group at the lower end stays in view. */
200
+ .groups {
201
+ display: flex;
202
+ flex-direction: column;
203
+ flex: var(--_el-nav-groups-flex, none);
204
+ min-block-size: 0;
205
+ overflow-y: var(--_el-nav-overflow, visible);
206
+ }
207
+
208
+ /* The destinations: in a bar they share the width in equal parts, however long their texts
209
+ are. In a column they are below each other. */
210
+ .list,
211
+ .end {
212
+ flex-direction: var(--_el-nav-direction, row);
213
+ gap: var(--_el-nav-list-gap, 0px);
214
+ padding: var(--_el-nav-list-padding, 0px);
215
+ }
216
+
217
+ .list {
218
+ display: flex;
219
+ flex: none;
220
+ }
221
+
222
+ /* The second group: the destinations that have no room in a bar, which leaves them out. In a
223
+ rail they are below a line, in a list below their heading. */
224
+ .secondary {
225
+ display: var(--_el-nav-secondary-display, none);
226
+ flex: none;
227
+ margin-block-start: var(--_el-nav-secondary-room, 0px);
228
+ border-block-start: var(--_el-nav-secondary-line, 0px) solid var(--el-color-border, transparent);
229
+ }
230
+
231
+ /* The heading of the second group, which a list shows. The list of the group has its text as
232
+ its name, so assistive technology reads it once. */
233
+ .heading {
234
+ display: var(--_el-nav-heading-display, none);
235
+ padding-block: var(--el-space-2, 0.5rem) 0;
236
+ padding-inline: calc(var(--el-space-2, 0.5rem) + var(--el-space-3, 0.75rem) + 1px);
237
+ color: var(--el-color-fg-muted, inherit);
238
+ font-size: var(--el-font-size-xs, 0.75rem);
239
+ font-weight: var(--el-font-weight-semibold, 600);
240
+ line-height: 1.2;
241
+ overflow: hidden;
242
+ text-overflow: ellipsis;
243
+ white-space: nowrap;
244
+ }
245
+
246
+ /* The group at the lower end of a column. A bar has no room for it. */
247
+ .end {
248
+ display: var(--_el-nav-end-display, none);
249
+ flex: none;
250
+ }
251
+
252
+ /* ── Icons alone ──────────────────────────────────────────────────────── */
253
+
254
+ /* The text of a destination is off the screen and stays its name. The destination reads these
255
+ in its own stylesheet. */
256
+ .nav--icons {
257
+ --_el-nav-label-position: absolute;
258
+ --_el-nav-label-size: 1px;
259
+ --_el-nav-label-clip: inset(50%);
260
+ }
261
+
262
+ /* The tooltips take no room. A tooltip hides itself while it is closed, but with a stylesheet
263
+ it only has once it has rendered: for a frame its text would be a line under the element. */
264
+ el-tooltip:not(:popover-open) {
265
+ display: none;
266
+ }
267
+ `;
268
+
269
+ export default [hostStyle(), style].join('\n');
@@ -0,0 +1,25 @@
1
+ # Change Log
2
+
3
+ All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
+
7
+ <!--
8
+ When your PR touches this component, add an entry under Unreleased and
9
+ mirror it (prefixed with the component name) in root CHANGELOG.md.
10
+ Uncomment headings as needed.
11
+ -->
12
+
13
+ ## Unreleased
14
+
15
+ ## [0.4.0] - 2026-11-27
16
+
17
+ ### Added
18
+
19
+ - Initial `el-nav-item`: one destination of an `el-nav`. A link with an icon (slot `icon`) and a short text under it, as an entry of a list. `href`, `target` and `rel` are the ones of the link. ([#179](https://github.com/webtides/element-library/issues/179))
20
+ - `current` marks the destination of the current view: the link gets `aria-current="page"`, the colour of the text instead of the muted one, a heavier text and a shape behind its icon. The shape has a border, so it stays where the user forces colours, and the weight marks the destination without a theme.
21
+ - The text is one line: what does not fit is cut with an ellipsis, and the whole text stays in the page for assistive technology.
22
+ - The `badge` slot takes a count or a dot, an `el-badge` as a rule, on the corner of the icon. It is part of the link and comes after the text, so a screen reader reads it with the name of the destination.
23
+ - On a touch screen the link is at least `--el-touch-target` wide and high.
24
+ - In an `el-nav` that shows icons alone (`labels="false"`) the text of the destination is off the screen and stays the name of its link. In a rail a destination is as high as it is, and in a bar a share of the width: the `el-nav` says which in CSS properties that are inherited. ([#181](https://github.com/webtides/element-library/issues/181))
25
+ - As a row of a list (`layout="list"` of the `el-nav`, or `column="list"` in the column of a frame) the text is beside the icon, the row is as high as a control, the shape of the current destination is behind the whole row, and what is in the `badge` slot is at the end of the row. The `el-nav` says so in CSS properties that are inherited: the markup of a destination is the same. ([#199](https://github.com/webtides/element-library/issues/199))
@@ -0,0 +1,3 @@
1
+ import { define } from './nav-item.js';
2
+
3
+ define();
@@ -0,0 +1,75 @@
1
+ import { TemplateElement, defineElement, html, classMap } from '@webtides/element-js';
2
+ import style from './nav-item.style.js';
3
+
4
+ /**
5
+ * One destination of an `el-nav`: a link with an icon and a short text under it. The destination
6
+ * of the current view is marked: for assistive technology (`aria-current="page"`), and for the
7
+ * eye by more than its colour.
8
+ *
9
+ * A count or a dot goes into the `badge` slot, an `el-badge` as a rule. It is part of the link and
10
+ * comes after the text, so a screen reader reads it with the name of the destination: "Inbox 12".
11
+ *
12
+ * @element el-nav-item
13
+ *
14
+ * @slot - The short text of the destination. One line: a text that does not fit is cut.
15
+ * @slot icon - The icon of the destination: a decoration, the text is the name.
16
+ * @slot badge - A count or a dot at the corner of the icon, an `el-badge` as a rule.
17
+ *
18
+ * @csspart base - The entry of the list (`role="listitem"`).
19
+ * @csspart link - The link: the whole destination is its target.
20
+ * @csspart icon - The icon, with the shape behind it that marks the current destination.
21
+ * @csspart badge - The place of the badge, at the corner of the icon.
22
+ * @csspart label - The text of the destination.
23
+ *
24
+ * @property {string} href - The address the destination leads to.
25
+ * @property {string} target - Where to open the address.
26
+ * @property {string} rel - `rel` attribute for the link, written when `target` is set. Default
27
+ * `'noreferrer noopener'`.
28
+ * @property {boolean} current - The destination of the current view: the link gets
29
+ * `aria-current="page"`, a heavier text and a shape behind its icon.
30
+ */
31
+ export default class NavItem extends TemplateElement {
32
+ constructor() {
33
+ super({ styles: [style], shadowRender: true });
34
+ }
35
+
36
+ properties() {
37
+ return {
38
+ href: '',
39
+ target: '',
40
+ rel: 'noreferrer noopener',
41
+ current: false,
42
+ };
43
+ }
44
+
45
+ template() {
46
+ const classes = {
47
+ item: true,
48
+ 'item--current': !!this.current,
49
+ };
50
+
51
+ // The role of an entry is inside of the shadow root, not on the element: it is part of
52
+ // the server-rendered markup that way, and needs no script. The attributes of the link
53
+ // are plain bindings, which leave an attribute out while its value is null.
54
+ return html`
55
+ <div part="base" class="${classMap(classes)}" role="listitem">
56
+ <a
57
+ part="link"
58
+ class="link"
59
+ href="${this.href || null}"
60
+ target="${this.target || null}"
61
+ rel="${this.target ? this.rel : null}"
62
+ aria-current="${this.current ? 'page' : null}"
63
+ >
64
+ <span part="icon" class="icon"><slot name="icon"></slot></span>
65
+ <span part="label" class="label"><slot></slot></span>
66
+ <span part="badge" class="badge"><slot name="badge"></slot></span>
67
+ </a>
68
+ </div>
69
+ `;
70
+ }
71
+ }
72
+
73
+ export function define() {
74
+ defineElement('el-nav-item', NavItem);
75
+ }