This is an illustration of Icon component.
size
<Icon as={CalendarDaysIcon} size="md" />

API Reference

Import

To use this component in your project, include the following import statement in your file.
import { Icon } from "@gluestack-ui/themed"

Anatomy

The structure provided below can help you identify and understand a Icon component's various parts.
export default () => <Icon as={} />

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Icon

Pre built icons provided by gluestack-ui inherits all the properties of React Native SVG's svg component.
The Icon components inherits all the properties that third party library provides and can be directly applied as props.

Features

  • support of props on any svg icon

Accessibility

We have outlined the various features that ensure the Icon component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards.
Role: img is passed

Themed

The themed version of the component is a pre-styled version of the component, which allows you to quickly integrate the component into your project. The component's design and functionality are fully defined, allowing you to focus on the more important aspects of your project. To know more about Themed Library please visit this link.

Props

Icon component is created using AsForwarder component from @gluestack-style/react. It extends all the props supported by gluestack-ui AsForwarder, utility props and the props mentioned below.

Image

Name
Value
Default
size
2xs | xs | sm | md | lg | xl
md

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

All gluestack icons

Below is a list of all of the icons in the library.
<HStack w="70%" flexWrap="wrap">
<Icon as={AddIcon} m="$2" w="$4" h="$4" />
<Icon as={ArrowLeftIcon} m="$2" w="$4" h="$4" />
<Icon as={ArrowRightIcon} m="$2" w="$4" h="$4" />
<Icon as={ArrowUpIcon} m="$2" w="$4" h="$4" />
<Icon as={ArrowDownIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronsLeftIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronsRightIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronsUpDownIcon} m="$2" w="$4" h="$4" />
<Icon as={AtSignIcon} m="$2" w="$4" h="$4" />
<Icon as={PaperclipIcon} m="$2" w="$4" h="$4" />
<Icon as={BellIcon} m="$2" w="$4" h="$4" />
<Icon as={CalendarDaysIcon} m="$2" w="$4" h="$4" />
<Icon as={MessageCircleIcon} m="$2" w="$4" h="$4" />
<Icon as={CheckIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronDownIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronUpIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronLeftIcon} m="$2" w="$4" h="$4" />
<Icon as={ChevronRightIcon} m="$2" w="$4" h="$4" />
<Icon as={CloseIcon} m="$2" w="$4" h="$4" />
<Icon as={CopyIcon} m="$2" w="$4" h="$4" />
<Icon as={TrashIcon} m="$2" w="$4" h="$4" />
<Icon as={DownloadIcon} m="$2" w="$4" h="$4" />
<Icon as={GripVerticalIcon} m="$2" w="$4" h="$4" />
<Icon as={EditIcon} m="$2" w="$4" h="$4" />
<Icon as={MailIcon} m="$2" w="$4" h="$4" />
<Icon as={ExternalLinkIcon} m="$2" w="$4" h="$4" />
<Icon as={MenuIcon} m="$2" w="$4" h="$4" />
<Icon as={InfoIcon} m="$2" w="$4" h="$4" />
<Icon as={LinkIcon} m="$2" w="$4" h="$4" />
<Icon as={LockIcon} m="$2" w="$4" h="$4" />
<Icon as={RemoveIcon} m="$2" w="$4" h="$4" />
<Icon as={MoonIcon} m="$2" w="$4" h="$4" />
<Icon as={SlashIcon} m="$2" w="$4" h="$4" />
<Icon as={CheckCircleIcon} m="$2" w="$4" h="$4" />
<Icon as={PhoneIcon} m="$2" w="$4" h="$4" />
<Icon as={HelpCircleIcon} m="$2" w="$4" h="$4" />
<Icon as={RepeatIcon} m="$2" w="$4" h="$4" />
<Icon as={Repeat1Icon} m="$2" w="$4" h="$4" />
<Icon as={SearchIcon} m="$2" w="$4" h="$4" />
<Icon as={SettingsIcon} m="$2" w="$4" h="$4" />
<Icon as={LoaderIcon} m="$2" w="$4" h="$4" />
<Icon as={StarIcon} m="$2" w="$4" h="$4" />
<Icon as={SunIcon} m="$2" w="$4" h="$4" />
<Icon as={ClockIcon} m="$2" w="$4" h="$4" />
<Icon as={UnlockIcon} m="$2" w="$4" h="$4" />
<Icon as={EyeIcon} m="$2" w="$4" h="$4" />
<Icon as={EyeOffIcon} m="$2" w="$4" h="$4" />
<Icon as={AlertCircleIcon} m="$2" w="$4" h="$4" />
<Icon as={CloseCircleIcon} m="$2" w="$4" h="$4" />
<Icon as={ShareIcon} m="$2" w="$4" h="$4" />
<Icon as={CircleIcon} m="$2" w="$4" h="$4" />
<Icon as={FavouriteIcon} m="$2" w="$4" h="$4" />
<Icon as={GlobeIcon} m="$2" w="$4" h="$4" />
<Icon as={ThreeDotsIcon} m="$2" w="$4" h="$4" />
<Icon as={PlayIcon} m="$2" w="$4" h="$4" />
</HStack>
Lucide is an open source icon library for displaying icons for react-native. gluestack-ui provides an easy integration with lucide icons.
<VStack space="md" alignItems="center">
<Icon as={Camera} />
<Icon as={ChromeIcon} />
<Icon as={InstagramIcon} />
<Icon as={FacebookIcon} />
</VStack>

SVG & Custom Icons

We can directly create Icon using createIcon function exported from @gluestack-ui/themed and use it by passing it in as prop in Icon component. CreateIcon function takes viewBox, d, path etc as parameters. We can use svgs from other icon libraries like fluent, react-icons etc.
Notes to remember while using createIcon function
  • Pass svg props such as viewBox in createIcon directly.
  • Copy the svg code without the SVG tag directly into the function argument Path or D or whichever prop justifies your svg.
  • Replace HTML SVG tags (e.g., <path>, <rect> etc) with the corresponding React Native SVG components (e.g., <Path>, <Rect> etc).
  • For any color property (i.e. fill, stroke etc), if you want to override that color, pass "currentColor" instead of a colorCode.
Before : <path fill="#FF0000" d="M10 10L20 20" />
After : <Path fill="currentColor" d="M10 10L20 20" />
const GluestackIcon = createIcon({
// createIcon function is imported from '@gluestack-ui/themed'
viewBox: "0 0 32 32",
path: (
<>
{/* Rect, Path is imported from 'react-native-svg' */}
<Rect width="32" height="32" rx="2" fill="currentColor" />
<Path
d="M9.5 14.6642L15.9999 9.87633V12.1358L9.5 16.9236V14.6642Z"
fill="white"
/>
<Path
d="M22.5 14.6642L16.0001 9.87639V12.1359L22.5 16.9237V14.6642Z"
fill="white"
/>
<Path
d="M9.5 19.8641L15.9999 15.0763V17.3358L9.5 22.1236V19.8641Z"
fill="white"
/>
<Path
d="M22.5 19.8642L16.0001 15.0764V17.3358L22.5 22.1237V19.8642Z"
fill="white"
/>
</>
),
})
function App() {
return <Icon as={GluestackIcon} color="black" size="xl" />
}
gluestack-ui provides a set of pre created icons that can be used directly in our app and can also integrate third party icons using AsForwarder from gluestack-style

Unstyled

All the components in gluestack-ui are unstyled by default. To customize your UI using the extendedTheme, please refer to this link. The import names of components serve as keys to customize each component.

Spec Doc

Explore the comprehensive details of the Icon in this document, including its implementation details, checklist, and potential future additions. Dive into the thought process behind the component and gain insights into its development journey.