• Docs
  • Blog
    • 0.25.1

    • light

      dark

      system

      Switch mode
    • Cerberus

      Acheron

      Elysium

    Get Started
    Components
    Styling
    Theming

    Concepts

    OverviewCompositionTesting

    Layout

    Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrap

    Components

    AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsNumber InputPin InputProgressPrompt ModalRadioRatingSelectSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

    Utilities

    Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFrameHighlightJSON Tree ViewLocaleLocal StoragePortalPresenceShowsplitPropsTheme

    Tooltip

    A small pop-up box that appears when a user hovers over an element.

    • npm
    • source
    • recipe
    • Ark
    import { Tooltip } from '@cerberus/react'

    Usage

    Get information from something that has a very long description.
    Copy
    'use client'
    import { Information } from '@carbon/icons-react'
    import { Tooltip } from '@cerberus/react'
    function BasicTooltipPreview() {
    return (
    <Tooltip
    content="Get information from something that has a very long description."
    >
    <Information />
    </Tooltip>
    )
    }

    Positioning

    You can position the tooltip relative to the target element using the position prop.

    Top position
    Right position
    Bottom position
    Left position
    Copy
    Positioning Demo
    'use client'
    import { InformationFilled } from '@carbon/icons-react'
    import { Tooltip } from '@cerberus/react'
    import { HStack } from 'styled-system/jsx'
    function PositioningTooltipPreview() {
    return (
    <HStack gap="3xl">
    <Tooltip
    content="Top position"
    positioning={{
    placement: 'top',
    }}
    >
    <InformationFilled />
    </Tooltip>
    <Tooltip
    content="Right position"
    positioning={{
    placement: 'right',
    }}
    >
    <InformationFilled />
    </Tooltip>
    <Tooltip
    content="Bottom position"
    positioning={{
    placement: 'bottom',
    }}
    >
    <InformationFilled />
    </Tooltip>
    <Tooltip
    content="Left position"
    positioning={{
    placement: 'left',
    }}
    >
    <InformationFilled />
    </Tooltip>
    </HStack>
    )
    }

    Primitives

    You can utilize the primitive components or the css prop to customize the checkbox.

    ComponentDescription
    TooltipRootThe context provider for the Tooltip parts
    TooltipTriggerThe focusable element that triggers the tooltip on hover
    TooltipPositionerThe positioning container for the tooltip
    TooltipContentThe content of the tooltip
    TooltipArrowThe arrow container of the tooltip bubble
    TooltipArrowTipThe tip of the arrow

    API

    Props

    The Tooltip component is an abstraction of the primitives and accepts the following props:

    NameDefaultDescription
    contentWhat to display in the Tooltip.

    The Tooltip component also accepts all the props of the TooltipRoot primitive props

    Parts

    The TooltipParts API is an Object containing the full family of components.

    Note

    It is best to only use the TooltipParts if you are building a custom solution. Importing Object based components will ship every property it includes into your bundle, regardless if you use it or not.

    NameDescription
    RootThe TooltipRoot component.
    TriggerThe TooltipTrigger component.
    PositionerThe TooltipPositioner component.
    ContentThe TooltipContent component.
    ArrowThe TooltipArrow component.
    ArrowTipThe TooltipArrowTip component.

    On this page

    • Edit this page on Github
    Cerberus Design System | Docs