UNPKG

@wikimedia/codex

Version:

Codex Design System for Wikimedia

17 lines (16 loc) 780 B
import { ComputedRef, SetupContext, Slot } from 'vue'; /** * Determine whether a button is an icon-only button. * * This returns a computed property that is true if the only contents of the button's default slot * are a single CdxIcon component or `<svg>` element, and false otherwise. * * If the button is icon-only but does not have either the aria-label or aria-hidden attribute set, * this function will emit a warning. * * @param slot Slot object (e.g. `slots.default`) * @param attrs Attributes passed to the button * @param componentName Name of the component * @return Whether the button contents are only an icon */ export default function useIconOnlyButton(slot: Slot | undefined, attrs: SetupContext['attrs'], componentName: string): ComputedRef<boolean>;