MCPcopy
hub / github.com/jesec/flood / TooltipWithRef

Function TooltipWithRef

client/src/javascript/components/general/Tooltip.stories.tsx:506–533  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

504export const WithRef: Story = {
505 render: () => {
506 const TooltipWithRef = () => {
507 const tooltipRef = useRef<TooltipHandle>(null);
508
509 return (
510 <div style={{display: 'flex', gap: '20px'}}>
511 <Tooltip
512 ref={tooltipRef}
513 content="Controlled via ref"
514 position="top"
515 onOpen={fn()}
516 onClose={fn()}
517 onMouseLeave={fn()}
518 >
519 <button style={{padding: '10px 20px'}}>Hover for tooltip</button>
520 </Tooltip>
521 <button
522 style={{padding: '10px 20px'}}
523 onClick={() => {
524 if (tooltipRef.current) {
525 tooltipRef.current.dismissTooltip(true);
526 }
527 }}
528 >
529 Dismiss tooltip
530 </button>
531 </div>
532 );
533 };
534
535 return <TooltipWithRef />;
536 },

Callers

nothing calls this directly

Calls 1

fnFunction · 0.85

Tested by

no test coverage detected