Composables
useComponentIcons
Resolve leading/trailing/loading icon props the same way every Vy UI kit component does.
Overview
useComponentIcons (from @vyui/kit) powers the icon / leadingIcon / trailingIcon / loading prop convention used across kit components like Input and Button.
import { useComponentIcons } from '@vyui/kit'
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
Behavior
iconroutes leading unlesstrailingis set.loadingtakes precedence and swaps inappConfig.ui.icons.loading(or aloadingIconoverride).leadingIcon/trailingIconwin overiconwhen both are set, since they pin a side explicitly.
Returns
| Property | Type | Description |
|---|---|---|
isLeading | ComputedRef<boolean> | Whether a leading icon should render. |
isTrailing | ComputedRef<boolean> | Whether a trailing icon should render. |
leadingIconName | ComputedRef<string | undefined> | Resolved leading icon name. |
trailingIconName | ComputedRef<string | undefined> | Resolved trailing icon name. |
When to use it
Most app authors won't call this directly — it's mainly useful if you're building your own component that wants the same icon-prop ergonomics as the kit.