gpui-component icon indicating copy to clipboard operation
gpui-component copied to clipboard

feat: allow access popover state

Open LeadcodeDev opened this issue 5 months ago • 0 comments

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

  1. My user clicks on an Input
  2. He writes words and then types the character /
  3. The popover is displayed without any trigger (no element)

LeadcodeDev avatar Nov 01 '25 01:11 LeadcodeDev