Skip to content

Commit f9ada1d

Browse files
committed
Improve the icon button docs
1 parent a3b4db7 commit f9ada1d

3 files changed

Lines changed: 20 additions & 45 deletions

File tree

src/components/examples/button/CustomIcon.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<vscode-button icon-only secondary
1+
<vscode-button icon-only secondary title="HTML5"
22
><img
33
src="/icons/html.svg"
44
width="16"

src/components/examples/button/CustomizedStyles.astro

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/content/docs/components/button.mdx

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ import FormControlInfo from "@components/form-control-info.md";
88
import IconsInfo from "@components/icons-info.md";
99

1010
import Imports from "@components/examples/button/Imports.astro";
11-
import CustomizedStyles from '@components/examples/button/CustomizedStyles.astro';
12-
import CustomIcon from '@components/examples/button/CustomIcon.astro';
11+
import CustomIcon from "@components/examples/button/CustomIcon.astro";
1312

1413
<Imports />
1514
<PageSwitcher />
@@ -53,54 +52,47 @@ import CustomIcon from '@components/examples/button/CustomIcon.astro';
5352
<IconsInfo />
5453

5554
<Demo>
56-
<vscode-button icon="account" icon-after="chevron-right">Icons</vscode-button>
55+
<vscode-button icon="account" icon-after="chevron-right">
56+
Icons
57+
</vscode-button>
5758
<Fragment slot="html">
5859
```html 'icon="account"' 'icon-after="chevron-right"'
59-
<vscode-button icon="account" icon-after="chevron-right">Icons</vscode-button>
60+
<vscode-button icon="account" icon-after="chevron-right">
61+
Icons
62+
</vscode-button>
6063
```
6164
</Fragment>
6265
</Demo>
6366

6467
## Icon button
6568

69+
If the button only displays a built-in icon, it will automatically have a square shape.
70+
71+
Provide a `title` or `aria-label` attribute for accessibility.
72+
6673
<Demo>
6774
<vscode-button icon="settings-gear" title="Settings"></vscode-button>
6875
<Fragment slot="html">
69-
```html 'icon="account"' 'icon-after="chevron-right"'
76+
```html 'icon="settings-gear"'
7077
<vscode-button icon="settings-gear" title="Settings"></vscode-button>
7178
```
7279
</Fragment>
7380
</Demo>
7481

7582
## Custom icons
7683

77-
<Demo>
78-
<CustomIcon />
79-
</Demo>
80-
81-
## Customized styles
84+
Any HTML or SVG markup can be used as an icon. You can use the `iconOnly` property
85+
to make it square.
8286

83-
Styles can be tweaked.
87+
Provide a `title` or `aria-label` attribute for accessibility.
8488

8589
<Demo>
86-
<CustomizedStyles />
90+
<CustomIcon />
8791
<Fragment slot="html">
8892
```html
89-
<vscode-button class="settings-button-example">Add item</vscode-button>
90-
<vscode-button class="scm-button-example" icon="check">Commit</vscode-button>
91-
```
92-
</Fragment>
93-
<Fragment slot="css">
94-
```css
95-
.settings-button-example {
96-
line-height: 18px;
97-
padding: 2px 14px;
98-
}
99-
100-
.scm-button-example {
101-
line-height: 26px;
102-
width: 179px;
103-
}
93+
<vscode-button icon-only secondary title="HTML5">
94+
<img src="/icons/html.svg" width="16" height="16" alt="HTML 5 icon" />
95+
</vscode-button>
10496
```
10597
</Fragment>
10698
</Demo>

0 commit comments

Comments
 (0)