Skip to content

use/useIcons ​

Overview ​

Resolves and caches component icon entries by merging the default icon registry with inherited and local overrides.

Each icon entry is a { component, props } pair. component must be a Vue component definition (markRaw is applied automatically on write so entries are safe in reactive contexts). props is an optional plain object merged shallowly with any caller-supplied props at render time.

Override semantics are replace: an override entry wins entirely over the default for that icon slot.

A registry's Default key holds entries for any component. A component looks up an icon name in its own override entry, then the override's Default, then its own default registry entry, then the default registry's Default.

Properties ​

ICON_OVERRIDE_PROPS ​

Vue component props definition for components that accept an icon override prop. Spread into component options to let callers supply a partial icon registry that is merged with inherited (ancestor) and default icon entries and scoped to this component and its descendants. Mirrors THEME_OVERRIDE_PROPS.

@vueda-spread props

Type: object

Source: client/lib/use/useIcons.js:98

Methods ​

  • getIcons - Get the default icon registry.
  • patchIcons - Patch the default icon registry with a partial registry.
  • setIcons - Set the default icon registry, replacing any previously registered defaults.
  • useIcons - A hook to get the icon entry for a given icon name within a component's icon slots.
  • useIconsOverride - Merge a local icon registry override with ancestor overrides and provide the result for descendant components.

Types ​

ComponentIcons ​

ComponentIcons = object

IconEntry ​

NameTypeDescription
componentComponent
propsobject

IconOverrideProps ​

NameTypeDescription
iconOverrideIconRegistry

IconRegistry ​

IconRegistry = object

UseIconsReturnFunction ​

UseIconsReturnFunction = (iconName: string) => IconEntry | null

Source ​

client/lib/use/useIcons.js:1