static/app/components/core/info/infoText.mdx
import {InfoText} from '@sentry/scraps/info'; import {Flex} from '@sentry/scraps/layout';
import * as Storybook from 'sentry/stories';
export const documentation = import('!!type-loader!@sentry/scraps/info/infoText');
InfoText renders text with a dotted underline that reveals a tooltip on hover or focus. It's keyboard accessible out of the box and provides a consistent pattern for inline explanations.
<Storybook.Demo> <InfoText title="Time to First Byte measures the time from the request start until the first byte of the response is received."> TTFB </InfoText> </Storybook.Demo>
<InfoText title="Time to First Byte measures the time...">TTFB</InfoText>
InfoText extends Text, so you can use props like size and variant to style the text.
<Storybook.Demo> <Flex gap="lg" align="center"> <InfoText title="Small muted text" size="sm" variant="muted"> Hint text </InfoText> <InfoText title="Bold text" bold> Important term </InfoText> </Flex> </Storybook.Demo>
<InfoText title="Small muted text" size="sm" variant="muted">
Hint text
</InfoText>
<InfoText title="Bold text" bold>
Important term
</InfoText>
For truncated text, use mode="overflowOnly". This sets ellipsis and shows the tooltip only when the text overflows, while keeping the text keyboard accessible without adding an underline.
<Storybook.Demo> <Storybook.SizingWindow display="block" style={{flexGrow: 0, minWidth: 0}}> <InfoText title="Full text" mode="overflowOnly"> A long piece of text that will be truncated when the window is resized narrower </InfoText> </Storybook.SizingWindow> </Storybook.Demo>
<Storybook.SizingWindow display="block" style={{flexGrow: 0, minWidth: 0}}>
<InfoText title="Full text" mode="overflowOnly">
A long piece of text that will be truncated when the window is resized narrower
</InfoText>
</Storybook.SizingWindow>
Use InfoText to:
Prefer InfoText over wrapping text with a raw Tooltip component.