import * as React from 'react'; import { Tooltip } from '@fluentui/react-tooltip'; import { makeStyles } from '@fluentui/react-make-styles'; const useStyles = makeStyles({ exampleList: { display: 'flex', flexDirection: 'row', alignItems: 'flex-start', margin: '16px 0', gap: '16px', }, targetContainer: { display: 'inline-grid', alignItems: 'center', justifyItems: 'center', gap: '4px', margin: '16px 128px', }, target: { width: '48px', height: '48px', }, }); export const Basic = () => { const styles = useStyles(); const targetRef = React.useRef(null); return ( <> Hover or focus the buttons to show their tooltips:
This tooltip has formatted content } > {triggerProps => (
)}
); }; export const Aria = () => { const styles = useStyles(); return ( <> Use a screen reader to hear how the tooltip can be used as its target's label or description:
); }; export const Positioning = () => { const styles = useStyles(); return ( <>
Each of these buttons places the tooltip in a different location relative to its trigger button.
); }; export const OnlyIfTruncated = () => { const [wide, setWide] = React.useState(true); const text = 'The tooltip will only show if the text is truncated.'; return ( <>
{text}
); };