@startupjs-ui/menu 0.1.13 → 0.1.19
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.
- package/CHANGELOG.md +19 -0
- package/README.mdx +18 -8
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.1.19](https://github.com/startupjs/startupjs-ui/compare/v0.1.18...v0.1.19) (2026-03-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **docs:** don't load all icons to keep bundle small ([#17](https://github.com/startupjs/startupjs-ui/issues/17)) ([d7eb70b](https://github.com/startupjs/startupjs-ui/commit/d7eb70bc11f5b15923f2e43b7ef1f86ea066494e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.1.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @startupjs-ui/menu
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @startupjs-ui/menu
|
package/README.mdx
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
2
|
import { pug, u } from 'startupjs'
|
|
3
3
|
import useRouter from 'startupjs/useRouter'
|
|
4
|
-
import { faShareAlt
|
|
4
|
+
import { faShareAlt } from '@fortawesome/free-solid-svg-icons/faShareAlt'
|
|
5
|
+
import { faHouseUser } from '@fortawesome/free-solid-svg-icons/faHouseUser'
|
|
6
|
+
import { faTable } from '@fortawesome/free-solid-svg-icons/faTable'
|
|
5
7
|
import Menu, { _PropsJsonSchema as MenuPropsJsonSchema } from './index'
|
|
6
8
|
import MenuItem, { _PropsJsonSchema as MenuItemPropsJsonSchema } from './MenuItem'
|
|
7
9
|
import Collapse from '@startupjs-ui/collapse'
|
|
@@ -11,7 +13,9 @@ import { Sandbox } from '@startupjs-ui/docs'
|
|
|
11
13
|
|
|
12
14
|
Inherits [Div props](/docs/components/Div).
|
|
13
15
|
|
|
14
|
-
Menu displays a list of choices
|
|
16
|
+
Menu displays a list of choices on screen. It can be used for navigation, selecting options, or organizing actions into a vertical or horizontal list.
|
|
17
|
+
|
|
18
|
+
Each item in the menu is a `Menu.Item`. Items can be marked as active, display icons, act as navigation links, and be styled with custom colors.
|
|
15
19
|
|
|
16
20
|
```jsx
|
|
17
21
|
import { Menu } from 'startupjs-ui'
|
|
@@ -19,6 +23,8 @@ import { Menu } from 'startupjs-ui'
|
|
|
19
23
|
|
|
20
24
|
## Simple example
|
|
21
25
|
|
|
26
|
+
At its simplest, a Menu contains a set of `Menu.Item` children. Track which item is active using component state and the `active` prop.
|
|
27
|
+
|
|
22
28
|
```jsx example
|
|
23
29
|
const [active, setActive] = useState('option-1')
|
|
24
30
|
return (
|
|
@@ -41,7 +47,7 @@ return (
|
|
|
41
47
|
|
|
42
48
|
## Highlighted active item
|
|
43
49
|
|
|
44
|
-
By default the active menu item
|
|
50
|
+
By default, the active menu item has no visible border highlight. Use the `activeBorder` prop on the `Menu` component to add a colored border to whichever item is currently active. Supported positions are `'top'`, `'bottom'`, `'left'`, and `'right'`.
|
|
45
51
|
|
|
46
52
|
```jsx example
|
|
47
53
|
const [active, setActive] = useState('option-1')
|
|
@@ -71,7 +77,7 @@ return (
|
|
|
71
77
|
|
|
72
78
|
## Horizontal menu
|
|
73
79
|
|
|
74
|
-
By default the menu
|
|
80
|
+
By default, the menu is laid out vertically. Set `variant='horizontal'` to arrange items in a row instead.
|
|
75
81
|
|
|
76
82
|
```jsx example
|
|
77
83
|
const [active, setActive] = useState('option-1')
|
|
@@ -101,7 +107,7 @@ return (
|
|
|
101
107
|
|
|
102
108
|
## Menu item icon
|
|
103
109
|
|
|
104
|
-
|
|
110
|
+
Pass the `icon` prop to a `Menu.Item` to display an icon alongside its label. The icon position defaults to `'left'` but can be changed by setting `iconPosition` on the `Menu` (which applies to all items) or on an individual `Menu.Item` (which overrides the parent setting).
|
|
105
111
|
|
|
106
112
|
```jsx example
|
|
107
113
|
const [active, setActive] = useState('option-1')
|
|
@@ -134,7 +140,11 @@ return (
|
|
|
134
140
|
|
|
135
141
|
## Change color of active item
|
|
136
142
|
|
|
137
|
-
By default, the active menu item
|
|
143
|
+
By default, the active menu item uses the `primary` theme color. Use the `activeColor` prop to apply a custom color to the active item's text, icon, and border. It accepts any valid CSS color value (e.g. `'red'`, `'#fff'`, `'rgb(123, 23, 122)'`).
|
|
144
|
+
|
|
145
|
+
You can also use the `color` prop on individual `Menu.Item` components to override the default text and icon color for inactive items.
|
|
146
|
+
|
|
147
|
+
To render item text in bold, pass the `bold` prop to `Menu.Item`.
|
|
138
148
|
|
|
139
149
|
```jsx example
|
|
140
150
|
const [active, setActive] = useState('option-1')
|
|
@@ -171,7 +181,7 @@ return (
|
|
|
171
181
|
|
|
172
182
|
## Menu item as link
|
|
173
183
|
|
|
174
|
-
|
|
184
|
+
Use the `to` prop on `Menu.Item` to turn it into a navigation link. This is useful for building navigation menus where each item routes to a different page.
|
|
175
185
|
|
|
176
186
|
```jsx example
|
|
177
187
|
const { usePathname } = useRouter()
|
|
@@ -195,7 +205,7 @@ return pug`
|
|
|
195
205
|
|
|
196
206
|
## Complex interaction (integration with other components)
|
|
197
207
|
|
|
198
|
-
|
|
208
|
+
This example shows a collapsible menu with nested submenus, built by combining Menu with the Collapse component. You can pass custom `style` and `containerStyle` props to fine-tune the layout.
|
|
199
209
|
|
|
200
210
|
```jsx example
|
|
201
211
|
const [showMenu, setShowMenu] = useState(true)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/menu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
"types": "index.d.ts",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@startupjs-ui/core": "^0.1.
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/icon": "^0.1.
|
|
14
|
-
"@startupjs-ui/item": "^0.1.
|
|
15
|
-
"@startupjs-ui/span": "^0.1.
|
|
11
|
+
"@startupjs-ui/core": "^0.1.19",
|
|
12
|
+
"@startupjs-ui/div": "^0.1.19",
|
|
13
|
+
"@startupjs-ui/icon": "^0.1.19",
|
|
14
|
+
"@startupjs-ui/item": "^0.1.19",
|
|
15
|
+
"@startupjs-ui/span": "^0.1.19"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*",
|
|
19
19
|
"react-native": "*",
|
|
20
20
|
"startupjs": "*"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "bfcca786dc363f42a09b6eef4feb7ca8139302fc"
|
|
23
23
|
}
|