JGuang

Tooltip

Tooltip · Material UI

Preview
npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Tooltip

Provide concise supplementary labels or descriptions for native children.

This guide covers Material UI Core with the default Emotion engine; extensions and additional demos are explicitly classified.

Use case and business boundary

Tooltip cannot be the only name for an essential unlabeled control; children need compatible refs and disabled controls need an appropriate wrapper.

Native composition and scope

Tooltip

Preserve native Material UI composition and types; do not substitute JGuang UI/Base UI/Radix APIs. Example entries are not extra components.

Native installation and initialization

npm install @mui/material@9.4.0 @emotion/react@11.14.0 @emotion/styled@11.14.1

Use native npm and Emotion, not an invented JGuang UI Registry URL. Place examples inside native ThemeProvider; choose CssBaseline or ScopedCssBaseline for the project. Inspect React, existing providers, lockfile and SSR first. Never overwrite files or conceal peer conflicts. This batch verified React 19.2.8; React 18 and below require matching react-is. See the included bilingual setup guide.

Practical native parameters

These selected parameters are not a flattened universal API. Preserve the native declaring owner, slot structure, nullable values and generics.

Owner.propPractical roleDeclaration source
Tooltip.titleTooltip content; preserve label/description semantics.Tooltip
Tooltip.describeChildTreat Tooltip content as a description rather than replacing the child's name.Tooltip
Tooltip.placementNative Tooltip/Popper positioning enum, not arbitrary CSS positioning.Tooltip
Tooltip.openControlled native visibility; it does not fetch data or execute actions.Tooltip
Tooltip.enterDelayTooltip entry delay in milliseconds.Tooltip

Runnable native examples

Machine keys select example entries, not universal variant props. Native demo JSX/data stay unchanged; JGuang-authored acceptance fixtures are explicitly labelled.

  • Basic tooltip · BasicTooltip · upstream native demo
  • Labels and descriptions · AccessibilityTooltips · upstream native demo
  • Positioned tooltips · PositionedTooltips · upstream native demo
  • Customization · CustomizedTooltips · upstream native demo
  • Arrow tooltips · ArrowTooltips · upstream native demo
  • Distance from anchor · TooltipOffset · upstream native demo
  • Distance from anchor · TooltipMargin · upstream native demo
  • Triggers · TriggersTooltips · upstream native demo
  • Controlled tooltips · ControlledTooltips · upstream native demo
  • Variable width · VariableWidth · upstream native demo
  • Interactive · NonInteractiveTooltips · upstream native demo
  • Disabled elements · DisabledTooltips · upstream native demo
  • Transitions · TransitionsTooltips · upstream native demo
  • Follow cursor · FollowCursorTooltips · upstream native demo
  • Showing and hiding · DelayTooltips · upstream native demo

Explicitly unsupported additional examples

These remain in the upstream inventory, not silently skipped or presented as working previews. Additional dependency/framework acceptance is required.

  • Virtual element · AnchorElTooltips: @popperjs/core

Actual usage example

Unmodified pinned native demo; copy its required local helper files together.

import DeleteIcon from '@mui/icons-material/Delete';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';

export default function BasicTooltip() {
  return (
    <Tooltip title="Delete">
      <IconButton>
        <DeleteIcon />
      </IconButton>
    </Tooltip>
  );
}

Example dependency boundaries

@mui/icons-material/Delete, @mui/material/IconButton, @mui/material/Tooltip, @mui/material/Button, @mui/material/Box, @mui/material/Stack, react, @mui/material/styles, @mui/material/Typography, @mui/material/Grid, @mui/material/ClickAwayListener, @mui/material/Fade, @mui/material/Zoom

Direct Icons/System/Utils example imports require their matching 9.4.0 packages. Relative data/helpers are part of the example closure, not extra components. Remote images and simulated operations do not supply a backend.

Pinned upstream API metadata reference

These tables retain the upstream metadata, not a newly inferred generic type system. Conditional generics, inherited props and callback details are defined by the source declarations below. Theme defaults may override metadata defaults.

Tooltip

import Tooltip from '@mui/material/Tooltip';
import { Tooltip } from '@mui/material';
PropRequiredUpstream metadata type / constraintMetadata default
childrenyeselement—
arrownoboolfalse
classesnoobject—
describeChildnoboolfalse
disableFocusListenernoboolfalse
disableHoverListenernoboolfalse
disableInteractivenoboolfalse
disableTouchListenernoboolfalse
enterDelaynonumber100
enterNextDelaynonumber0
enterTouchDelaynonumber700
followCursornoboolfalse
idnostring—
leaveDelaynonumber0
leaveTouchDelaynonumber1500
onClosenofunc—
onOpennofunc—
opennobool—
placementno'auto-end' | 'auto-start' | 'auto' | 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top''bottom'
slotPropsno{ arrow?: func | object, popper?: func | object, tooltip?: func | object, transition?: func | object }{}
slotsno{ arrow?: elementType, popper?: elementType, tooltip?: elementType, transition?: elementType }{}
sxnoArray<func | object | bool> | func | object—
titlenonode—

Native source declarations

Declarations/imports are extracted from pinned source without flattening unions or external inheritance. Original English comments/types are source reference, not a claim of translated upstream prose. Shared types stay in their native packages.

vendor/src/Tooltip/Tooltip.d.ts

import * as React from 'react';

import { SxProps } from '@mui/system';

import { PopperProps } from '../Popper';

import { Theme } from '../styles';

import { InternalStandardProps as StandardProps } from '../internal';

import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';

import { TransitionProps } from '../transitions/types';

import { TooltipClasses } from './tooltipClasses';

export interface TooltipPopperSlotPropsOverrides {}

export interface TooltipTransitionSlotPropsOverrides {}

export interface TooltipTooltipSlotPropsOverrides {}

export interface TooltipArrowSlotPropsOverrides {}

export interface TooltipSlots {
  /**
   * The component used for the popper.
   * @default Popper
   */
  popper: React.ElementType;
  /**
   * The component used for the transition.
   * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
   * @default Grow
   */
  transition: React.ElementType;
  /**
   * The component used for the tooltip.
   */
  tooltip: React.ElementType;
  /**
   * The component used for the arrow.
   */
  arrow: React.ElementType;
}

export type TooltipSlotsAndSlotProps = CreateSlotsAndSlotProps<
  TooltipSlots,
  {
    /**
     * Props forwarded to the popper slot.
     * By default, the available props are based on the [Popper](https://mui.com/material-ui/api/popper/#props) component.
     */
    popper: SlotProps<
      React.ElementType<PopperProps>,
      TooltipPopperSlotPropsOverrides,
      TooltipOwnerState
    >;
    /**
     * Props forwarded to the transition slot.
     * By default, the available props are based on the [Grow](https://mui.com/material-ui/api/grow/#props) component.
     */
    transition: SlotProps<
      React.ElementType<TransitionProps>,
      TransitionProps & TooltipTransitionSlotPropsOverrides,
      TooltipOwnerState
    >;
    /**
     * Props forwarded to the tooltip slot.
     * By default, the available props are based on the div element.
     */
    tooltip: SlotProps<'div', TooltipTooltipSlotPropsOverrides, TooltipOwnerState>;
    /**
     * Props forwarded to the tooltip slot.
     * By default, the available props are based on the span element.
     */
    arrow: SlotProps<'span', TooltipArrowSlotPropsOverrides, TooltipOwnerState>;
  }
>;

export interface TooltipProps
  extends StandardProps<React.HTMLAttributes<HTMLDivElement>, 'title'>, TooltipSlotsAndSlotProps {
  /**
   * If `true`, adds an arrow to the tooltip.
   * @default false
   */
  arrow?: boolean | undefined;
  /**
   * Tooltip reference element.
   */
  children: React.ReactElement<unknown, any>;
  /**
   * Override or extend the styles applied to the component.
   */
  classes?: Partial<TooltipClasses> | undefined;
  /**
   * Set to `true` if the `title` acts as an accessible description.
   * By default the `title` acts as an accessible label for the child.
   * @default false
   */
  describeChild?: boolean | undefined;
  /**
   * Do not respond to focus-visible events.
   * @default false
   */
  disableFocusListener?: boolean | undefined;
  /**
   * Do not respond to hover events.
   * @default false
   */
  disableHoverListener?: boolean | undefined;
  /**
   * Makes a tooltip not interactive, i.e. it will close when the user
   * hovers over the tooltip before the `leaveDelay` is expired.
   * @default false
   */
  disableInteractive?: boolean | undefined;
  /**
   * Do not respond to long press touch events.
   * @default false
   */
  disableTouchListener?: boolean | undefined;
  /**
   * The number of milliseconds to wait before showing the tooltip.
   * This prop won't impact the enter touch delay (`enterTouchDelay`).
   * @default 100
   */
  enterDelay?: number | undefined;
  /**
   * The number of milliseconds to wait before showing the tooltip when one was already recently opened.
   * @default 0
   */
  enterNextDelay?: number | undefined;
  /**
   * The number of milliseconds a user must touch the element before showing the tooltip.
   * @default 700
   */
  enterTouchDelay?: number | undefined;
  /**
   * If `true`, the tooltip follow the cursor over the wrapped element.
   * @default false
   */
  followCursor?: boolean | undefined;
  /**
   * This prop is used to help implement the accessibility logic.
   * If you don't provide this prop. It falls back to a randomly generated id.
   */
  id?: string | undefined;
  /**
   * The number of milliseconds to wait before hiding the tooltip.
   * This prop won't impact the leave touch delay (`leaveTouchDelay`).
   * @default 0
   */
  leaveDelay?: number | undefined;
  /**
   * The number of milliseconds after the user stops touching an element before hiding the tooltip.
   * @default 1500
   */
  leaveTouchDelay?: number | undefined;
  /**
   * Callback fired when the component requests to be closed.
   *
   * @param {React.SyntheticEvent} event The event source of the callback.
   */
  onClose?: ((event: React.SyntheticEvent | Event) => void) | undefined;
  /**
   * Callback fired when the component requests to be open.
   *
   * @param {React.SyntheticEvent} event The event source of the callback.
   */
  onOpen?: ((event: React.SyntheticEvent) => void) | undefined;
  /**
   * If `true`, the component is shown.
   */
  open?: boolean | undefined;
  /**
   * Tooltip placement.
   * @default 'bottom'
   */
  placement?: PopperProps['placement'] | undefined;
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx?: SxProps<Theme> | undefined;
  /**
   * Tooltip title. Zero-length titles string, undefined, null and false are never displayed.
   */
  title: React.ReactNode;
}

export interface TooltipOwnerState extends TooltipProps {}

export default function Tooltip(props: TooltipProps): React.JSX.Element;

Post-install acceptance

Run strict types, production build and real interactions. Check keyboard labels/focus, disabled/error/read-only semantics where natively supported, both themes, narrow screens and reduced motion. Verify callbacks against the real host data; do not declare installation complete from copying a prompt. Initialization fixtures also require server HTML and warning-free hydration.

Source and license

https://github.com/mui/material-ui/tree/809a7717b4c050ba3f69b75300689f07c050a16e

MIT · @mui/material@9.4.0. Vendor originals and license are preserved. Full original upstream prose remains in vendor/docs and is not represented as fully translated.