-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
24 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 11 additions & 3 deletions
14
...s/components/menu/menu_custom_trigger.tsx → ...mples/components/menu/menu_controlled.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
import React from "react"; | ||
import { Menu, MenuItem } from "@firecms/ui"; | ||
import { Button, Menu, MenuItem } from "@firecms/ui"; | ||
|
||
export default function MenuCustomTriggerDemo() { | ||
|
||
const [open, setOpen] = React.useState(false); | ||
|
||
return ( | ||
<Menu trigger={<div style={{ cursor: 'pointer', padding: '10px', background: 'grey', color: 'white' }}>Click me</div>}> | ||
<Menu | ||
onOpenChange={setOpen} | ||
open={open} | ||
trigger={ | ||
<Button onClick={() => setOpen(true)}>Click me</Button> | ||
}> | ||
<MenuItem onClick={() => alert("Action 1")}>Action 1</MenuItem> | ||
<MenuItem onClick={() => alert("Action 2")}>Action 2</MenuItem> | ||
<MenuItem onClick={() => alert("Action 3")}>Action 3</MenuItem> | ||
</Menu> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters