1 GitHub star = 1 new component.

Star the repo
Typographytypographyheadinggradient

Gradient Heading

Bold heading with smooth gradient fill.

Live Preview

Gradient Heading

Usage

Copy and paste this code into your React component:

tsx
import { GradientHeading } from 'react-component-kit-ui/typography';

<GradientHeading level={2} from="#6366f1" to="#c084fc">Content</GradientHeading>

Manual Installation

If you are not using the npm package, create a new file and paste the following code: src/components/GradientHeading.tsx + GradientHeading.css:

GradientHeading.tsx
'use client';

import type { CSSProperties, ReactNode } from 'react';
import './GradientHeading.css';

/** "a: b; --c: d" โ†’ style object */
function st(css: string | undefined): CSSProperties {
  const o: Record<string, string> = {};
  for (const decl of String(css ?? '').split(';')) {
    const i = decl.indexOf(':');
    if (i < 0) continue;
    const k = decl.slice(0, i).trim();
    if (k) o[k.startsWith('--') ? k : k.replace(/-([a-z])/g, (_, c) => c.toUpperCase())] = decl.slice(i + 1).trim();
  }
  return o as CSSProperties;
}

/** GradientHeading โ€” ported from astro-component-kit. */
export interface GradientHeadingProps {
  level?: 1 | 2 | 3 | 4 | 5 | 6;
  from?: string;
  to?: string;
  children?: ReactNode;
}

export function GradientHeading({ level = 1, from = '#6366f1', to = '#c084fc',
  children
}: GradientHeadingProps) {
  const Tag: any = `h${level}` as any;
  return (
    <>
      <Tag className="grad-txt" style={st(`--from: ${from}; --to: ${to}`)} data-rk-3ff594="">{children}</Tag>
    </>
  );
}

export default GradientHeading;
GradientHeading.css
/* GradientHeading โ€” ported from astro-component-kit (typography/GradientHeading.astro) */

.grad-txt:where([data-rk-3ff594]) { display: inline-block; font-weight: 900; background: linear-gradient(135deg, var(--from), var(--to)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2; margin: 0; }

Quick Info

Category
Typography
Filename
GradientHeading.tsx
Dependencies
None โ€” pure React + CSS
Tags
typographyheadinggradient