Icon
Utility component that can be used to display an icon and control its size, color, and shape.
Import
import { Icon } from '@vortex-kit/vortex';
import type { IconProps } from '@vortex-kit/vortex';
Display
<Icon src={Hexagon} size={5} color="default" />
Allied components
Color
To customize the color of the icon, simply utilize the color prop. You can explore the available color options in the icons props section.
Loading...
Show Code
Inverse Color
Use inverse color for dark backgrounds.
Loading...
Show Code
Color Inheritance
Use inherit to inherit color from parent element.
Loading...
Show Code
Size
The Icon component has a size prop. A value of 4 means 1rem, and higher values increase the size.
Loading...
Show Code
Responsive Sizes
Use responsive sizing with breakpoint objects. xs: 5 equals 1.25rem, sm: 10 equals 2.5rem.
Loading...
Show Code
Percentage Sizing
Use percentage values to fill container dimensions.
Loading...
Show Code
Size Inheritance
Icon component is able to inherit its size and color from the parent element.
Loading...
Show Code
Auto Width
The autoWidth property allows the Icon component to maintain only the vertical bounding box, eliminating any unnecessary horizontal space. This is particularly beneficial when you need to preserve vertical spacing while reducing the horizontal extent.
Loading...
Show Code
Use autoWidth to remove horizontal space. Note that you need to remove the width and height properties from the icon file to make it work.
Loading...
Show Code
Key | Description |
---|---|
⬢ | Icon uses <span> element by default. |
⬢ | Icons have aria-hidden="true" by default to prevent screen readers from reading the icon text. |
⬢ | For interactive icons, use Button or Link components with proper ARIA labels. |