gpui-component
gpui-component copied to clipboard
feat: allow access popover state
Hello 👋
For my project, I have to display a floating window, when I write / in a component Input.
The current problem is that my trigger is an event and not a user action such as clicking a button.
So I would like to be able to access the status of my popover in order to display/hide it without asking for an additional action from my user.
In React we can consider the following code.
function MyTextInput {
const [is_show, set_is_show] = useState(false)
function handleChange(event) {
set_is_show(event.target.value.endsWith('/'))
}
return (
<Fragment>
<input onChange={handleChange} />
{is_show ? "show popover" : "hide"}
</Fragment>
)
}
Is that possible ?
User story
- My user clicks on an
Input - He writes words and then types the character
/ - The popover is displayed without any trigger (no element)