--- title: Icon description: "`Icon` is a general icon component that can be used in your projects." links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/icon/icon.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/icon - storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-icon--basic --- # Icon `Icon` is a general icon component that can be used in your projects. ```tsx ``` ## Usage ```tsx import { GhostIcon } from "@yamada-ui/react" ``` ```tsx import { GhostIcon } from "@/components/ui" ``` ```tsx import { GhostIcon } from "@workspaces/ui" ``` ```tsx ``` You can view a list of all the [icons](https://yamada-ui.com/icons.md) we provide. :::tip To display a waiting state, such as while data is loading, use [Loading](https://yamada-ui.com/docs/components/loading.md). ::: :::tip If users need to interact with an icon, use [IconButton](https://yamada-ui.com/docs/components/icon-button.md). ::: ### Using React Icons When using [React Icons](https://react-icons.github.io/react-icons), set the component to `as`. ```ts import { Icon } from "@yamada-ui/react" import { FaRobot } from "react-icons/fa" ``` ```tsx ``` ### Using Lucide lab When using [Lucide lab](https://github.com/lucide-icons/lucide-lab), use `LucideIcon`. ```ts import { LucideIcon } from "@yamada-ui/react" ``` ```tsx ``` ## Props ### Icon | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | ### LucideIcon | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | | `as` | - | `As` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `iconNode` | - | `IconNode` | The icon of the [Lucide lab](https://github.com/lucide-icons/lucide-lab). | ## Accessibility If you set `aria-hidden={false}` and `aria-label` on `Icon` or `LucideIcon`, it will be read by screen readers. ```tsx ``` ### ARIA Roles and Attributes | Element | Roles and Attributes | Usage | | ------------- | -------------------- | ------------------------------------------------- | | `svg.ui-icon` | `role="img"` | Indicates that this is an image. | | | `aria-hidden` | Excludes the element from the accessibility tree. | ## Similar Components - [Avatar](https://yamada-ui.com/docs/components/avatar.md): `Avatar` is a component that displays a profile picture or an icon with initials representing a user. - [Image](https://yamada-ui.com/docs/components/image.md): `Image` is a component that displays images. - [Picture](https://yamada-ui.com/docs/components/picture.md): `Picture` is a component that uses the `picture` element to provide alternative images for different display and device scenarios. - [AspectRatio](https://yamada-ui.com/docs/components/aspect-ratio.md): `AspectRatio` is a component for embedding things like videos and maps while maintaining the aspect ratio. - [IconButton](https://yamada-ui.com/docs/components/icon-button.md): `IconButton` is a component that displays an icon within a button. - [QrCode](https://yamada-ui.com/docs/components/qr-code.md): `QrCode` is a component that displays a QR code. ## Used By Components & Hooks - [Accordion](https://yamada-ui.com/docs/components/accordion.md): `Accordion` is a component for a list that displays information in an expandable or collapsible manner. - [Alert](https://yamada-ui.com/docs/components/alert.md): `Alert` is a component that conveys information to the user. - [Autocomplete](https://yamada-ui.com/docs/components/autocomplete.md): `Autocomplete` is a component used to display suggestions in response to user text input. - [Avatar](https://yamada-ui.com/docs/components/avatar.md): `Avatar` is a component that displays a profile picture or an icon with initials representing a user. - [Blockquote](https://yamada-ui.com/docs/components/blockquote.md): `Blockquote` is a component that represents a quotation. By default, it renders a `blockquote` element. - [Breadcrumb](https://yamada-ui.com/docs/components/breadcrumb.md): `Breadcrumb` is a component that helps users understand the hierarchy of a website. - [Calendar](https://yamada-ui.com/docs/components/calendar.md): `Calendar` is a component for displaying or selecting dates in a calendar. - [Carousel](https://yamada-ui.com/docs/components/carousel.md): `Carousel` is a component that displays multiple elements like a slideshow. - [Checkbox](https://yamada-ui.com/docs/components/checkbox.md): `Checkbox` is a component used for allowing users to select multiple values from multiple options. - [CheckboxCard](https://yamada-ui.com/docs/components/checkbox-card.md): `CheckboxCard` is a component used for allowing users to select multiple values from multiple options. - [CloseButton](https://yamada-ui.com/docs/components/close-button.md): `CloseButton` is a component used primarily to trigger the close functionality of a component. - [ColorPicker](https://yamada-ui.com/docs/components/color-picker.md): `ColorPicker` is a component used by the user to select a color or enter an arbitrary color value. - [ColorSelector](https://yamada-ui.com/docs/components/color-selector.md): `ColorSelector` is a component used by the user to select a color. - [DatePicker](https://yamada-ui.com/docs/components/date-picker.md): `DatePicker` is a component used for users to select a date. - [Loading](https://yamada-ui.com/docs/components/loading.md): `Loading` is a component displayed during waiting times, such as when data is being loaded. - [Menu](https://yamada-ui.com/docs/components/menu.md): `Menu` is a component that displays a common dropdown menu. - [NativeAccordion](https://yamada-ui.com/docs/components/native-accordion.md): `NativeAccordion` is a component for a list that displays information in an expandable or collapsible manner using the HTML `details` element. - [NativeSelect](https://yamada-ui.com/docs/components/native-select.md): `NativeSelect` is a component used for allowing users to select one value from a list of options. It displays a native dropdown list provided by the browser (user agent). - [NumberInput](https://yamada-ui.com/docs/components/number-input.md): `NumberInput` is a component used to obtain numeric input from the user. - [Pagination](https://yamada-ui.com/docs/components/pagination.md): `Pagination` is a component for managing the pagination and navigation of content. - [PasswordInput](https://yamada-ui.com/docs/components/password-input.md): `PasswordInput` is a component that allows users to input passwords with a visibility toggle. - [Rating](https://yamada-ui.com/docs/components/rating.md): `Rating` is a component used to allow users to provide ratings. - [Reorder](https://yamada-ui.com/docs/components/reorder.md): `Reorder` is a component that allows you to change the order of items using drag and drop. - [Select](https://yamada-ui.com/docs/components/select.md): `Select` is a component used for allowing a user to choose values from a list of options. - [Sidebar](https://yamada-ui.com/docs/components/sidebar.md): `Sidebar` is a component used to display a list of items in a sidebar. - [Stat](https://yamada-ui.com/docs/components/stat.md): `Stat` is used to display numbers or data within a box. - [Steps](https://yamada-ui.com/docs/components/steps.md): `Steps` is a component that displays the progress of a multi-step process. - [Table](https://yamada-ui.com/docs/components/table.md): `Table` is a table component equipped with column sorting, row selection, and click event features. - [Tag](https://yamada-ui.com/docs/components/tag.md): `Tag` is a component used to categorize or organize items using keywords that describe them. - [Tip](https://yamada-ui.com/docs/components/tip.md): `Tip` is a component that displays supplementary information with a built-in icon trigger. - [Tree](https://yamada-ui.com/docs/components/tree.md): `Tree` is a component used to display hierarchical data structures in an expandable tree format.