# Gradient

Color gradient text



<ComponentPreview base="opentui" name="gradient-demo" />

Installation [#installation]

<CodeTabs>
  <TabsList>
    <TabsTrigger value="cli">
      Command
    </TabsTrigger>

    <TabsTrigger value="manual">
      Manual
    </TabsTrigger>
  </TabsList>

  <TabsContent value="cli">
    ```bash
    npx shadcn@latest add @termcn/opentui-gradient
    ```
  </TabsContent>

  <TabsContent value="manual">
    <Steps>
      <Step>
        Copy and paste the following code into your project.
      </Step>

      <ComponentSource base="opentui" name="gradient" title="components/ui/gradient.tsx" />

      <Step>
        Update the import paths to match your project setup.
      </Step>
    </Steps>
  </TabsContent>
</CodeTabs>

Usage [#usage]

```tsx
import { Gradient } from "@/components/ui/gradient";
```

```tsx
<Gradient colors={["#ff6b6b", "#4ecdc4"]}>Hello Gradient</Gradient>
```

Examples [#examples]

Named presets [#named-presets]

Use the `name` prop with a built-in palette instead of passing `colors`.

<ComponentPreview base="opentui" name="gradient-presets" />

API Reference [#api-reference]

Gradient [#gradient]

Either pass `colors`, or pass `name` (not both required; `name` selects a preset when `colors` is omitted).

| Prop       | Type                                                                                                                                                     | Default    |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| `children` | `string`                                                                                                                                                 | `required` |
| `colors`   | `string[]`                                                                                                                                               | -          |
| `name`     | `"cristal" \| "teen" \| "mind" \| "morning" \| "vice" \| "passion" \| "fruit" \| "instagram" \| "atlas" \| "retro" \| "summer" \| "pastel" \| "rainbow"` | -          |
| `bold`     | `boolean`                                                                                                                                                | `false`    |
