update1: updated image for better understanding
I am trying to implement chip filters similar to googleflights. Right now when you select sports it will show sports1 it will replace sports by sports1.
However, I wanted to insert a textbox, when I enter somevalue in the textbox and hit Enter the primary fee schedule value should change to the entered value.
Can you tell me how to fix it?
chip related code is in chip-selector and tab-demo since if I enter textbox tag. I am just getting string
code snippet and sandbox
const primaryFeeMenuItems = [
"primaryFeeMenuItems1",
"<input type=\"text\" name=\"fname\">",
"primaryFeeMenuItems2",
"primaryFeeMenuItems3"
];
<td>
<SimpleMenu
buttonName="Primary Fee Schedule"
menuItems={primaryFeeMenuItems}
/>
</td>
handleDelete() {
this.setState({ display: !this.state.display });
}
handleClick = event => {
console.log("handle Click");
this.setState({ anchorEl: event.currentTarget });
};
handleClose = e => {
console.log(e.menuItem);
if (e.menuItem) {
this.setState({ display: !this.state.display });
this.setState({ chipName: e.menuItem });
}
this.setState({ anchorEl: null });
};
You are using
Menu
which works a little differently than what you are trying to achieve. Actually looking into how Google Flights is using these filters, it seems like they are usingChips
andDialog
components to produce that result. Once you use aDialog
component, you can define the content yourself.I have created a sandbox here
I converted your code to take Dialog instead of Menu.
menuItems
returns ListItem instead of MenuItems. Find the full code in the sandbox.The
input
you are trying to get should be before theList
. You can handle that any way you want.I haven't overridden the CSS properties for Dialog. So, once you override the backdrop background color and position of the dialog, you should achieve the display as well.