Icon
RSC
Icons provide clear, intuitive visual cues for better usability and accessibility in digital products.
Installation
API Reference
This is an illustration of Icon component.
size
<Icon as={EditIcon} size="md" />
Installation
CLI
Manual
Run the following command:
npx gluestack-ui add icon
Step 1: Install the following dependencies:
npm i @gluestack-ui/icon
Step 2: Copy and paste the following code into your project.
"use client"import React from "react"import { createIcon } from "@gluestack-ui/icon"import { Path } from "react-native-svg"import { tva } from "@gluestack-ui/nativewind-utils/tva"import { cssInterop } from "nativewind"import { VariantProps } from "@gluestack-ui/nativewind-utils"import { PrimitiveIcon, IPrimitiveIcon, Svg } from "@gluestack-ui/icon"export const UIIcon = createIcon({Root: PrimitiveIcon,}) as React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<typeof PrimitiveIcon> &React.RefAttributes<React.ElementRef<typeof Svg>>>const iconStyle = tva({base: "text-typography-950 fill-none pointer-events-none",variants: {size: {"2xs": "h-3 w-3",xs: "h-3.5 w-3.5",sm: "h-4 w-4",md: "h-[18px] w-[18px]",lg: "h-5 w-5",xl: "h-6 w-6",},},})cssInterop(UIIcon, {className: {target: "style",nativeStyleToProp: {height: true,width: true,fill: true,color: "classNameColor",stroke: true,},},})type IIConProps = IPrimitiveIcon &VariantProps<typeof iconStyle> &React.ComponentPropsWithoutRef<typeof UIIcon>const Icon = React.forwardRef<React.ElementRef<typeof Svg>, IIConProps>(({ size = "md", className, ...props }, ref) => {if (typeof size === "number") {return (<UIIconref={ref}{...props}className={iconStyle({ class: className })}size={size}/>)} else if ((props.height !== undefined || props.width !== undefined) &&size === undefined) {return (<UIIconref={ref}{...props}className={iconStyle({ class: className })}/>)}return (<UIIconref={ref}{...props}className={iconStyle({ size, class: className })}/>)})export { Icon }type ParameterTypes = Omit<Parameters<typeof createIcon>[0], "Root">const createIconUI = ({ ...props }: ParameterTypes) => {const UIIconCreateIcon = createIcon({Root: Svg,...props,}) as React.ForwardRefExoticComponent<React.ComponentPropsWithoutRef<typeof PrimitiveIcon> &React.RefAttributes<React.ElementRef<typeof Svg>>>return React.forwardRef<React.ElementRef<typeof Svg>>(({className,size,...inComingProps}: VariantProps<typeof iconStyle> &React.ComponentPropsWithoutRef<typeof UIIconCreateIcon>,ref) => {return (<UIIconCreateIconref={ref}{...inComingProps}className={iconStyle({ size, class: className })}/>)})}export { createIconUI as createIcon }// All Iconsconst AddIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 5V19"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M5 12H19"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})AddIcon.displayName = "AddIcon"export { AddIcon }const AlertCircleIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 8V12"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 16H12.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})AlertCircleIcon.displayName = "AlertCircleIcon"export { AlertCircleIcon }const ArrowUpIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 19V5"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M5 12L12 5L19 12"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ArrowDownIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 5V19"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M19 12L12 19L5 12"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ArrowRightIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M5 12H19"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 5L19 12L12 19"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ArrowLeftIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M19 12H5"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 19L5 12L12 5"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})ArrowUpIcon.displayName = "ArrowUpIcon"ArrowDownIcon.displayName = "ArrowDownIcon"ArrowRightIcon.displayName = "ArrowRightIcon"ArrowLeftIcon.displayName = "ArrowLeftIcon"export { ArrowUpIcon, ArrowDownIcon, ArrowRightIcon, ArrowLeftIcon }const AtSignIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><><Pathd="M12 16C14.2091 16 16 14.2091 16 12C16 9.79086 14.2091 8 12 8C9.79086 8 8 9.79086 8 12C8 14.2091 9.79086 16 12 16Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M16 7.99999V13C16 13.7956 16.3161 14.5587 16.8787 15.1213C17.4413 15.6839 18.2044 16 19 16C19.7957 16 20.5587 15.6839 21.1213 15.1213C21.6839 14.5587 22 13.7956 22 13V12C21.9999 9.74302 21.2362 7.55247 19.8333 5.78452C18.4303 4.01658 16.4706 2.77521 14.2726 2.26229C12.0747 1.74936 9.76794 1.99503 7.72736 2.95936C5.68677 3.92368 4.03241 5.54995 3.03327 7.57371C2.03413 9.59748 1.74898 11.8997 2.22418 14.1061C2.69938 16.3125 3.90699 18.2932 5.65064 19.7263C7.39429 21.1593 9.57144 21.9603 11.8281 21.9991C14.0847 22.0379 16.2881 21.3122 18.08 19.94"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></></>),})AtSignIcon.displayName = "AtSignIcon"export { AtSignIcon }const BellIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M18 8C18 6.4087 17.3679 4.88258 16.2426 3.75736C15.1174 2.63214 13.5913 2 12 2C10.4087 2 8.88258 2.63214 7.75736 3.75736C6.63214 4.88258 6 6.4087 6 8C6 15 3 17 3 17H21C21 17 18 15 18 8Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M13.73 21C13.5542 21.3031 13.3018 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})BellIcon.displayName = "BellIcon"export { BellIcon }const CalendarDaysIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M19 4H5C3.89543 4 3 4.89543 3 6V20C3 21.1046 3.89543 22 5 22H19C20.1046 22 21 21.1046 21 20V6C21 4.89543 20.1046 4 19 4Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M16 2V6"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M8 2V6"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M3 10H21"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M8 14H8.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 14H12.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M16 14H16.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M8 18H8.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 18H12.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M16 18H16.01"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})CalendarDaysIcon.displayName = "CalendarDaysIcon"export { CalendarDaysIcon }const CheckIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M20 6L9 17L4 12"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const CheckCircleIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 22C17.523 22 22 17.523 22 12C22 6.477 17.523 2 12 2C6.477 2 2 6.477 2 12C2 17.523 6.477 22 12 22Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M9 12L11 14L15 10"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})CheckIcon.displayName = "CheckIcon"CheckCircleIcon.displayName = "CheckCircleIcon"export { CheckIcon, CheckCircleIcon }const ChevronUpIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",d: "M12 10L8 6L4 10",path: (<><Pathd="M18 15L12 9L6 15"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronDownIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M6 9L12 15L18 9"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronLeftIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M15 18L9 12L15 6"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronRightIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M9 18L15 12L9 6"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronsLeftIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M11 17L6 12L11 7"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M18 17L13 12L18 7"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronsRightIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M13 17L18 12L13 7"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M6 17L11 12L6 7"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const ChevronsUpDownIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M7 15L12 20L17 15"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M7 9L12 4L17 9"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})ChevronUpIcon.displayName = "ChevronUpIcon"ChevronDownIcon.displayName = "ChevronDownIcon"ChevronLeftIcon.displayName = "ChevronLeftIcon"ChevronRightIcon.displayName = "ChevronRightIcon"ChevronsLeftIcon.displayName = "ChevronsLeftIcon"ChevronsRightIcon.displayName = "ChevronsRightIcon"ChevronsUpDownIcon.displayName = "ChevronsUpDownIcon"export {ChevronUpIcon,ChevronDownIcon,ChevronLeftIcon,ChevronRightIcon,ChevronsLeftIcon,ChevronsRightIcon,ChevronsUpDownIcon,}const CircleIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})CircleIcon.displayName = "CircleIcon"export { CircleIcon }const ClockIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 6V12L16 14"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})ClockIcon.displayName = "ClockIcon"export { ClockIcon }const CloseIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M18 6L6 18"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M6 6L18 18"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})const CloseCircleIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M15 9L9 15"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M9 9L15 15"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})CloseIcon.displayName = "CloseIcon"CloseCircleIcon.displayName = "CloseCircleIcon"export { CloseIcon, CloseCircleIcon }const CopyIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M20 9H11C9.89543 9 9 9.89543 9 11V20C9 21.1046 9.89543 22 11 22H20C21.1046 22 22 21.1046 22 20V11C22 9.89543 21.1046 9 20 9Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M5 15H4C3.46957 15 2.96086 14.7893 2.58579 14.4142C2.21071 14.0391 2 13.5304 2 13V4C2 3.46957 2.21071 2.96086 2.58579 2.58579C2.96086 2.21071 3.46957 2 4 2H13C13.5304 2 14.0391 2.21071 14.4142 2.58579C14.7893 2.96086 15 3.46957 15 4V5"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})CopyIcon.displayName = "CopyIcon"export { CopyIcon }const DownloadIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M7 10L12 15L17 10"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 15V3"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})DownloadIcon.displayName = "DownloadIcon"export { DownloadIcon }const EditIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M11 4H4C3.46957 4 2.96086 4.21071 2.58579 4.58579C2.21071 4.96086 2 5.46957 2 6V20C2 20.5304 2.21071 21.0391 2.58579 21.4142C2.96086 21.7893 3.46957 22 4 22H18C18.5304 22 19.0391 21.7893 19.4142 21.4142C19.7893 21.0391 20 20.5304 20 20V13"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M18.5 2.50001C18.8978 2.10219 19.4374 1.87869 20 1.87869C20.5626 1.87869 21.1022 2.10219 21.5 2.50001C21.8978 2.89784 22.1213 3.4374 22.1213 4.00001C22.1213 4.56262 21.8978 5.10219 21.5 5.50001L12 15L8 16L9 12L18.5 2.50001Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/></>),})EditIcon.displayName = "EditIcon"export { EditIcon }const EyeIcon = createIcon({Root: Svg,viewBox: "0 0 24 24",path: (<><Pathd="M2 12C2 12 5 5 12 5C19 5 22 12 22 12C22 12 19 19 12 19C5 19 2 12 2 12Z"strokeWidth="2"strokeLinecap="round"strokeLinejoin="round"/><Pathd="M12 15C13.6569 15