Search the documentation

Type to search page titles, component names and descriptions.

    Feedback

    Popover and Tooltip

    Supplementary content anchored to a control.

    import { Popover, Tooltip } from 'faifo-design'

    Popover shows supplementary content beside its trigger; its open state can be owned by the URL. Tooltip describes a control with text only.

    #When to use

    • Use a tooltip to name or describe; never put actions or essential information in one.
    • Use a popover for a small amount of related content or a few controls.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Popover and tooltip

    Popover state remains URL-owned; tooltips contain descriptive text only.

    Show ownerSyncedLast synchronized two minutes ago
    Show codeHide code
    import { Badge, Inline, Popover, Tooltip } from 'faifo-design'
    
    export const Example = () => (
      <Inline
        items={[
          <Popover
            id="owner-popover"
            label="Record owner"
            trigger={<Badge label="Show owner" />}
            body={<p>Nguyễn Ngọc Linh · Sales operations</p>}
            open
            openHref="#popover"
            closeHref="#popover"
            closeLabel="Close owner details"
          />,
          <Tooltip
            id="sync-tip"
            text="Last synchronized two minutes ago"
            trigger={<Badge label="Synced" tone="positive" />}
          />,
        ]}
      />
    )

    #Contract

    #Popups close on an outside click and on Escape

    Every popup built on <details> behaves like the action menu: a click outside it closes it, and Escape closes the open one and returns focus to its summary. This covers Menu (data-ui="menu"), the period choice of TimeframeFilter (data-ui="timeframe-menu") and list view settings (data-ui="view-settings"). The runtime lists the non-menu popups in DISMISSIBLE_POPUPS; a new popup component adds its hook there instead of wiring its own document listener. The outside click is heard on the document, so an island that follows a link in place calls preventDefault() only: the shell's fragment navigation already leaves a prevented click alone, and stopPropagation() would keep an open menu or filter popover open after the click.

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #PopoverComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequired–string–
    triggerrequired–JSXChild–
    bodyrequired–JSXChild–
    openrequired–boolean–
    openHrefrequired–string–
    closeHrefrequired–string–
    closeLabelrequired–string–
    placement–'bottom-start' | 'bottom-end' | 'top-start' | 'top-end''bottom-start'

    #TooltipComponent

    PropertyDescriptionTypeDefault
    idrequired–string–
    textrequired–string–
    triggerrequired–JSXChild | ((association: { describedBy: string }) => JSXChild)–
    placement–'top' | 'right' | 'bottom' | 'left''top'

    #Types

    #PopoverProps

    The properties of Popover, listed above.

    #Hooks

    The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.

    • popover
    • popover-trigger
    • popover-panel
    • popover-close
    • tooltip
    • tooltip-trigger
    • tooltip-content