Skip to Content
Soundor Components
Components

Tooltip

Supplemental text on hover or keyboard focus.

import { Button, Knob, Tooltip } from '@soundor/components';
import { useTheme } from '@soundor/components/theme';
import { View } from '@soundor/react';
import { useState } from 'react';

export default function Demo() {
  const theme = useTheme();
  const [drive, setDrive] = useState(3);
  return (
    <View style={{ alignItems: 'center', gap: theme.spacing.spaceMd }}>
      <Button>Before tooltip</Button>
      <Tooltip
        content={
          <Tooltip.Content label="Includes the post-effects signal">
            <Tooltip.Arrow debugId="tooltip-arrow" />
          </Tooltip.Content>
        }
      >
        <Button accessibilityLabel="Analyzer">Analyzer</Button>
      </Tooltip>
      <Tooltip content={`Drive: ${drive.toFixed(1)} dB`}>
        <Knob
          label="Drive"
          min={0}
          max={12}
          value={drive}
          onChange={setDrive}
        />
      </Tooltip>
      <Tooltip content="Select a preset before saving">
        <Button disabled>Save preset</Button>
      </Tooltip>
    </View>
  );
}
tooltip.tsx, running in the web runtime.Source
<Tooltip content="Includes the post-effects signal">
  <Button icon={analyzerIcon} accessibilityLabel="Analyzer" />
</Tooltip>

Tooltip enhances one control that forwards a Soundor node ref. It appears on hover or keyboard-visible focus. openDelay and closeDelay are milliseconds and default to 500 and 100. side, align and offset choose the preferred position; the surface flips and clamps at the editor's edge. content may change while open, for example to show a Knob's current value. Pressing or starting a drag hides an automatic tooltip until a new hover or focus.

Supply open to own visibility. For a Plot marker or other external anchor, use <Tooltip open={showDescription} anchor={markerRef} content={description} />. External points, rectangles and dynamic readers use logical view coordinates. Hide controlled hover tips on gesture start or use controlled visibility to show a live readout during a gesture.

Content is plain text and does not receive pointer input or focus. Soundor currently has no tooltip role or description relationship, so for compatible controls the text is also supplied as the accessibility hint (an explicitly provided hint takes precedence). Always give icon-only controls a meaningful label. Disabled controls may receive hover but cannot take keyboard focus; make essential explanations available independently of the tooltip.

Styling slots are root and label under theme.components.Tooltip.

Arrow

To add a decorative pointer, pass Tooltip.Content with one Tooltip.Arrow as content. The label still provides the text and the trigger's fallback accessibility hint. The arrow follows the resolved side and uses the same placement and styling as Popover.Arrow.

<Tooltip
  content={
    <Tooltip.Content label="Includes the post-effects signal">
      <Tooltip.Arrow />
    </Tooltip.Content>
  }
>
  <Button>Analyzer</Button>
</Tooltip>

Props

Prop

Type

Placement defaults to side="top" and align="center". See Popup anchors for the supported anchor shapes.

Tooltip.Content

Prop

Type

Tooltip.Arrow

Prop

Type

On this page