Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Text

Pro

Gloss Text for React

Text like glossy candy or plastic, with a highlight that follows the pointer across the letters. For React with Base UI, when a word should look good enough to touch.

Framework

Gloss Text makes a word look like glossy plastic or hard candy: one bright colour with a wet sheen over the top of the letters, a darker belly, a lighter bottom edge and a soft glow underneath. A bright highlight sits near the top like a light above; move the pointer over the text and it follows, gliding across the letters, then drifts back when the pointer leaves.

Use it for a playful, tactile word: a consumer product, a sweet shop, a call to action, a retro hero. For neutral metal that shines by itself, use Chrome Text; for a rainbow finish, Foil Text; for a flat flowing gradient, Gradient Text. Every layer is a background clipped to the letters; the pointer writes the highlight's place into two registered CSS properties and a transition eases it there, with no animation library.

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Usage

import { GlossText } from "@/components/ui/gloss-text";
<h2>
  <GlossText text="Sweet!" />
</h2>

Demos

Colors

baseColor is the plastic's colour, any CSS colour, including your theme's variables such as var(--primary); the sheen, the darker belly, the bottom edge and the glow are all mixed from it.

Preview width

Intensity

intensity is how shiny it is: subtle for satin, medium by default, strong for wet lacquer.

Preview width

Accessibility

The text stays real text, read by screen readers and selectable. Choose a baseColor that contrasts with the page: the sheen lightens the top of the letters, so a mid-tone reads best. In forced-colors mode, where backgrounds are removed, the text falls back to the system's text colour. The highlight only moves when the pointer does.

FAQ

How does the highlight follow the pointer?

On each move over the text, the pointer's place is written into two CSS variables, --gloss-text-x and --gloss-text-y. They're registered as percentages, so a transition eases the highlight there instead of jumping; leaving removes them, and it glides back to rest.

Where does the highlight rest?

High and centred, at 50% across and 28% down, like a light above the letters: where a glossy surface lit from above shows its brightest spot.

What happens on a touch screen?

The gloss shows with its highlight at rest, its sheen and its belly; nothing depends on the highlight moving.

How is it different from Chrome Text?

Chrome is neutral metal, light and dark bands with a sweep of light on its own. Gloss is one bright colour with a soft sheen and a highlight you move with the pointer: plastic rather than metal.

Which font suits it?

A heavy, rounded weight, such as font-black: the sheen and the belly need thick letters to show.

What happens with reduced motion?

Nothing moves by itself, so nothing changes: the highlight still follows the pointer, which only moves the light on the letters.

API Reference

GlossText

<span> data-slot="gloss-text"

PropType
textstring

The text.

baseColor?string

The plastic's colour, any CSS colour; its sheen, its darker belly and its glow are mixed from it. By default a candy pink.

intensity?"subtle" | "medium" | "strong"

How shiny it is: subtle for satin, medium, or strong for wet lacquer.

Type
"subtle" | "medium" | "strong"
Default
"medium"
render?ReactElement | ((props: object, state: object) => ReactElement)

Replace the host element or compose it with another component.

Type
ReactElement | ((props: object, state: object) => ReactElement)
className?string

Merged with the part's classes.

CSS variableType
--gloss-text-colorstring

The plastic's colour.

  • Pro

    Chrome Text

    Decorative

    Neutral metal that shines by itself

  • Pro

    Foil Text

    Decorative

    A rainbow finish under the pointer

  • Gradient Text

    Decorative

    A flat gradient that flows

  • Handcrafted

    Pro

    Emboss Text

    Decorative

    Light and shade, pressed into the page

  • Every detail deserves the spotlight

    Pro

    Spotlight Text

    Interactive

    A beam that follows the pointer

  • Pro

    Jelly letters that rock when pointed at

All 97 text effects