UNPKG

@hitachivantara/uikit-react-core

Version:
29 lines (28 loc) 1.07 kB
import { fixedForwardRef } from "../types/generic.js"; import { HvButton } from "../Button/Button.js"; import { HvTooltip } from "../Tooltip/Tooltip.js"; import { useDefaultProps } from "@hitachivantara/uikit-react-utils"; import { jsx } from "react/jsx-runtime"; //#region src/IconButton/IconButton.tsx /** * The `HvIconButton` component wraps a `HvTooltip` with a label around a `HvButton` with only an icon as its content. * As defined by Design System, a tooltip with the button’s label should always be displayed when hovering an icon only button. * This component provides this behavior out of the box. */ var HvIconButton = fixedForwardRef(function HvIconButton(props, ref) { const { title, placement = "top", enterDelay = 500, tooltipProps, ...others } = useDefaultProps("HvIconButton", props); return /* @__PURE__ */ jsx(HvTooltip, { title, enterDelay, placement, ...tooltipProps, children: /* @__PURE__ */ jsx(HvButton, { icon: true, ref, focusableWhenDisabled: true, ...others }) }); }); //#endregion export { HvIconButton };