@nrbx/topbar-components 1.0.7 → 1.0.8

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 (2) hide show
  1. package/README.md +134 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -49,28 +49,60 @@ And this to your `tsconfig.json`
49
49
 
50
50
  Instantiate `<TopbarProvider />` to be a root of your topbar component tree.
51
51
 
52
- ```jsx
52
+ ```tsx
53
53
  <TopbarProvider>
54
54
  <Icon text="Hello, World!" />
55
55
  </TopbarProvider>
56
56
  ```
57
57
 
58
- Every `<Icon />` can be in only two states `selected`, and `deselected`.
59
- You can conditionally apply properties based on icon's current state, by providing a state markup object:
58
+ #### 📍 Positioning icons with dock containers
60
59
 
61
- ```jsx
62
- <Icon text={{
63
- selected: "Selected!",
64
- deselected: "Deselected!",
65
- }} />
60
+ Icons placed directly inside `<TopbarProvider>` default to the left side. Use the dock container components to position icons at the center or right of the bar:
61
+
62
+ ```tsx
63
+ <TopbarProvider>
64
+ <LeftDock>
65
+ <Icon text="Home" />
66
+ <Icon text="Settings" />
67
+ </LeftDock>
68
+ <CenterDock>
69
+ <Icon text="Server Time" static />
70
+ </CenterDock>
71
+ <RightDock>
72
+ <Icon text="Profile" imageId="rbxassetid://..." />
73
+ </RightDock>
74
+ </TopbarProvider>
75
+ ```
76
+
77
+ | Container | Anchor | Purpose |
78
+ |---|---|---|
79
+ | `<LeftDock>` | left edge | Default — icons flow left-to-right from the left |
80
+ | `<CenterDock>` | center (50%) | Centers icons in the bar |
81
+ | `<RightDock>` | right edge | Right-aligns icons |
82
+
83
+ Each dock container renders its own horizontal list with the configured `iconSpacing` and vertical centering. Center and right docks automatically apply `iconGroupSpacing` for visual separation.
84
+
85
+ #### 🏷️ Icon props: `static` and `disabled`
86
+
87
+ - **`static`** — turns the icon into a non-interactive label (no clicks, no hovers, no state toggling, no sounds)
88
+ - **`disabled`** — dims the icon with a configurable semi-transparent overlay
89
+
90
+ ```tsx
91
+ <Icon text="Read Only" static /> {/* label, not clickable */}
92
+ <Icon text="Locked" disabled /> {/* dimmed */}
93
+ <Icon text="Both" static disabled /> {/* dimmed label */}
66
94
  ```
67
95
 
68
- You can add a dropdown to an icon by mounting `<Dropdown />` component as it's child:
96
+ The disabled overlay transparency and color are configurable via the stylesheet `sizing` section.
97
+
98
+ #### 🔽 Dropdowns
99
+
100
+ You can add a dropdown to an icon by mounting `<Dropdown />` component as it's child.
69
101
  Dropdowns & TopbarProvider have a property called `selectionMode`, which lets you specify how many icons can be selected at once.
70
102
 
71
- ```jsx
103
+ ```tsx
72
104
  <Icon text="Skins">
73
- <Dropdown selectionMode="single">
105
+ <Dropdown selectionMode="Single">
74
106
  <Icon text="yellow" selected={() => chooseSkin("yellow")} />
75
107
  <Icon text="red" selected={() => chooseSkin("red")} />
76
108
  </Dropdown>
@@ -81,22 +113,104 @@ Dropdowns **can be nested.**
81
113
 
82
114
  ### 🎨 Stylesheets
83
115
 
84
- You can use stylesheets to override default properties of all components within:
116
+ You can use stylesheets to override default properties of all components within.
85
117
  Stylesheets are partial, and work like patches to already established default properties within the package:
86
118
 
87
- ```jsx
119
+ ```tsx
120
+ import { Stylesheet } from "@nrbx/topbar-components";
121
+
88
122
  <Stylesheet stylesheet={{
89
123
  icon: {
90
124
  textSize: 25,
91
125
  cornerRadius: new UDim(0.5, 0),
92
- }
126
+ },
127
+ }}>
128
+ <TopbarProvider>
129
+ <LeftDock>
130
+ <Icon text="Skins">
131
+ <Dropdown selectionMode="Single">
132
+ <Icon text="yellow" selected={() => chooseSkin("yellow")} />
133
+ <Icon text="red" selected={() => chooseSkin("red")} />
134
+ </Dropdown>
135
+ </Icon>
136
+ </LeftDock>
137
+ </TopbarProvider>
138
+ </Stylesheet>
139
+ ```
140
+
141
+ #### Complete stylesheet shape
142
+
143
+ The stylesheet exposes the following sections for full control:
144
+
145
+ ```tsx
146
+ <Stylesheet stylesheet={{
147
+ // ── Icon defaults (all IconProps) ──
148
+ icon: {
149
+ textSize: 20,
150
+ textColor: { selected: Color3.fromRGB(57, 60, 65), deselected: Color3.fromRGB(255, 255, 255) },
151
+ backgroundColor: { selected: Color3.fromRGB(245, 245, 245), deselected: Color3.fromRGB(0, 0, 0) },
152
+ backgroundTransparency: 0.3,
153
+ cornerRadius: new UDim(1, 0),
154
+ fontFace: new Font("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal),
155
+ static: false,
156
+ disabled: false,
157
+ // ... all other IconProps
158
+ },
159
+
160
+ // ── Dropdown defaults (all DropdownProps) ──
161
+ dropdown: {
162
+ maxWidth: 300,
163
+ minWidth: 200,
164
+ maxHeight: 200,
165
+ forceHeight: 32,
166
+ padding: new UDim(0, 2.5),
167
+ selectionMode: "Multiple",
168
+ // ... all other DropdownProps
169
+ },
170
+
171
+ // ── Provider frame ──
172
+ provider: {
173
+ paddingLeft: 8, paddingRight: 12,
174
+ paddingTop: 11, paddingBottom: 0,
175
+ iconSpacing: 12, iconGroupSpacing: 0,
176
+ backgroundTransparency: 1,
177
+ anchorPoint: new Vector2(1, 0),
178
+ position: UDim2.fromScale(1, 0),
179
+ sizeScale: new Vector2(1, 1),
180
+ insetHeightOffset: 0,
181
+ forceFrameHeight: undefined, // override auto height (e.g. 55)
182
+ },
183
+
184
+ // ── Icon internal sizing ──
185
+ sizing: {
186
+ iconHeight: undefined, // explicit override
187
+ imagePadding: 6,
188
+ labelPadding: 6,
189
+ imageToTextSpacing: 6,
190
+ textMeasurementWidth: 99999,
191
+ minLabelWidthPadding: 12,
192
+ buttonLabelHeightFraction: 0.8,
193
+ disabledOverlayTransparency: 0.55,
194
+ disabledOverlayColor: new Color3(0, 0, 0),
195
+ },
196
+
197
+ // ── Dropdown surface theme ──
198
+ dropdownTheme: {
199
+ backgroundColor: new Color3(1, 1, 1),
200
+ backgroundTransparency: 0,
201
+ cornerRadius: new UDim(0, 0),
202
+ borderSize: 0, borderColor: new Color3(0, 0, 0),
203
+ borderTransparency: 1,
204
+ position: UDim2.fromScale(0, 1),
205
+ },
206
+
207
+ // ── Animation ──
208
+ animation: {
209
+ dropdownTransitionSpeed: 10,
210
+ stateSpring: { tension: 400 },
211
+ },
93
212
  }}>
94
- <Icon text="Skins">
95
- <Dropdown selectionMode="single">
96
- <Icon text="yellow" selected={() => chooseSkin("yellow")} />
97
- <Icon text="red" selected={() => chooseSkin("red")} />
98
- </Dropdown>
99
- </Icon>
213
+ {/* children */}
100
214
  </Stylesheet>
101
215
  ```
102
216
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrbx/topbar-components",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "main": "out/init.lua",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",