Function
Icon
({
name,
size = 'font',
className,
title,
children,
...props
}: SVGProps<SVGSVGElement> & {
name: IconName
size?: Size
title?: string
})
Source from the content-addressed store, hash-verified
| 38 | * in the SVG container, providing this way for accessibility. |
| 39 | */ |
| 40 | export function Icon({ |
| 41 | name, |
| 42 | size = 'font', |
| 43 | className, |
| 44 | title, |
| 45 | children, |
| 46 | ...props |
| 47 | }: SVGProps<SVGSVGElement> & { |
| 48 | name: IconName |
| 49 | size?: Size |
| 50 | title?: string |
| 51 | }) { |
| 52 | if (children) { |
| 53 | return ( |
| 54 | <span |
| 55 | className={`inline-flex items-center ${childrenSizeClassName[size]}`} |
| 56 | > |
| 57 | <Icon |
| 58 | name={name} |
| 59 | size={size} |
| 60 | className={className} |
| 61 | title={title} |
| 62 | {...props} |
| 63 | /> |
| 64 | {children} |
| 65 | </span> |
| 66 | ) |
| 67 | } |
| 68 | return ( |
| 69 | <svg |
| 70 | {...props} |
| 71 | className={cn(sizeClassName[size], 'inline self-center', className)} |
| 72 | > |
| 73 | {title ? <title>{title}</title> : null} |
| 74 | <use href={`${href}#${name}`} /> |
| 75 | </svg> |
| 76 | ) |
| 77 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected