Typographytypographymaskheading
Image Masked Text
Large text with background-clip mask revealing image/video pattern.
Live Preview
Image Masked Text
Usage
Copy and paste this code into your React component:
tsx
import { BackgroundClipMask } from 'react-component-kit-ui/typography';
<BackgroundClipMask>Content</BackgroundClipMask>Manual Installation
If you are not using the npm package, create a new file and paste the following code: src/components/BackgroundClipMask.tsx + BackgroundClipMask.css:
BackgroundClipMask.tsx
'use client';
import type { ReactNode } from 'react';
import './BackgroundClipMask.css';
/** BackgroundClipMask โ ported from astro-component-kit. */
export interface BackgroundClipMaskProps {
children?: ReactNode;
}
export function BackgroundClipMask({ children }: BackgroundClipMaskProps) {
return (
<>
<h1 className="mask-txt" data-rk-519212="">{children}</h1>
</>
);
}
export default BackgroundClipMask;BackgroundClipMask.css
/* BackgroundClipMask โ ported from astro-component-kit (typography/BackgroundClipMask.astro) */
.mask-txt:where([data-rk-519212]) { font-size: 8rem; font-weight: 900; background: url('https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=1000&q=80'); background-size: cover; background-position: center; -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin: 0; line-height: 1; text-align: center; }
@media (max-width: 768px) { .mask-txt:where([data-rk-519212]) { font-size: 4rem; } }Quick Info
- Category
- Typography
- Filename
BackgroundClipMask.tsx- Dependencies
- None โ pure React + CSS
- Tags
- typographymaskheading