File tree Expand file tree Collapse file tree 5 files changed +105
-1
lines changed
Expand file tree Collapse file tree 5 files changed +105
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import "./index.css";
55import Root from "./routes/Root.tsx" ;
66import BadgePage from "./routes/BadgePage.tsx" ;
77import CheckboxPage from "./routes/CheckboxPage.tsx" ;
8+ import RadioPage from "./routes/RadioPage.tsx" ;
9+ import SingleSelectPage from "./routes/SingleSelectPage.tsx" ;
810
911if ( import . meta. env . DEV ) {
1012 await import ( "@vscode-elements/webview-playground" ) ;
@@ -23,6 +25,14 @@ const router = createBrowserRouter([
2325 path : "/checkbox" ,
2426 element : < CheckboxPage /> ,
2527 } ,
28+ {
29+ path : "/radio" ,
30+ element : < RadioPage /> ,
31+ } ,
32+ {
33+ path : "/single-select" ,
34+ element : < SingleSelectPage /> ,
35+ } ,
2636 ] ,
2737 } ,
2838] ) ;
Original file line number Diff line number Diff line change 11import { VscodeCheckbox } from "@vscode-elements/react-elements" ;
22import { useState } from "react" ;
33
4- export default function BadgePage ( ) {
4+ export default function CheckboxPage ( ) {
55 const [ checked , setChecked ] = useState ( false ) ;
66 const [ clickCount , setClickCount ] = useState ( 0 ) ;
77
Original file line number Diff line number Diff line change 1+ import { VscodeRadio , VscodeRadioGroup } from "@vscode-elements/react-elements" ;
2+
3+ export default function RadioPage ( ) {
4+ return (
5+ < div >
6+ < h1 > Radio</ h1 >
7+ < h2 > Change event</ h2 >
8+ < p >
9+ < VscodeRadioGroup
10+ onChange = { ( ev ) => {
11+ console . log ( ev ) ;
12+ } }
13+ >
14+ < VscodeRadio
15+ name = "radio-1"
16+ onChange = { ( ev ) => {
17+ console . log ( ev ) ;
18+ } }
19+ >
20+ Option #1
21+ </ VscodeRadio >
22+ < VscodeRadio name = "radio-1" > Option #2</ VscodeRadio >
23+ < VscodeRadio name = "radio-1" > Option #3</ VscodeRadio >
24+ </ VscodeRadioGroup >
25+ </ p >
26+ < h2 > Invalid event</ h2 >
27+ < form action = "#" >
28+ < p >
29+ < VscodeRadioGroup >
30+ < VscodeRadio
31+ name = "radio-2"
32+ onInvalid = { ( ev ) => {
33+ console . log ( ev ) ;
34+ } }
35+ required
36+ >
37+ Option #1
38+ </ VscodeRadio >
39+ < VscodeRadio name = "radio-2" > Option #2</ VscodeRadio >
40+ < VscodeRadio name = "radio-2" > Option #3</ VscodeRadio >
41+ </ VscodeRadioGroup >
42+ < button type = "submit" > Submit</ button >
43+ </ p >
44+ </ form >
45+ </ div >
46+ ) ;
47+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ export default function Root() {
88 < ul >
99 < li > < a href = "/badge" > Badge</ a > </ li >
1010 < li > < a href = "/checkbox" > Checkbox</ a > </ li >
11+ < li > < a href = "/radio" > Radio</ a > </ li >
12+ < li > < a href = "/single-select" > Single Select</ a > </ li >
1113 </ ul >
1214 </ aside >
1315 < main >
Original file line number Diff line number Diff line change 1+ import {
2+ VscodeOption ,
3+ VscodeSingleSelect ,
4+ } from "@vscode-elements/react-elements" ;
5+
6+ export default function SingleSelectPage ( ) {
7+ return (
8+ < div >
9+ < h1 > Single Select</ h1 >
10+ < h2 > Listen "change" and "click" events</ h2 >
11+ < p >
12+ < VscodeSingleSelect
13+ onChange = { ( ev ) => {
14+ console . log ( ev ) ;
15+ } }
16+ onClick = { ( ev ) => {
17+ console . log ( ev ) ;
18+ } }
19+ >
20+ < VscodeOption > Lorem</ VscodeOption >
21+ < VscodeOption > Ipsum</ VscodeOption >
22+ < VscodeOption > Dolor</ VscodeOption >
23+ </ VscodeSingleSelect >
24+ </ p >
25+ < h2 > Listen "invalid" event</ h2 >
26+ < form action = "#" >
27+ < p >
28+ < VscodeSingleSelect
29+ onInvalid = { ( ev ) => {
30+ console . log ( ev ) ;
31+ } }
32+ required
33+ name = "select-2"
34+ >
35+ < VscodeOption > </ VscodeOption >
36+ < VscodeOption > Lorem</ VscodeOption >
37+ < VscodeOption > Ipsum</ VscodeOption >
38+ < VscodeOption > Dolor</ VscodeOption >
39+ </ VscodeSingleSelect >
40+ </ p >
41+ < button > Submit</ button >
42+ </ form >
43+ </ div >
44+ ) ;
45+ }
You can’t perform that action at this time.
0 commit comments