@startupjs-ui/button 0.1.13 → 0.1.16
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 +8 -0
- package/README.mdx +41 -12
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.16](https://github.com/startupjs/startupjs-ui/compare/v0.1.15...v0.1.16) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @startupjs-ui/button
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [0.1.13](https://github.com/startupjs/startupjs-ui/compare/v0.1.12...v0.1.13) (2026-02-03)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @startupjs-ui/button
|
package/README.mdx
CHANGED
|
@@ -13,13 +13,14 @@ import './index.mdx.cssx.styl'
|
|
|
13
13
|
|
|
14
14
|
# Button
|
|
15
15
|
|
|
16
|
-
Buttons
|
|
16
|
+
Buttons let users take actions or navigate to other pages. They support multiple visual styles to suit different needs and are ideal for drawing attention to the next step in a workflow.
|
|
17
17
|
|
|
18
18
|
```jsx
|
|
19
19
|
import { Button } from 'startupjs-ui'
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Simple example
|
|
23
|
+
|
|
23
24
|
```jsx example
|
|
24
25
|
const [counter, setCounter] = useState(0)
|
|
25
26
|
|
|
@@ -32,6 +33,8 @@ return (
|
|
|
32
33
|
|
|
33
34
|
## Async button
|
|
34
35
|
|
|
36
|
+
When the `onPress` handler returns a Promise, the button automatically shows a loading indicator until the Promise resolves. The button is disabled while loading to prevent duplicate submissions.
|
|
37
|
+
|
|
35
38
|
```jsx example
|
|
36
39
|
async function onPress() {
|
|
37
40
|
await new Promise((resolve, reject) => {
|
|
@@ -50,7 +53,11 @@ return (
|
|
|
50
53
|
|
|
51
54
|
## Variants
|
|
52
55
|
|
|
53
|
-
The `variant`
|
|
56
|
+
The `variant` prop controls the button's visual style. It affects the background, border, and text/icon colors. The default value is `outlined`.
|
|
57
|
+
|
|
58
|
+
- **outlined** -- a bordered button with no background fill (default)
|
|
59
|
+
- **flat** -- a solid, filled button
|
|
60
|
+
- **text** -- a borderless button with no background
|
|
54
61
|
|
|
55
62
|
```jsx example
|
|
56
63
|
return pug`
|
|
@@ -76,7 +83,7 @@ return pug`
|
|
|
76
83
|
|
|
77
84
|
## Colors
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
The default color is `secondary`. You can change it by passing any color name from your theme's color configuration to the `color` prop. See all available values in the Sandbox section at the bottom of the page.
|
|
80
87
|
|
|
81
88
|
```jsx example
|
|
82
89
|
return (
|
|
@@ -102,7 +109,7 @@ return (
|
|
|
102
109
|
|
|
103
110
|
## Sizes
|
|
104
111
|
|
|
105
|
-
The `size`
|
|
112
|
+
The `size` prop controls the overall button dimensions, including the icon and label text. The default value is `m`. Available sizes are `xs`, `s`, `m`, `l`, `xl`, and `xxl`. See all available values in the Sandbox section at the bottom of the page.
|
|
106
113
|
|
|
107
114
|
```jsx example
|
|
108
115
|
return (
|
|
@@ -122,11 +129,19 @@ return (
|
|
|
122
129
|
)
|
|
123
130
|
```
|
|
124
131
|
|
|
132
|
+
## Shape
|
|
133
|
+
|
|
134
|
+
The `shape` prop controls the border radius of the button. The default value is `rounded`.
|
|
135
|
+
|
|
136
|
+
- **rounded** -- standard rounded corners (default)
|
|
137
|
+
- **squared** -- sharp, square corners
|
|
138
|
+
- **circle** -- fully circular (best for icon-only buttons)
|
|
139
|
+
|
|
125
140
|
## Icons
|
|
126
141
|
|
|
127
|
-
|
|
142
|
+
You can add an icon using the `icon` prop. To change the icon's position relative to the label, use the `iconPosition` prop (`left` by default).
|
|
128
143
|
|
|
129
|
-
In `.styl` file
|
|
144
|
+
In your `.styl` file:
|
|
130
145
|
```stylus
|
|
131
146
|
.icon
|
|
132
147
|
color var(--color-text-success)
|
|
@@ -146,11 +161,25 @@ return (
|
|
|
146
161
|
)
|
|
147
162
|
```
|
|
148
163
|
|
|
164
|
+
## Disabled state
|
|
165
|
+
|
|
166
|
+
Set the `disabled` prop to `true` to prevent user interaction. A disabled button ignores all press events and appears visually muted.
|
|
167
|
+
|
|
168
|
+
## Custom styles
|
|
169
|
+
|
|
170
|
+
You can fine-tune the button's appearance using style props:
|
|
171
|
+
|
|
172
|
+
- **style** -- custom styles for the root container
|
|
173
|
+
- **textStyle** -- custom styles for the label text
|
|
174
|
+
- **iconStyle** -- custom styles for the icon
|
|
175
|
+
- **hoverStyle** -- custom styles applied on hover
|
|
176
|
+
- **activeStyle** -- custom styles applied when pressed
|
|
177
|
+
|
|
149
178
|
## Call to Action
|
|
150
179
|
|
|
151
|
-
Try to keep the variety of button combinations you use in your app to
|
|
180
|
+
Try to keep the variety of button combinations you use in your app to a minimum.
|
|
152
181
|
|
|
153
|
-
Use regular Button without any options by default. Whenever you want to emphasize a particular
|
|
182
|
+
Use a regular Button without any extra options by default. Whenever you want to emphasize a particular call to action, use a primary flat button.
|
|
154
183
|
|
|
155
184
|
```jsx example
|
|
156
185
|
<Button color='primary' variant='flat'>
|
|
@@ -158,13 +187,13 @@ Use regular Button without any options by default. Whenever you want to emphasiz
|
|
|
158
187
|
</Button>
|
|
159
188
|
```
|
|
160
189
|
|
|
161
|
-
##
|
|
190
|
+
## Button order
|
|
162
191
|
|
|
163
|
-
|
|
192
|
+
When placing several buttons on one line, follow the ordering conventions that users expect from common operating systems: put `Cancel` first, then `OK`.
|
|
164
193
|
|
|
165
|
-
|
|
194
|
+
Avoid placing multiple call-to-action buttons in the same component, and try to limit the number of them visible at once on a single page.
|
|
166
195
|
|
|
167
|
-
It
|
|
196
|
+
It is a much better UX practice to use regular buttons by default and decide which one to make a call to action later.
|
|
168
197
|
|
|
169
198
|
```jsx example
|
|
170
199
|
<Div row align='right'>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/button",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
"type": "module",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@startupjs-ui/core": "^0.1.11",
|
|
12
|
-
"@startupjs-ui/div": "^0.1.
|
|
13
|
-
"@startupjs-ui/icon": "^0.1.
|
|
14
|
-
"@startupjs-ui/loader": "^0.1.
|
|
15
|
-
"@startupjs-ui/span": "^0.1.
|
|
12
|
+
"@startupjs-ui/div": "^0.1.16",
|
|
13
|
+
"@startupjs-ui/icon": "^0.1.16",
|
|
14
|
+
"@startupjs-ui/loader": "^0.1.16",
|
|
15
|
+
"@startupjs-ui/span": "^0.1.16"
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"react": "*",
|
|
19
19
|
"react-native": "*",
|
|
20
20
|
"startupjs": "*"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "9943aa3566d5d80f5b404473906eb3c0611f9ee5"
|
|
23
23
|
}
|