Props
Usage guidelines
- To offer simple, bite-sized assistive information about an element or section on the screen.
- To provide information or links to information that enhances a user's understanding of the feature.
- To provide extensive information that is longer than a short sentence. Use BannerSlim instead.
- To display recommendations for how to improve a user's experience. Use BannerSlim instead.
- To display time-sensitive information to a user. Use BannerCallout or BannerSlim instead.
Best practices
Place HelpButton to the end of the element you wish to add guidance to.
Include HelpButton within blocks of content.
Accessibility
HelpButton's tooltip text is static
, defined as Click to learn more
. Use the required accessibilityLabel
prop to give the user more details, using the format "Click to learn more about {the associated element}". accessibilityPopoverLabel
should be similar, but using the format "Expanded information about {the associated element}".
Localization
Be sure to localize all text strings. Note that localization can lengthen text by 20 to 30 percent.
import { DefaultLabelProvider, Flex, HelpButton } from 'gestalt'; export default function Example() { return ( <DefaultLabelProvider labels={{ HelpButton: { tooltipMessage: 'Klicken Sie hier, um mehr zu erfahren', }, }} > <Flex alignItems="center" height="100%" justifyContent="center"> <HelpButton accessibilityLabel="Klicken Sie hier, um mehr über die Schaltfläche Hilfe zu erfahren." accessibilityPopoverLabel="Erweiterte Informationen über die Schaltfläche Hilfe" text="Informativer Kontext, der bei einem Klick angezeigt wird" /> </Flex> </DefaultLabelProvider> ); }
Variants
Link
HelpButton's popover content can contain a link to additional information. If needed, this interaction can be paired with GlobalEventsHandlerProvider.
import { Flex, HelpButton, Text } from 'gestalt'; export default function Example() { return ( <Flex alignItems="center" gap={1} height="100%" justifyContent="center"> <Text>This is Gestalt</Text> <HelpButton accessibilityLabel="Click to learn more about gestalt" accessibilityPopoverLabel="Expanded information about Gestalt" link={{ href: 'https://gestalt.pinterest.systems/', text: 'Read our documentation', accessibilityLabel: 'Visit Gestalt portal', }} text="Gestalt is Pinterest's design system." /> </Flex> ); }
Text
The text
prop accepts either a string or
Text. Use a string for simple text without any visual style. HelpButton will handle the message style and adherence to design guidelines. If a message with more complex style is required, such as bold text or inline links, use Text to wrap your message with any additional
Text or
Link components contained within.
import { Flex, HelpButton, Text } from 'gestalt'; export default function Example() { return ( <Flex alignItems="center" gap={1} height="100%" justifyContent="center"> <Text>This is Gestalt</Text> <HelpButton accessibilityLabel="Click to learn more about gestalt" accessibilityPopoverLabel="Expanded information about Gestalt" link={{ href: 'https://gestalt.pinterest.systems/', text: 'Read our documentation', accessibilityLabel: 'Visit Gestalt portal', }} text={ <Text> <Text inline weight="bold"> Gestalt </Text>{' '} is Pinterest`s design system. </Text> } /> </Flex> ); }
Related
Tooltip
Tooltip describes the function of an interactive element, typically
IconButton, on hover. However, adding links, buttons or any clickable element within Tooltip is not advisable due to accessibility concerns. Adding Tooltip to HelpButton is not necessary as it's already built in.
IconButton
HelpButton is a more specific component than IconButton. IconButton is preferable for more general uses of interactive icons whereas HelpButton is the preferred solution for providing short-form guidance for an element.