Skip to main content

Icon

A semantic icon component based on the built-in SVG icon set.

Basic usage​

Basic usage
import { LhIcon } from '@lh-ui/react'

export default function Demo() {
return (
<>
<LhIcon name="search" />
<LhIcon name="search" size={32} />
<LhIcon name="search" color="var(--lh-primary-color, #1677ff)" />
<LhIcon name="loading" color="var(--lh-success-color, #52c41a)" />
</>
)
}

Icon Props​

PropDescriptionTypeOptionsDefault
nameIcon nameLhIconNameSee @lh-ui/share/core/icon—
sizeSizenumber | 'small' | 'middle' | 'large'—From ConfigProvider
colorColorstring—currentColor
decorativeDecorative mode (outputs aria-hidden)boolean—true
ariaLabelAccessibility label (effective when decorative={false})string——
themeVarsComponent-level theme variablesRecord<string, string>——
sxLayout shorthandSxProps——
Accessibility

decorative is true by default, so the icon is invisible to screen readers. If the icon carries meaning, pass decorative={false} and ariaLabel; it then renders <svg role="img" aria-label>.

children fallback​

When name is absent but children is provided, the component renders the children directly (useful for wrapping a custom SVG):

<LhIcon><MyCustomSvg /></LhIcon>

Styles​

import '@lh-ui/react/style/icon'