You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 6, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: src/dropdown/README.md
+34-16Lines changed: 34 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,20 +47,42 @@ The `vscode-dropdown` component must be used with the `vscode-option` component.
47
47
48
48
### With Label
49
49
50
+
_Note: There are [long term plans](https://github.com/microsoft/vscode-webview-ui-toolkit/issues/461#issuecomment-1478408942) to better support labels in dropdown components, but in the meantime the below markup and styling will create a label that adheres to the VS Code design language._
51
+
50
52
```html
51
-
<labelfor="my-dropdown">Choose an option:</label>
52
-
<vscode-dropdownid="my-dropdown">
53
-
<vscode-option>Option Label #1</vscode-option>
54
-
<vscode-option>Option Label #2</vscode-option>
55
-
<vscode-option>Option Label #3</vscode-option>
56
-
</vscode-dropdown>
53
+
<divclass="dropdown-container">
54
+
<labelfor="my-dropdown">Choose an option:</label>
55
+
<vscode-dropdownid="my-dropdown">
56
+
<vscode-option>Option Label #1</vscode-option>
57
+
<vscode-option>Option Label #2</vscode-option>
58
+
<vscode-option>Option Label #3</vscode-option>
59
+
</vscode-dropdown>
60
+
</div>
61
+
```
62
+
63
+
```css
64
+
.dropdown-container {
65
+
box-sizing: border-box;
66
+
display: flex;
67
+
flex-flow: columnnowrap;
68
+
align-items: flex-start;
69
+
justify-content: flex-start;
70
+
}
71
+
72
+
.dropdown-containerlabel {
73
+
display: block;
74
+
color: var(--vscode-foreground);
75
+
cursor: pointer;
76
+
font-size: var(--vscode-font-size);
77
+
line-height: normal;
78
+
margin-bottom: 2px;
79
+
}
57
80
```
58
81
59
82
### Disabled Attribute
60
83
61
84
```html
62
-
<labelfor="my-dropdown">Choose an option:</label>
63
-
<vscode-dropdownid="my-dropdown"disabled>
85
+
<vscode-dropdowndisabled>
64
86
<vscode-option>Option Label #1</vscode-option>
65
87
<vscode-option>Option Label #2</vscode-option>
66
88
<vscode-option>Option Label #3</vscode-option>
@@ -70,8 +92,7 @@ The `vscode-dropdown` component must be used with the `vscode-option` component.
70
92
### Open Attribute
71
93
72
94
```html
73
-
<labelfor="my-dropdown">Choose an option:</label>
74
-
<vscode-dropdownid="my-dropdown"open>
95
+
<vscode-dropdownopen>
75
96
<vscode-option>Option Label #1</vscode-option>
76
97
<vscode-option>Option Label #2</vscode-option>
77
98
<vscode-option>Option Label #3</vscode-option>
@@ -81,17 +102,15 @@ The `vscode-dropdown` component must be used with the `vscode-option` component.
81
102
### Position Attribute
82
103
83
104
```html
84
-
<labelfor="my-dropdown">Choose an option:</label>
85
-
<vscode-dropdownid="my-dropdown"position="above">
105
+
<vscode-dropdownposition="above">
86
106
<vscode-option>Option Label #1</vscode-option>
87
107
<vscode-option>Option Label #2</vscode-option>
88
108
<vscode-option>Option Label #3</vscode-option>
89
109
</vscode-dropdown>
90
110
```
91
111
92
112
```html
93
-
<labelfor="my-dropdown">Choose an option:</label>
94
-
<vscode-dropdownid="my-dropdown"position="below">
113
+
<vscode-dropdownposition="below">
95
114
<vscode-option>Option Label #1</vscode-option>
96
115
<vscode-option>Option Label #2</vscode-option>
97
116
<vscode-option>Option Label #3</vscode-option>
@@ -105,8 +124,7 @@ The default indicator is a downward facing chevron, but it can customized by add
105
124
```html
106
125
<!-- Note: Using Visual Studio Code Codicon Library -->
0 commit comments