Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/app/components/content/examples/icon/IconSvgExample.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<script setup lang="ts">
import { h } from 'vue'

const IconLightbulb = () => h(
'svg',
{ xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 24 24' },
[
h(
'path',
{
'fill': 'none',
'stroke': 'currentColor',
'stroke-linecap': 'round',
'stroke-linejoin': 'round',
'stroke-width': 2,
'd': 'M15 14c.2-1 .7-1.7 1.5-2.5c1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5c.7.7 1.3 1.5 1.5 2.5m0 4h6m-5 4h4'
}
)
]
)
</script>

<template>
<UIcon :name="IconLightbulb" class="size-5" />
</template>
26 changes: 25 additions & 1 deletion docs/content/docs/2.components/icon.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: A component to display any icon from Iconify.
description: A component to display any icon from Iconify or another component.
category: element
links:
- label: IcΓ΄nes
Expand Down Expand Up @@ -27,6 +27,30 @@ It's highly recommended to install the icons collections you need, read more abo
:::
::

## Examples

### SVG

You can also pass a Vue component into the `name` prop:

::component-example
---
name: 'icon-svg-example'
---
::

You can define your icon components yourself, or use [`unplugin-icons`](https://github.com/unplugin/unplugin-icons) to import them directly from SVG files:

```vue
<script setup lang="ts">
import IconLightbulb from '~icons/lucide/lightbulb'
</script>

<template>
<UIcon :name="IconLightbulb" class="size-5" />
</template>
```

## API

### Props
Expand Down
7 changes: 4 additions & 3 deletions src/runtime/components/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import type { AccordionRootProps, AccordionRootEmits } from 'reka-ui'
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/accordion'
import type { IconProps } from '../types'
import type { DynamicSlots } from '../types/utils'
import type { ComponentConfig } from '../types/tv'

Expand All @@ -13,11 +14,11 @@ export interface AccordionItem {
/**
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
/**
* @IconifyIcon
*/
trailingIcon?: string
trailingIcon?: IconProps['name']
slot?: string
content?: string
/** A unique value for the accordion item. Defaults to the index. */
Expand All @@ -40,7 +41,7 @@ export interface AccordionProps<T extends AccordionItem = AccordionItem> extends
* @defaultValue appConfig.ui.icons.chevronDown
* @IconifyIcon
*/
trailingIcon?: string
trailingIcon?: IconProps['name']
/**
* The key used to get the label from the item.
* @defaultValue 'label'
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/Alert.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/alert'
import type { AvatarProps, ButtonProps } from '../types'
import type { AvatarProps, ButtonProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Alert = ComponentConfig<typeof theme, AppConfig, 'alert'>
Expand All @@ -17,7 +17,7 @@ export interface AlertProps {
/**
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
avatar?: AvatarProps
/**
* @defaultValue 'primary'
Expand Down Expand Up @@ -51,7 +51,7 @@ export interface AlertProps {
* @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/
closeIcon?: string
closeIcon?: IconProps['name']
class?: any
ui?: Alert['slots']
}
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/AuthForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/auth-form'
import type { ButtonProps, FormProps, FormFieldProps, SeparatorProps, PinInputProps } from '../types'
import type { ButtonProps, FormProps, FormFieldProps, SeparatorProps, PinInputProps, IconProps } from '../types'
import type { FormSchema, FormSubmitEvent, InferInput } from '../types/form'
import type { ComponentConfig } from '../types/tv'

Expand All @@ -29,7 +29,7 @@ export interface AuthFormProps<T extends FormSchema = FormSchema<object>, F exte
* The icon displayed above the title.
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
title?: string
description?: string
fields?: F[]
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/Avatar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/avatar'
import type { ChipProps } from '../types'
import type { ChipProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Avatar = ComponentConfig<typeof theme, AppConfig, 'avatar'>
Expand All @@ -17,7 +17,7 @@ export interface AvatarProps {
/**
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
text?: string
/**
* @defaultValue 'md'
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/Banner.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/banner'
import type { ButtonProps, LinkProps } from '../types'
import type { ButtonProps, IconProps, LinkProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Banner = ComponentConfig<typeof theme, AppConfig, 'banner'>
Expand All @@ -22,7 +22,7 @@ export interface BannerProps {
* The icon displayed next to the title.
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
title?: string
/**
* Display a list of actions next to the title.
Expand All @@ -47,7 +47,7 @@ export interface BannerProps {
* @defaultValue appConfig.ui.icons.close
* @IconifyIcon
*/
closeIcon?: string
closeIcon?: IconProps['name']
class?: any
ui?: Banner['slots']
}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<script lang="ts">
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/breadcrumb'
import type { AvatarProps, LinkProps } from '../types'
import type { AvatarProps, IconProps, LinkProps } from '../types'
import type { DynamicSlots } from '../types/utils'
import type { ComponentConfig } from '../types/tv'

Expand All @@ -13,7 +13,7 @@ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
/**
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
avatar?: AvatarProps
slot?: string
class?: any
Expand All @@ -33,7 +33,7 @@ export interface BreadcrumbProps<T extends BreadcrumbItem = BreadcrumbItem> {
* @defaultValue appConfig.ui.icons.chevronRight
* @IconifyIcon
*/
separatorIcon?: string
separatorIcon?: IconProps['name']
/**
* The key used to get the label from the item.
* @defaultValue 'label'
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/components/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { CalendarRootProps, CalendarRootEmits, RangeCalendarRootProps, Rang
import type { DateValue } from '@internationalized/date'
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/calendar'
import type { ButtonProps } from '../types'
import type { ButtonProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Calendar = ComponentConfig<typeof theme, AppConfig, 'calendar'>
Expand Down Expand Up @@ -33,7 +33,7 @@ export interface CalendarProps<R extends boolean = false, M extends boolean = fa
* @defaultValue appConfig.ui.icons.chevronDoubleRight
* @IconifyIcon
*/
nextYearIcon?: string
nextYearIcon?: IconProps['name']
/**
* Configure the next year button.
* `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
Expand All @@ -44,7 +44,7 @@ export interface CalendarProps<R extends boolean = false, M extends boolean = fa
* @defaultValue appConfig.ui.icons.chevronRight
* @IconifyIcon
*/
nextMonthIcon?: string
nextMonthIcon?: IconProps['name']
/**
* Configure the next month button.
* `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
Expand All @@ -55,7 +55,7 @@ export interface CalendarProps<R extends boolean = false, M extends boolean = fa
* @defaultValue appConfig.ui.icons.chevronDoubleLeft
* @IconifyIcon
*/
prevYearIcon?: string
prevYearIcon?: IconProps['name']
/**
* Configure the prev year button.
* `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
Expand All @@ -66,7 +66,7 @@ export interface CalendarProps<R extends boolean = false, M extends boolean = fa
* @defaultValue appConfig.ui.icons.chevronLeft
* @IconifyIcon
*/
prevMonthIcon?: string
prevMonthIcon?: IconProps['name']
/**
* Configure the prev month button.
* `{ color: 'neutral', variant: 'ghost' }`{lang="ts-type"}
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/components/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { ClassNamesOptionsType } from 'embla-carousel-class-names'
import type { FadeOptionsType } from 'embla-carousel-fade'
import type { WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'
import theme from '#build/ui/carousel'
import type { ButtonProps } from '../types'
import type { ButtonProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>
Expand Down Expand Up @@ -39,7 +39,7 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
* @defaultValue appConfig.ui.icons.arrowLeft
* @IconifyIcon
*/
prevIcon?: string
prevIcon?: IconProps['name']
/**
* Configure the next button when arrows are enabled.
* @defaultValue { size: 'md', color: 'neutral', variant: 'link' }
Expand All @@ -50,7 +50,7 @@ export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Om
* @defaultValue appConfig.ui.icons.arrowRight
* @IconifyIcon
*/
nextIcon?: string
nextIcon?: IconProps['name']
/**
* Display prev and next buttons to scroll the carousel.
* @defaultValue false
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/ChatMessage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { AppConfig } from '@nuxt/schema'
import type { UIMessage } from 'ai'
import theme from '#build/ui/chat-message'
import type { AvatarProps, ButtonProps } from '../types'
import type { AvatarProps, ButtonProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type ChatMessage = ComponentConfig<typeof theme, AppConfig, 'chatMessage'>
Expand All @@ -16,7 +16,7 @@ export interface ChatMessageProps extends UIMessage {
/**
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
avatar?: AvatarProps & { [key: string]: any }
/**
* @defaultValue 'naked'
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/components/ChatMessages.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { AppConfig } from '@nuxt/schema'
import type { UIMessage, ChatStatus } from 'ai'
import theme from '#build/ui/chat-messages'
import type { ButtonProps, ChatMessageProps } from '../types'
import type { ButtonProps, ChatMessageProps, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type ChatMessages = ComponentConfig<typeof theme, AppConfig, 'chatMessages'>
Expand Down Expand Up @@ -31,7 +31,7 @@ export interface ChatMessagesProps {
* @defaultValue appConfig.ui.icons.arrowDown
* @IconifyIcon
*/
autoScrollIcon?: string
autoScrollIcon?: IconProps['name']
/**
* The `user` messages props.
* `{ side: 'right', variant: 'soft' }`{lang="ts-type"}
Expand Down
10 changes: 5 additions & 5 deletions src/runtime/components/ChatPromptSubmit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { ChatStatus } from 'ai'
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/chat-prompt-submit'
import type { ButtonProps, ButtonSlots } from '../types'
import type { ButtonProps, ButtonSlots, IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type ChatPromptSubmit = ComponentConfig<typeof theme, AppConfig, 'chatPromptSubmit'>
Expand All @@ -14,7 +14,7 @@ export interface ChatPromptSubmitProps extends /** @vue-ignore */ Pick<ButtonPro
* @defaultValue appConfig.ui.icons.arrowUp
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
/**
* The color of the button when the status is `ready`.
* @defaultValue 'primary'
Expand All @@ -30,7 +30,7 @@ export interface ChatPromptSubmitProps extends /** @vue-ignore */ Pick<ButtonPro
* @defaultValue appConfig.ui.icons.stop
* @IconifyIcon
*/
streamingIcon?: string
streamingIcon?: IconProps['name']
/**
* The color of the button when the status is `streaming`.
* @defaultValue 'neutral'
Expand All @@ -46,7 +46,7 @@ export interface ChatPromptSubmitProps extends /** @vue-ignore */ Pick<ButtonPro
* @defaultValue appConfig.ui.icons.stop
* @IconifyIcon
*/
submittedIcon?: string
submittedIcon?: IconProps['name']
/**
* The color of the button when the status is `submitted`.
* @defaultValue 'neutral'
Expand All @@ -62,7 +62,7 @@ export interface ChatPromptSubmitProps extends /** @vue-ignore */ Pick<ButtonPro
* @defaultValue appConfig.ui.icons.reload
* @IconifyIcon
*/
errorIcon?: string
errorIcon?: IconProps['name']
/**
* The color of the button when the status is `error`.
* @defaultValue 'error'
Expand Down
5 changes: 3 additions & 2 deletions src/runtime/components/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import type { CheckboxRootProps } from 'reka-ui'
import type { AppConfig } from '@nuxt/schema'
import theme from '#build/ui/checkbox'
import type { IconProps } from '../types'
import type { ComponentConfig } from '../types/tv'

type Checkbox = ComponentConfig<typeof theme, AppConfig, 'checkbox'>
Expand Down Expand Up @@ -36,13 +37,13 @@ export interface CheckboxProps extends Pick<CheckboxRootProps, 'disabled' | 'req
* @defaultValue appConfig.ui.icons.check
* @IconifyIcon
*/
icon?: string
icon?: IconProps['name']
/**
* The icon displayed when the checkbox is indeterminate.
* @defaultValue appConfig.ui.icons.minus
* @IconifyIcon
*/
indeterminateIcon?: string
indeterminateIcon?: IconProps['name']
class?: any
ui?: Checkbox['slots']
}
Expand Down
Loading
Loading