UNPKG

@mui/x-charts

Version:

The community edition of the Charts components (MUI X).

25 lines 738 B
import { useHighlighted } from './useHighlighted'; /** * A hook to check the highlighted state of the item. * This function already calculates that an item is not faded if it is highlighted. * * If you need fine control over the state, use the `useHighlighted` hook instead. * * @param {HighlightItemData} item is the item to check * @returns {ItemHighlightedState} the state of the item */ export function useItemHighlighted(item) { const highlighted = useHighlighted(); if (!item) { return { isHighlighted: false, isFaded: false }; } const isHighlighted = highlighted.isHighlighted(item); const isFaded = !isHighlighted && highlighted.isFaded(item); return { isHighlighted, isFaded }; }