Skip to content

Commit a2ede29

Browse files
authored
Create odd-walls-yawn.md
1 parent 6084fa0 commit a2ede29

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed

.changeset/odd-walls-yawn.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
"@primer/react": patch
3+
---
4+
5+
## Button deprecation
6+
7+
The new set of Button components brings a much needed update.
8+
The older version was a set of seven different components. Each variant of the component had a separate component.
9+
The guidelines to put in icons inside the buttons was also vague. With the new components, we now have a great guidance for common button usage.
10+
11+
## Change list
12+
13+
### Button variants
14+
15+
We now support a variant property which takes values `primary`, `invisible`, `outline` and `danger`
16+
17+
#### Before
18+
19+
```jsx
20+
import {ButtonPrimary, ButtonInvisible, ButtonOutline, ButtonDanger} from '@primer/react'
21+
22+
<ButtonPrimary>Primary Button</ButtonPrimary>
23+
24+
<ButtonInvisible>Invisible Button</ButtonInvisible>
25+
26+
<ButtonOutline>Outline Button</ButtonOutline>
27+
28+
<ButtonDanger>Danger Button</ButtonDanger>
29+
30+
```
31+
32+
#### After
33+
34+
```jsx
35+
import {Button} from '@primer/react'
36+
37+
<Button variant="primary">Primary Button</Button>
38+
39+
<Button variant="invisible">Invisible Button</Button>
40+
41+
<Button variant="outline">Outline Button</Button>
42+
43+
<Button variant="danger">Danger Button</Button>
44+
45+
```
46+
47+
### Leading and Trailing icons
48+
49+
In the previous component, we allowed icon components to be direct children. This results in a lot of custom styling for the icon components.
50+
In the new one, we now have `leadinIcon` and `trailingIcon` properties.
51+
52+
#### Before
53+
54+
```jsx
55+
<Button>
56+
<SearchIcon />
57+
Search
58+
</Button>
59+
```
60+
61+
#### After
62+
63+
```jsx
64+
<Button leadingIcon={SearchIcon}>Search</Button>
65+
```
66+
67+
### Icon buttons
68+
69+
Icon only buttons are common usages in products. So we now have a component for the specific usecase
70+
71+
#### Before
72+
73+
```jsx
74+
<Button>
75+
<XIcon />
76+
</Button>
77+
```
78+
79+
#### After
80+
81+
```jsx
82+
<IconButton aria-label="Close button" icon={XIcon} />
83+
```
84+
85+
### Size property
86+
87+
Earlier we used `variant` to mean size property. Now we have a new property called `size` which is more semantically correct.
88+
89+
#### Before
90+
91+
```jsx
92+
<Button variant="small">Small button</Button>
93+
```
94+
95+
#### After
96+
97+
```jsx
98+
<Button size="small">Small button</Button>
99+
```
100+

0 commit comments

Comments
 (0)