UNPKG

@metamask/design-system-react

Version:
1 lines 1.42 kB
{"version":3,"file":"Icon.types.mjs","sourceRoot":"","sources":["../../../src/components/Icon/Icon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { SVGProps, ComponentPropsWithoutRef } from 'react';\n\nimport type { IconName, IconSize, IconColor } from '../../types';\n\n// Use ComponentPropsWithoutRef to get SVG element props without relying on global SVGElement\ntype SVGElementProps = ComponentPropsWithoutRef<'svg'>;\n\nexport type IconProps = SVGProps<SVGElementProps> & {\n /**\n * Required prop to specify which icon to render from the icon set\n */\n name: IconName;\n /**\n * Optional prop to control the size of the icon\n * Different sizes map to specific pixel dimensions\n *\n * @default IconSize.Md\n */\n size?: IconSize;\n /**\n * Optional prop that sets the color of the icon using predefined theme colors\n *\n * @default IconColor.IconDefault\n */\n color?: IconColor;\n /**\n * Additional CSS classes to be added to the component.\n * These classes will be merged with the component's default classes using twMerge.\n */\n className?: string;\n /**\n * Optional CSS styles to be applied to the component.\n * Should be used sparingly and only for dynamic styles that can't be achieved with className.\n */\n style?: React.CSSProperties;\n /**\n * Optional prop to add a test id to the icon\n */\n 'data-testid'?: string;\n};\n"]}