index.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import React from 'react';
  2. import { Tooltip, Button } from '@douyinfe/semi-ui';
  3. function Demo() {
  4. const containerId = 'container';
  5. const scrollItemId = `scroll-item`;
  6. const scrollContainerId = `scroll-container`;
  7. const triggerId = `trigger`;
  8. return (
  9. <div style={{ height: 2000 }}>
  10. <div
  11. style={{
  12. height: 320,
  13. width: 320,
  14. display: 'inline-block',
  15. overflow: 'auto',
  16. padding: 50,
  17. marginTop: 100,
  18. }}
  19. id={scrollContainerId}
  20. >
  21. <div style={{ height: 480, width: 320 }} id={scrollItemId}>
  22. <div id={containerId}></div>
  23. <Tooltip
  24. motion={true}
  25. showArrow={true}
  26. content={'Content'}
  27. visible={true}
  28. trigger={'click'}
  29. getPopupContainer={() => document.getElementById(containerId)}
  30. >
  31. <Button id={triggerId}>Click here</Button>
  32. </Tooltip>
  33. <Tooltip
  34. disabled
  35. motion={true}
  36. showArrow={true}
  37. content={'Content'}
  38. visible={true}
  39. trigger={'click'}
  40. getPopupContainer={() => document.getElementById(containerId)}
  41. >
  42. <Button disabled block>
  43. Click here
  44. </Button>
  45. </Tooltip>
  46. <Tooltip
  47. motion={true}
  48. showArrow={true}
  49. content={'Content'}
  50. visible={true}
  51. trigger={'click'}
  52. getPopupContainer={() => document.getElementById(containerId)}
  53. wrapWhenSpecial={false}
  54. >
  55. <Button>Click here</Button>
  56. </Tooltip>
  57. </div>
  58. </div>
  59. </div>
  60. );
  61. }
  62. export default Demo;