diff options
| author | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-21 19:57:10 -0500 |
|---|---|---|
| committer | xXJSONDeruloXx <danielhimebauch@gmail.com> | 2025-01-21 19:57:10 -0500 |
| commit | eb7bd96a92c351080bdee8004334bd93d81b41d9 (patch) | |
| tree | 22fba8b5ed8da5c5d875f8dd12ed23ae5c5b7ca7 /src | |
| parent | c1ebbc4b02c2e4fcb81661f2c0e87cd4f3f71147 (diff) | |
| download | Decky-Framegen-eb7bd96a92c351080bdee8004334bd93d81b41d9.tar.gz Decky-Framegen-eb7bd96a92c351080bdee8004334bd93d81b41d9.zip | |
feat: add dropdown menu
Diffstat (limited to 'src')
| -rwxr-xr-x | src/index.tsx | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/index.tsx b/src/index.tsx index 16cd6cb..15fe792 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,9 @@ import { PanelSection, PanelSectionRow, Navigation, - staticClasses + staticClasses, + Dropdown, + DropdownOption } from "@decky/ui"; import { addEventListener, @@ -28,8 +30,15 @@ const add = callable<[first: number, second: number], number>("add"); // It starts a (python) timer which eventually emits the event 'timer_event' const startTimer = callable<[], void>("start_timer"); +const dropdownOptions: DropdownOption[] = [ + { label: "1", data: 1 }, + { label: "2", data: 2 }, + { label: "3", data: 3 }, +]; + function Content() { const [result, setResult] = useState<number | undefined>(); + const [selectedOption, setSelectedOption] = useState<number | undefined>(); const onClick = async () => { const result = await add(Math.random(), Math.random()); @@ -54,6 +63,13 @@ function Content() { {"Start Python timer"} </ButtonItem> </PanelSectionRow> + <PanelSectionRow> + <Dropdown + rgOptions={dropdownOptions} + selectedOption={selectedOption} + onChange={(option) => setSelectedOption(option.data)} + /> + </PanelSectionRow> {/* <PanelSectionRow> <div style={{ display: "flex", justifyContent: "center" }}> |
