@startupjs-ui/button 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 +44 -17
- 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/button
|
|
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/button
|
package/README.mdx
CHANGED
|
@@ -4,22 +4,21 @@ import Button, { _PropsJsonSchema as ButtonPropsJsonSchema } from './index'
|
|
|
4
4
|
import Div from '@startupjs-ui/div'
|
|
5
5
|
import Br from '@startupjs-ui/br'
|
|
6
6
|
import { Sandbox } from '@startupjs-ui/docs'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
faCoffee
|
|
11
|
-
} from '@fortawesome/free-solid-svg-icons'
|
|
7
|
+
import { faHouseUser } from '@fortawesome/free-solid-svg-icons/faHouseUser'
|
|
8
|
+
import { faCheck } from '@fortawesome/free-solid-svg-icons/faCheck'
|
|
9
|
+
import { faCoffee } from '@fortawesome/free-solid-svg-icons/faCoffee'
|
|
12
10
|
import './index.mdx.cssx.styl'
|
|
13
11
|
|
|
14
12
|
# Button
|
|
15
13
|
|
|
16
|
-
Buttons
|
|
14
|
+
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
15
|
|
|
18
16
|
```jsx
|
|
19
17
|
import { Button } from 'startupjs-ui'
|
|
20
18
|
```
|
|
21
19
|
|
|
22
20
|
## Simple example
|
|
21
|
+
|
|
23
22
|
```jsx example
|
|
24
23
|
const [counter, setCounter] = useState(0)
|
|
25
24
|
|
|
@@ -32,6 +31,8 @@ return (
|
|
|
32
31
|
|
|
33
32
|
## Async button
|
|
34
33
|
|
|
34
|
+
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.
|
|
35
|
+
|
|
35
36
|
```jsx example
|
|
36
37
|
async function onPress() {
|
|
37
38
|
await new Promise((resolve, reject) => {
|
|
@@ -50,7 +51,11 @@ return (
|
|
|
50
51
|
|
|
51
52
|
## Variants
|
|
52
53
|
|
|
53
|
-
The `variant`
|
|
54
|
+
The `variant` prop controls the button's visual style. It affects the background, border, and text/icon colors. The default value is `outlined`.
|
|
55
|
+
|
|
56
|
+
- **outlined** -- a bordered button with no background fill (default)
|
|
57
|
+
- **flat** -- a solid, filled button
|
|
58
|
+
- **text** -- a borderless button with no background
|
|
54
59
|
|
|
55
60
|
```jsx example
|
|
56
61
|
return pug`
|
|
@@ -76,7 +81,7 @@ return pug`
|
|
|
76
81
|
|
|
77
82
|
## Colors
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
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
85
|
|
|
81
86
|
```jsx example
|
|
82
87
|
return (
|
|
@@ -102,7 +107,7 @@ return (
|
|
|
102
107
|
|
|
103
108
|
## Sizes
|
|
104
109
|
|
|
105
|
-
The `size`
|
|
110
|
+
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
111
|
|
|
107
112
|
```jsx example
|
|
108
113
|
return (
|
|
@@ -122,11 +127,19 @@ return (
|
|
|
122
127
|
)
|
|
123
128
|
```
|
|
124
129
|
|
|
130
|
+
## Shape
|
|
131
|
+
|
|
132
|
+
The `shape` prop controls the border radius of the button. The default value is `rounded`.
|
|
133
|
+
|
|
134
|
+
- **rounded** -- standard rounded corners (default)
|
|
135
|
+
- **squared** -- sharp, square corners
|
|
136
|
+
- **circle** -- fully circular (best for icon-only buttons)
|
|
137
|
+
|
|
125
138
|
## Icons
|
|
126
139
|
|
|
127
|
-
|
|
140
|
+
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
141
|
|
|
129
|
-
In `.styl` file
|
|
142
|
+
In your `.styl` file:
|
|
130
143
|
```stylus
|
|
131
144
|
.icon
|
|
132
145
|
color var(--color-text-success)
|
|
@@ -146,11 +159,25 @@ return (
|
|
|
146
159
|
)
|
|
147
160
|
```
|
|
148
161
|
|
|
162
|
+
## Disabled state
|
|
163
|
+
|
|
164
|
+
Set the `disabled` prop to `true` to prevent user interaction. A disabled button ignores all press events and appears visually muted.
|
|
165
|
+
|
|
166
|
+
## Custom styles
|
|
167
|
+
|
|
168
|
+
You can fine-tune the button's appearance using style props:
|
|
169
|
+
|
|
170
|
+
- **style** -- custom styles for the root container
|
|
171
|
+
- **textStyle** -- custom styles for the label text
|
|
172
|
+
- **iconStyle** -- custom styles for the icon
|
|
173
|
+
- **hoverStyle** -- custom styles applied on hover
|
|
174
|
+
- **activeStyle** -- custom styles applied when pressed
|
|
175
|
+
|
|
149
176
|
## Call to Action
|
|
150
177
|
|
|
151
|
-
Try to keep the variety of button combinations you use in your app to
|
|
178
|
+
Try to keep the variety of button combinations you use in your app to a minimum.
|
|
152
179
|
|
|
153
|
-
Use regular Button without any options by default. Whenever you want to emphasize a particular
|
|
180
|
+
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
181
|
|
|
155
182
|
```jsx example
|
|
156
183
|
<Button color='primary' variant='flat'>
|
|
@@ -158,13 +185,13 @@ Use regular Button without any options by default. Whenever you want to emphasiz
|
|
|
158
185
|
</Button>
|
|
159
186
|
```
|
|
160
187
|
|
|
161
|
-
##
|
|
188
|
+
## Button order
|
|
162
189
|
|
|
163
|
-
|
|
190
|
+
When placing several buttons on one line, follow the ordering conventions that users expect from common operating systems: put `Cancel` first, then `OK`.
|
|
164
191
|
|
|
165
|
-
|
|
192
|
+
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
193
|
|
|
167
|
-
It
|
|
194
|
+
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
195
|
|
|
169
196
|
```jsx example
|
|
170
197
|
<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.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/loader": "^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/loader": "^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
|
}
|