title: Radiant Text
description: A glare effect on text.
---

```vue
<template>
  <RadiantText
    class="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-600 hover:duration-300 hover:dark:text-neutral-400"
    :duration="5"
  >
    <span class="text-3xl font-bold">✨ Introducing Inspira UI</span>
  </RadiantText>
</template>

```

## 通过 CLI 安装

```vue
<InstallationCli component-id="radiant-text" />
```

## 手动安装

复制并粘贴以下代码：

```vue
<template>
  <p
    :style="styleVar"
    :class="
      cn(
        'mx-auto max-w-md text-neutral-600/70 dark:text-neutral-400/70',
        // Radiant effect
        'radiant-animation bg-clip-text bg-no-repeat [background-position:0_0] [background-size:var(--radiant-width)_100%] [transition:background-position_1s_cubic-bezier(.6,.6,0,1)_infinite]',
        // Radiant gradient
        'bg-gradient-to-r from-transparent via-black via-50% to-transparent  dark:via-white',
        $props.class,
      )
    "
  >
    <slot />
  </p>
</template>

<script lang="ts" setup>
import { cn } from "@/lib/utils";
import { computed } from "vue";

const props = defineProps({
  duration: {
    type: Number,
    default: 10,
  },
  radiantWidth: {
    type: Number,
    default: 100,
  },
  class: String,
});

const styleVar = computed(() => {
  return {
    "--radiant-anim-duration": `${props.duration}s`,
    "--radiant-width": `${props.radiantWidth}px`,
  };
});
</script>

<style scoped>
@keyframes radiant {
  0%,
  90%,
  100% {
    background-position: calc(-100% - var(--radiant-width)) 0;
  }
  30%,
  60% {
    background-position: calc(100% + var(--radiant-width)) 0;
  }
}

.radiant-animation {
  animation: radiant var(--radiant-anim-duration) infinite;
}
</style>

```

## API

| Prop 名称      | 类型     | 默认值 | 描述                                  |
| -------------- | -------- | ------ | ------------------------------------- |
| `duration`     | `number` | `10`   | Duration of the animation in seconds. |
| `radiantWidth` | `number` | `100`  | Width of the radiant animation.       |

## 感谢

- Credits to [Magic UI](https://magicui.design/docs/components/animated-shiny-text) for this fantastic component.