# Gradient tooltip

> A colorful gradient tooltip with a matching arrow that slides up from a small badge on hover.

- Category: [Tooltips](https://library.aimran.es/components/tooltips)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tip-slide
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

This gradient tooltip is good at announcing things. Put it on a “New” or “Info” badge next to a menu item, on the beta label of a dashboard feature or next to a pricing term that needs a quick explanation. It rises a few pixels as it fades in, its arrow blending into the gradient.

It only reacts to hover, so keyboard and touch users may miss it; don't put anything critical there. Colors that are close together give a soft bubble, while contrasting ones make the tooltip look more like a promotion.

## Code

### HTML

```html
<span class="uv-tg">Info<span>New feature available</span></span>
```

### CSS

```css
.uv-tg {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uv-tg {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  display: inline-block;
  padding: .8em 1.6em;
  border-radius: 999px;
  font-size: var(--s);
  font-weight: 600;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
  cursor: default;
}

.uv-tg span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + .8em);
  padding: .65em 1em;
  border-radius: .8em;
  font-size: .8em;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
  box-shadow: 0 12px 30px -12px var(--c1);
  transform: translate(-50%,.8em);
  opacity: 0;
  pointer-events: none;
  transition: all calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-tg span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: .7em;
  height: .7em;
  background: color-mix(in srgb,var(--c1) 50%,var(--c2));
  transform: translate(-50%,-50%) rotate(45deg);
  border-radius: 0 0 .15em 0;
}

.uv-tg:hover span {
  transform: translate(-50%,0);
  opacity: 1;
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uv-tg {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  display: inline-block;
  padding: .8em 1.6em;
  border-radius: 999px;
  font-size: var(--s);
  font-weight: 600;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
  cursor: default;
}

.uv-tg span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + .8em);
  padding: .65em 1em;
  border-radius: .8em;
  font-size: .8em;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
  box-shadow: 0 12px 30px -12px var(--c1);
  transform: translate(-50%,.8em);
  opacity: 0;
  pointer-events: none;
  transition: all calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-tg span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: .7em;
  height: .7em;
  background: color-mix(in srgb,var(--c1) 50%,var(--c2));
  transform: translate(-50%,-50%) rotate(45deg);
  border-radius: 0 0 .15em 0;
}

.uv-tg:hover span {
  transform: translate(-50%,0);
  opacity: 1;
}
`;

export default function TipSlide() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <span className="uv-tg">Info<span>New feature available</span></span>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Gradient tooltip” block (Tooltips) from AIMRAN Library to my project.

## What it is
A colorful gradient tooltip with a matching arrow that slides up from a small badge on hover.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "New feature available"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import type { CSSProperties } from "react";

const css = `
.uv-tg {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  position: relative;
  display: inline-block;
  padding: .8em 1.6em;
  border-radius: 999px;
  font-size: var(--s);
  font-weight: 600;
  color: var(--c1);
  background: color-mix(in srgb,var(--c1) 12%,transparent);
  cursor: default;
}

.uv-tg span {
  position: absolute;
  left: 50%;
  bottom: calc(100% + .8em);
  padding: .65em 1em;
  border-radius: .8em;
  font-size: .8em;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg,var(--c1),var(--c2));
  box-shadow: 0 12px 30px -12px var(--c1);
  transform: translate(-50%,.8em);
  opacity: 0;
  pointer-events: none;
  transition: all calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-tg span::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: .7em;
  height: .7em;
  background: color-mix(in srgb,var(--c1) 50%,var(--c2));
  transform: translate(-50%,-50%) rotate(45deg);
  border-radius: 0 0 .15em 0;
}

.uv-tg:hover span {
  transform: translate(-50%,0);
  opacity: 1;
}
`;

export default function TipSlide() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <span className="uv-tg">Info<span>New feature available</span></span>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
