MCPcopy Create free account
hub / github.com/ReactTooltip/react-tooltip / ImperativeOptionsExample

Function ImperativeOptionsExample

src/test/tooltip-advanced.spec.js:174–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172
173 test('tooltip with imperative open options', async () => {
174 const ImperativeOptionsExample = () => {
175 const tooltipRef = useRef(null)
176
177 const handleOpenWithOptions = () => {
178 tooltipRef.current?.open({
179 position: { x: 100, y: 100 },
180 anchorSelect: '#custom-anchor',
181 })
182 }
183
184 return (
185 <>
186 <button onClick={handleOpenWithOptions}>Open With Options</button>
187 <span id="custom-anchor">Custom Anchor</span>
188 <Tooltip
189 id="imperative-options-test"
190 content="Imperative Options Test"
191 ref={tooltipRef}
192 />
193 </>
194 )
195 }
196
197 render(<ImperativeOptionsExample />)
198

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected