Skip to content

Commit

Permalink
Docs(web-react): Add demo with Tooltip on Icon cmp
Browse files Browse the repository at this point in the history
- New demo with tooltip on Icon component
  • Loading branch information
pavelklibani committed Feb 2, 2024
1 parent f116536 commit 84b227d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React, { useState } from 'react';
import { Icon } from '../../Icon';
import { TooltipModern, TooltipPopover, TooltipTrigger } from '../../Tooltip';

const TooltipIcon = () => {
const [openIcon, setOpenIcon] = useState(false);

return (
<div className="spirit-feature-tooltip-enable-data-placement">
<p>
Click on the icon on the right to view the tooltip{' '}
<TooltipModern
id="tooltip-example-with-icon"
isOpen={openIcon}
onToggle={setOpenIcon}
placement="right"
flipFallbackPlacements={['top-start', 'bottom-start', 'left']}
UNSAFE_className="d-inline-block"
isDismissible
>
<TooltipTrigger
elementType={Icon}
name="info"
boxSize={16}
UNSAFE_className="d-inline-block"
marginBottom="space-200"
/>
<TooltipPopover>Close me</TooltipPopover>
</TooltipModern>
</p>
</div>
);
};

export default TooltipIcon;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import TooltipDismissibleViaJS from './TooltipDismissibleViaJS';
import TooltipOnHover from './TooltipOnHover';
import TooltipPlacements from './TooltipPlacements';
import TooltipWithFloatingUI from './TooltipWithFloatingUI';
import TooltipIcon from './TooltipIcon';

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>
Expand All @@ -32,6 +33,9 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<DocsSection title="Dismissible Tooltip via JS API and Floating UI">
<TooltipDismissibleViaJS />
</DocsSection>
<DocsSection title="Tooltip on Icon Component">
<TooltipIcon />
</DocsSection>
<DocsSection title="Advanced Floating Functionality" stackAlignment="stretch">
<TooltipWithFloatingUI />
</DocsSection>
Expand Down

0 comments on commit 84b227d

Please sign in to comment.